8

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?

1
  • I think as of now, you only exit command line mode when you press control + C.
    – zyy
    Commented Mar 21, 2021 at 14:57

1 Answer 1

10

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.

2
  • 10
    You can also use <c-f> while on the command line to bring up the command-line window. See :h cmdwin for more information Commented Oct 16, 2017 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. Commented Oct 17, 2017 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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