VIM Command Line History Window

Ever been recording a macro when all of a sudden an unexpected window pops up out of nowhere in the bottom of your window, the contents of which appear to resemble the last few commands you've typed?

Well, it's definitely happened to me. This isn't exactly the sort of thing for which you can search online -- what sort of query can succinctly describe that? Well, today as part of another quest, I finally discovered what's going on!

VIM supports command line history (as can be most easily observed by pressing up or down in command line mode, or just typing ":history"). What I didn't know was that when in Command Mode, typing "q:" will open your command history in a sub-window. You can then navigate this window, make changes (in Normal mode), and re-execute the original commands or (and this is the cool part) modified commands simply by pressing enter! (from Command Mode).

To exit out of the sub-window, just CTRL+C (twice) as you would to cancel out of Command Line mode.

Comments

Anonymous said…
Great. I forgot this combination and this post did help me to figure it out again.

Recent posts