How do you search through Vim's command history?

Type q: in the normal mode to open commands window. You can search/edit here using regular vim commands. You start in Normal mode. Press Enter to execute a command.

This approach lets you search across whole command not just beginning of line.


Enter the first letters of your previous command and push <Up> arrow (or Ctrl+p).

:set li<up>
:set lines=75

Don't forget to check history option and set it to big enough value

:set history=1000

Here are the docs for Vim's commandline history, also see this part of the docs on Vim's commandline history that covers the key bindings while in the history. It looks like you can say :foo and then hit the up arrow to find the last command that started with foo.

Tags:

Vim

Search