Last Updated: August 25, 2017
· ehaughee

Vim Tip: Command History Buffer


After numerous accidental invocations of the following tip, I finally figured out what I was doing and now find it very useful.

To open a browsable and selectable list of your Vim command history (commands entered via :<some command here>), just press q:. Of course, :q is to quit but the reverse gives you a nice way to sift through, and invoke, previous commands.



Hitting <enter>, with your cursor on one of the lines, will invoke that command. Hitting <enter> on the blank line at the bottom will close the buffer and take no further action.

This history is, for the most part, a normal buffer and can be interacted with as such. For example, closed with :q or resized with <Ctrl+W>+.

Also, usevim is a phenomenal blog for Vim tips, tutorials, plugins, and scripts.

1 Response
Add your response


Thanks so much for the tip. I had typed it so many times by accident that when I wanted to edit the command buffer on person I could not remember my accidental keystrokes.

By the way, trying to read Bram Moolenar's mind, I thought if q: edits the command buffer, will q/ edit the search buffer
and it does|
as you might suspect q? also edits the search buffer.

over 1 year ago ·