3rf
3rf

Reputation: 1164

Vim auto-completion on substitutions and searches in the command line

Is it possible to use Ctrl+n style auto-completion when doing searches and substitution commands in vim?

What I mean is: say I have a variable named myNumber in my current file. If I enter insert mode and type myNu and then hit Ctrl+n, it will autocomplete the word to myNumber (assuming there are no other words that start with those letters).

Is there any way to get this same functionality on the command line? Is there a setting or plugin that will allow me to type /myNu and then hit a key to complete my text search to /myNumber ? Or, more realistically: let me type :s/myN and complete that to :s/myNumber so I can more quickly type out substitution commands?

Upvotes: 15

Views: 3730

Answers (3)

Naga Kiran
Naga Kiran

Reputation: 8745

This plugin also enables auto-completion in command line.

https://github.com/vim-scripts/sherlock.vim

Upvotes: 1

Kent
Kent

Reputation: 195049

While in command mode, press Ctrl+f — you will enter command line window. There you can edit your command like in vim. Auto-completion should work too.

Upvotes: 30

3rf
3rf

Reputation: 1164

Looks like the plugin http://www.vim.org/scripts/script.php?script_id=2222 does more or less exactly what I wanted. Upvoting Kent though, because that's really nifty.

Upvotes: 4

Related Questions