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.
Screenshot:
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.
Written by Eric Haughee
Related protips
2 Responses
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.
This is amazing! Took a few tries to find the actual source of this command as well. Did it by accident, edited a grep, and wondered how to open it agian.
Here's one for you
:new|grep 'serach' ./ -ri
I do that because if I do sp|E, on a file with chanes, it will split twice... know why?