Search code examples
vimcommandvi

Alternatives to using arrows when accessing vi command history


In vi/vim, when you execute commands or searches they get added to a list of previous commands. And, just like in shell, they can be retrieved via the up or down arrow keys. These are very inconvenient, is there any other way to traverse the history without using the arrows keys?


Solution

  • Yes. In normal mode q: opens a vim window with the command history. You can work in it like any other vim buffer. Enter executes a command. q/ and q? do the same for searches.

    Also, while you are typing a command, you can press Ctrl-F to open the command-line window and continue editing the command there.