1

I would like to be able to search through the previous commands starting with : that I entered, using an interactive incremental search, as it is possible in some shells (example: with Ctrl-r in bash).

  • From reading through :help ex-edit-index it looks like there is no such feature in Vim. Note that if wildmenu is enabled the up arrow will only match with what you've typed (so :help<Tab> will complete only history items starting with :help), which is far more useful than bash's "fuzzy" <C-r> IMHO. It's also possible someone one wrote a plugin to do this, but I'm not aware of one (if you want to implement it yourself then look at :help history-functions). – Martin Tournoij Nov 19 '16 at 1:12
2

There is no direct equivalent of such behaviour of libreadline, but since Vim 7.4.2268 you can navigate through search matches when 'incsearch' option is on without leaving search mode via Ctrl-G/Ctrl-T keys, which combined with command-line window can give you experience similar to what you seek.

It's very easy if you know that you're going to use search right from the start:

start in cmdline-window

And requires several additional keystrokes to lift your input into search pattern if you realize you want to search in the middle of typing your command:

start in command-line

| improve this answer | |
0

You can use <Up> and <Down> at any time to recall previous commands starting with what you already typed.

See :help history.

| improve this answer | |
  • yes, but that is not what I am looking for. I also know that if I enter the beginning of a previous command and hit <Up> I will recall previous command that share this beginning. But that is not an reverse incremental search because it is restricted to matching the beginning of the command. – Gabriel Devillers Nov 18 '16 at 23:55
  • That's all you get in Vim. – romainl Nov 19 '16 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.