CamelCaseComplete : Insert mode completion that expands CamelCaseWords and underscore_words.
| script karma
Downloaded by 615
Comments, bugs, improvements
script versions (upload new version)
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
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.
- camelcasemotion (vimscript #1905) provides special motions ,w ,b and ,e
through CamelCaseWords and underscore_notation and corresponding text
- Loosely based on and similar to the "Custom keyword completion" from
- Check out the CompleteHelper.vim plugin page (vimscript #3914) for a full
list of insert mode completions powered by it.
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.
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.
To uninstall, use the :RmVimball command.
- Requires Vim 7.1 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.010 or
- Requires the CompleteHelper.vim plugin (vimscript #3914).
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
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)
Click on the package to download.
ip used for rating:
||- 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.
||- 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.