Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Vim's normal and insert modes are wonderful. A source of constant frustration for me is that whenever I enter command-line mode for entering Ex commands (by pressing :) suddenly I lose all the niceness of modal editing and wind up with a set of totally different (and comparatively lame) shortcuts that don't correspond to normal-mode OR insert-mode. Is there any way to enable standard modal editing of ex commands on the Vim command line? This would also be nice for / searching, etc.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Vim actually has several modes, of which normal and insert are just the most obvious. So to say...

To enter command line mode, after you press :, press Ctrl-F. Now you're in command line mode, where you can write up a command just like in insert, and edit it kinda like in normal mode. Enter will execute the command.

An example:

press : ("to get into" cmdline)
press Ctrl-F  
press a
write echom "Hello world!"
press Esc
press Enter

It will echo' the "Hello world!" on the commandline, just like as if you've written that command from the cmdline.

Does this make any sense?

share|improve this answer
2  
You can also get to the "Command-line window" by typing q:. If you want the same thing for searching, q/ and q? are analogous. Ctrl-F also works in the middle of a / or ? search. To see the full documentation, run :help cmdline-window in vim. –  MikeSep Dec 2 '11 at 1:46
    
@MikeSep - Good point! I knew there were some other ways as well, but have gotten so used doing it this way, I couldn't remember what they were. Thanks for adding that up! –  ldigas Dec 2 '11 at 1:50
    
Awesome, this is exactly what I was looking for. I'd upvote if I could. :) –  Eliot Dec 2 '11 at 19:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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