1

When using vim in commandline mode, I have to navigate using only arrow keys. I can't use the native vim bindings because when I key <esc>, it exits commandline mode.

For example, if I was typing a command in commandline mode, :w eiff.txt, but I realised that I've made a mistake, it should have been diff.txt, if I try to go back with the b button, it doesn't work because I can't hit <esc>.

So is there any way to navigate using the vim keys in the command line mode?

2

You can type q: to see command history and edit it like any other buffer.

Press Enter on the line with the command you want to execute.

p.s.: q/ works the same but for search history.

  • 5
    You can also use <c-f> while on the command line to bring up the command-line window. See :h cmdwin for more information – Peter Rincker Oct 16 '17 at 17:22
  • Alternatively, the plugin rsi.vim by Tim Pope provides readline mappings for insert and command modes. I find it very handy for simple editing tasks. – Rastapopoulos Oct 17 '17 at 7:26

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.