How do I repeat the last Ex command I ran?
@:
The @: command re-executes the most recently run Ex command (any command starting with :).
command-line #command-line #ex-commands #repeat #normal-mode #productivity
@:
The @: command re-executes the most recently run Ex command (any command starting with :).
command-line #command-line #ex-commands #repeat #normal-mode #productivity
&
The & command in normal mode repeats the last :s substitution on the current line.
search #search #substitution #ex-commands #repeat #normal-mode
:%s//new/g
Leaving the search field empty in a :s command tells Vim to reuse the last search pattern from / or .
search #search #substitution #ex-commands #regex #productivity
:g/^/m0
The :g/^/m0 command is a clever use of Vim's global command to reverse every line in the file.
:bufdo normal @a
The :bufdo command executes an Ex command in every open buffer, and when combined with :normal @a, it replays macro a across all of them.
macros #macros #buffers #ex-commands #automation #productivity
:g/pattern/normal @a
The :g (global) command combined with :normal @a lets you execute a recorded macro only on lines matching a pattern.
macros #macros #ex-commands #global-command #editing #automation
:m+1 / :m-2
The :m (move) command relocates lines to a new position in the file without using registers.
editing #editing #ex-commands #lines #productivity #mappings
:'<,'>norm {commands}
The :normal (or :norm) command lets you execute normal mode keystrokes from the command line.
command-line #editing #ex-commands #normal-mode #productivity #ranges
":p
The : register holds the most recently executed Ex command.
registers #registers #ex-commands #normal-mode #productivity
:w !{cmd}
The :w !{cmd} command writes the buffer contents to the stdin of an external shell command without modifying the buffer or saving to disk.
command-line #command-line #ex-commands #shell #editing #productivity
:copen / :cnext / :cprev
The quickfix list is Vim's built-in mechanism for navigating a list of file locations — compiler errors, grep results, search matches, or any structured outpu
navigation #navigation #quickfix #ex-commands #productivity #workflow
:%!{cmd}
The :%!{cmd} command pipes the entire buffer through an external shell command and replaces the buffer contents with the command's output.
command-line #editing #ex-commands #shell #filtering #productivity
:'<,'>s/\n/, /g
Vim's J command joins lines with a single space, but sometimes you need a custom separator like a comma, pipe, or semicolon.
editing #editing #ex-commands #visual-mode #substitution #lines
:lopen / :lnext / :lprev
The location list is a per-window variant of the quickfix list.
buffers-windows #navigation #quickfix #ex-commands #windows #productivity
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
:10,20t30
The :t command (short for :copy) duplicates lines from one location to another without touching any registers.
command-line #editing #ex-commands #lines #productivity #ranges
:enew | setlocal buftype=nofile bufhidden=wipe noswapfile
A scratch buffer is a temporary, unnamed buffer that exists only in memory — it won't prompt you to save when you close it and leaves no trace on disk.
buffers-windows #buffers #editing #ex-commands #productivity #workflow
:v/pattern/d
The :v command (short for :vglobal) is the inverse of :g — it executes a command on every line that does not match the given pattern.
command-line #editing #ex-commands #search #filtering #productivity
:.!sh
The :.
command-line #editing #ex-commands #shell #filtering #productivity
:args **/*.js | argdo %s/old/new/ge | update
The argument list (arglist) is Vim's mechanism for loading a set of files and running commands across all of them.
command-line #command-line #ex-commands #arglist #productivity #batch #editing