Command-Line History
โ/โ for prefix-match, q: for the full window.
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:
| Key | Note |
|---|---|
| q: | Opens a buffer with full Ex command history |
| k | Move up to a previous command |
| Enter | Execute that line |
| C-c | Or close the window without running anything |
Worked example โ q:
Command-line history as an editable buffer.
Watch
- ๐บ #0446 q: โ Command History Window (not yet published)
- ๐บ #0447 q/ q? โ Search History (not yet published)
See also: Repeat Last Ex ({key:@:}), Editing the Command Line