How do I remove the most recent Ex command from command history in Vim?
:call histdel(':', -1)
When you run sensitive or noisy Ex commands, they stay in command history and can be recalled accidentally.
:call histdel(':', -1)
When you run sensitive or noisy Ex commands, they stay in command history and can be recalled accidentally.
:Gedit HEAD~1:%
When you are deep in a refactor, you often need to compare the current buffer with an older version of the same file.
:filter /{pattern}/ history cmd
When command history gets crowded, scanning :history cmd manually is slow.
/\V<C-r>=histget('/', -2)<CR>
If you often alternate between two complex search patterns, opening q/ each time is slow.
:history /
Power users tend to run long, composable searches during refactors, but the default / and ? history navigation can be noisy when command history and search hist
:let @a=@1
When you delete full lines repeatedly, Vim rotates those deletions through numbered registers.
:<C-f>
Long Ex commands are easy to mistype when you edit inline on a single command line.
:history :
When you work with long substitution pipelines or multi-part Ex commands, digging through all history (:history) adds noise.
<Up>
In Vim's command line, and navigate history in prefix-filtered mode — they only cycle through past commands that begin with whatever you have already typed.
"1pu.u.u.
Vim stores the last 9 deletions in numbered registers 1-9, with the most recent in register 1.
q/k?pattern<CR>
Vim's command-line history window (q: for Ex commands, q/ for search) opens a full editing buffer containing your history.
<C-r>/ or q/
Press q/ to open search history in a window.
:colder / :cnewer
Vim remembers up to 10 previous quickfix lists.
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
:earlier 5m
Vim's :earlier and :later commands let you travel through your undo history using time-based offsets — not just individual changes.
"1p ... "2p ... "9p
Vim maintains a numbered register history from "1 through "9 that stores your last 9 deletes and changes.
:Git blame
The vim-fugitive plugin by Tim Pope provides a powerful interactive :Git blame that goes far beyond the basic command-line git blame.
:Gedit HEAD~3:%
The vim-fugitive plugin lets you open any version of any file from your Git history directly in a Vim buffer using the :Gedit command.
q:
The command-line window is a special buffer that shows your entire Ex command history and lets you edit entries using the full power of Vim's normal mode before
command-line #command-line #ex-commands #history #editing #productivity