sponsor Vim development Vim logo Vim Book Ad

cmdline completion : cmdline completion like insert mode

 script karma  Rating 134/40, Downloaded by 2170  Comments, bugs, improvements  Vim wiki

created by
jinhu lu
script type
This script let you can use CTRL-P/N to complete word in cmdline mode
just like in insert mode.

for instance :
            1.   :something<C-P>
            2.   /else<C-N>
you also can map other keys instead of <C-P/N> like this in your vimrc:
            cmap <C-J> <Plug>CmdlineCompletionBackward
            cmap <C-K> <Plug>CmdlineCompletionForward

Or,  you may wanna keep compatiable recent history when using <C-P/N> , try this: ( Thanks for Enno.Nagel's good idea ) .
            cmap <expr> <c-p> getcmdpos() == 1 ? '<up><home>' : '<plug>CmdlineCompletionBackward'
            cmap <expr> <c-n> getcmdpos() == 1 ? '<down><home>' : '<plug>CmdlineCompletionForward'

install details
Drag this file into vim plugin directory ( ~/.vim/plugin)

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
cmdline_completion.vim 0.04 2012-10-31 7.0 jinhu lu Add completion search in loaded buffers support .
cmdline_completion.vim 0.03 2012-03-05 7.0 jinhu lu add completion support cursor at anywhere of cmdline.
cmdline_completion.vim 0.02 2011-04-15 7.0 jinhu lu change s:vars to b:vars to avoid dead loop when continue searching in another  buffer  , and dos2unix .
cmdline_completion.vim 0.01 2011-03-30 7.0 jinhu lu Initial upload
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.
Vim at Github