sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

CmdlineComplete : complete command-line (: / etc.) from the current file

 script karma  Rating 181/60, Downloaded by 3295    Comments, bugs, improvements  Vim wiki

created by
Yuheng Xie
script type
When editing the command-line (: / etc.), press Ctrl-P or Ctrl-N to complete the word before the cursor, using keywords in the current file. E.g: you want to search for "elephant" in the buffer, just type /ele and press Ctrl-P. So long as "elephant" is in the buffer, you will get "ele" completed into "elephant".

This script is functional similar with (but far more better than) SearchComplete vimscript #474 (version 1.1).
install details
Just drop the script file "cmdline-complete.vim" into the plugin directory. Restart VIM.

If you want to use other keys instead of default <c-p> <c-n>, you may say in your .vimrc
cmap <c-y> <Plug>CmdlineCompleteBackward
cmap <c-e> <Plug>CmdlineCompleteForward
this will use Ctrl-Y for search backward and Ctrl-E for search forward.

Note: I don't think it's good to use Tab and Shift-Tab for completion, since it will disable vim's original cmdline-completion.

Without python, speed will be a bit slow with large file (e.g. > 100K). Compile your vim with python is recommended.

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cmdline-complete.vim 1.1.3 2008-07-18 7.0 Yuheng Xie added support for 'iskeyword'
cmdline-complete.vim 1.1.2 2008-07-13 7.0 Yuheng Xie added support for 'ignorecase' and 'smartcase'
cmdline-complete.vim 1.1.1 2008-07-09 7.0 Yuheng Xie trival fix for 1.1
cmdline-complete.vim 1.0.4 2008-05-08 7.0 Yuheng Xie fix for environment where python was found without module re
ip used for rating:

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.
SourceForge.net Logo