Command-Line History

โ†‘/โ†“ for prefix-match, q: for the full window.

Keys: โ†‘, โ†“, q:, q/, q?

From the : prompt, โ†‘ and โ†“ scroll history filtered by what you've already typed. q: opens a full editable history window โ€” every Ex command you've ever run, in a buffer you can edit and re-execute.

Vim remembers everything you type at the : prompt. Two interfaces let you re-use it: arrow scrolling and the full history window.

Arrow scrolling

Key Effect
โ†‘ / โ†“ Scroll history filtered by current prefix
Ctrl-P / Ctrl-N Same โ€” without prefix filter

If you've typed :s then press โ†‘, only previous commands starting with s are shown. Ctrl-P ignores the prefix and walks plain history.

The history window: q:

Open and reuse
KeyNote
{key:q}{key::}Opens a buffer with full Ex command history
{key:k}Move up to a previous command
{key:Enter}Execute that line
{key:Ctrl-C}Or close the window without running anything

Worked example โ€” q:

Command-line history as an editable buffer.

Step 1 ยท q: โ€” opens the history window.
q: โ€” opens the history window.
Step 2 ยท kk ยท Pick any line, edit it, Enter to run.
Pick any line, edit it, Enter to run.

Watch

See also: Repeat Last Ex (@:), Editing the Command Line