When typing a command with ":" in Vim, I often find myself hitting escape and/or trying to navigate with h,j,k and l or trying other vi-style key combinations to edit the command I am writing. I have configured readline to use vi-style line editing so that when editing at the command line in e.g. bash or R, escape gets me into the equivalent of vim's normal mode. This does not work in vim command mode. There, escape gets you back to normal mode for the the text file you are writing, not the command you were editing.

Is there a way to get vi-style line editing in Vim command mode? If so, how?

I understand that escape should get you back to normal mode in the buffer, not in the command line, but maybe there is another key?


There's some good answers in this Stack Overflow thread

I think the best option is using q: instead of just : to enter command mode. This opens a window where you can type your command, and also contains your command history. If you've already started typing your command using just : and want to enter this mode you can press Ctrl+F.

Here's another thread with more answers

  • Wow. That's great. I think q: is the best options indeed. Thanks a million! – Daan Nov 3 '15 at 10:05
  • I really like that it works in search mode too by using q/ – Blake Nov 3 '15 at 10:07
  • Yes, I saw that. Many things just got a lot easier. :) – Daan Nov 3 '15 at 10:08

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.