sponsor Vim development Vim logo Vim Book Ad

CamelCaseComplete : Insert mode completion that expands CamelCaseWords and underscore_words.

 script karma  Rating 33/9, Downloaded by 1965  Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
This plugin offers a keyword completion that is limited to identifiers which
adhere to either CamelCase ("anIdentifier") or underscore_notation
("an_identifier") naming conventions. This often results in a single (or very
few) matches and thus allows quick completion of function, class and variable
names.
The list of completion candidates can be restricted by triggering completion
on all or some of the initial letters of each word fragment; e.g. "vlcn" would
expand to "veryLongClassName" and "verbose_latitude_correction_numeric".
Non-alphabetic keyword characters can be thrown in, too, to both widen the
search to word fragments joined by the keywords (e.g. "joined#words") and to
narrow down the number of CamelCase and underscore_word matches.

SEE ALSO
- camelcasemotion (vimscript #1905) provides special motions ,w ,b and ,e
  through CamelCaseWords and underscore_notation and corresponding text
  objects.
- Loosely based on and similar to the "Custom keyword completion" from
  http://vim.wikia.com/wiki/Custom_keyword_completion
- Check out the CompleteHelper.vim plugin page (vimscript #3914) for a full
  list of insert mode completions powered by it.

USAGE
In insert mode, type some or all first letters of the desired CamelCaseWord or
underscore_word, then invoke the completion via CTRL-X CTRL-C.
You can then search forward and backward via CTRL-N / CTRL-P, as usual.

CTRL-X CTRL-C           Find matches for CamelCaseWords and underscore_words
                        whose individual word fragments begin with the typed
                        letters in front of the cursor.
 
install details
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim CamelCaseComplete*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

DEPENDENCIES
- Requires Vim 7.1 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.010 or
  higher.
- Requires the CompleteHelper.vim plugin (vimscript #3914).

CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:

By default, the 'complete' option controls which buffers will be scanned for
completion candidates. You can override that either for the entire plugin, or
only for particular buffers; see CompleteHelper_complete for supported
values.
    let g:CamelCaseComplete_complete = '.,w,b,u'

To disable the removal of the (mostly useless) completion base when there
are no matches:
    let g:CamelCaseComplete_FindStartMark = ''

You can disable the fallback to a case-insensitive search when the completion
base only contains lowercase letters. Then, (together with 'noignorecase'),
the case of the first CamelWord fragment and all underscore_word fragments
must always match exactly:
    let g:CamelCaseComplete_CaseInsensitiveFallback = 0

If you want to use a different mapping, map your keys to the
<Plug>(CamelCaseComplete) mapping target _before_ sourcing the script (e.g.
in your vimrc):
    imap <C-x><C-c> <Plug>(CamelCaseComplete)<Plug>(CamelCasePostComplete)
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
CamelCaseComplete-1.02.vmb.gz 1.02 2015-04-23 7.0 Ingo Karkat - Need special case for given underscore anchor (e.g. in "f_br" base); then, the assertion for alphabetic anchors (here: "b") must _not_ assert that there's no underscore before it.
- Remove default g:CamelCaseComplete_complete configuration and default to 'complete' option value instead.
CamelCaseComplete-1.01.vmb.gz 1.01 2013-12-19 7.0 Ingo Karkat - Factor out CamelCaseComplete#BuildRegexp() for re-use by the new InnerFragmentComplete.vim plugin.
- Add value "b" (other listed buffers) to the plugin's 'complete' option offered by CompleteHelper.vim 1.20.
CamelCaseComplete.vba.gz 1.00 2012-02-01 7.0 Ingo Karkat Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github