sponsor Vim development Vim logo Vim Book Ad

sherlock.vim : Add completion in command line for '/', '?' and ':.../'

 script karma  Rating 28/10, Downloaded by 2467  Comments, bugs, improvements  Vim wiki

created by
Frederic Hardy
 
script type
utility
 
description
sherlock.vim add completion from current buffer for command line mode ':' after a '/', and in command line mode '/' and '?'.

By default, it use <C-Tab> for forward completion, and <C-S-Tab> for backward completion.

For example:
:%s/tes<C-Tab> list all word which begin with 'tes' after current cursor position;
:%s/tes<C-S-Tab> list all word which begin with 'tes' before current cursor position;
/tes<C-Tab> list all word which begin with 'tes' after current cursor position;
/tes<C-S-Tab> list all word which begin with 'tes' before current cursor position;
?tes<C-Tab> list all word which begin with 'tes' after current cursor position;
?tes<C-S-Tab> list all word which begin with 'tes' before current cursor position;

In ':' mode, completion is available only after a '/'.

When the right string is in command line, you can:
1) Validate it with <Enter>, or type <Esc> to go away from command line if you are in '?' or '/' mode;
2) Validate it with <Enter> or '/', or type <Esc> to go away from command line if you are in ':' mode.

You can override the default mapping with something like that in your .vimrc:
cnoremap <Whatever you want here> <C-\>esherlock#completeBackward()<CR>
cnoremap <Whatever you want here> <C-\>esherlock#completeForward()<CR>

You can disable this plugin with this line in your .vimrc:
let sherlock#disable = 1

Please, report any bug to sherlock.vim[..at..]mageekbox.net.
 
install details
Download vimball, open it with vim, and do :so %.
 

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
sherlock.vba 0.0.7 2009-10-06 6.0 Frederic Hardy Optimization.
sherlock.vba 0.0.6 2009-09-29 6.0 Frederic Hardy Remove bugs.
It's now possible to use completion even if cursor is not at the end of command line.
sherlock.vba 0.0.5 2009-09-18 7.0 Frederic Hardy Add <silent> on default mapping.
sherlock.vba 0.0.4 2009-08-07 7.0 Frederic Hardy Remove bug in vim version detection.
sherlock.vba 0.0.3 2009-08-07 7.0 Frederic Hardy Remove bug in <Esc> management.

sherlock.vba 0.0.2 2009-08-07 7.0 Frederic Hardy Add folding support.
If completion is in a closed folder, open it, and close it then go away.
sherlock.vba 0.0.1 2009-08-07 7.0 Frederic Hardy Initial upload.
ip used for rating: 3.137.157.45

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