How do I run a Vim command without triggering any autocommands?
:noautocmd write
The :noautocmd modifier (abbreviated :noa) runs any subsequent Ex command while temporarily disabling all autocommand events.
:noautocmd write
The :noautocmd modifier (abbreviated :noa) runs any subsequent Ex command while temporarily disabling all autocommand events.
:%s/pattern/\U&/g
Vim's substitute replacement string supports special case-transform atoms that change the case of matched text without requiring a second pass or an external to
mA to set, 'A to jump
Uppercase marks (A–Z) are global marks — they persist across files and Vim sessions.
\@= and \@! and \@<= and \@<!
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@=, \@!, \@<=, and \@<! atoms.
{count}@{register}
Prefix any macro execution with a count to repeat it that many times in a single command.
:let @a = "content"
When a recorded macro has a typo or needs a small tweak, you don't have to re-record it entirely.
g* and g#
The and # commands search for the exact whole word under the cursor (with word boundaries \).
[[ and ]]
[[ and ]] navigate between section boundaries — typically the start of the previous or next top-level block.
"/
Vim stores the last search pattern in the special / register.
<C-a> (insert mode)
While in insert mode, pressing re-inserts the exact text you typed during your previous insert session.
:keeppatterns
Normally, any command that uses a pattern — including :substitute, :global, and :vimgrep — replaces the current search register @/ with the new pattern.
"-
Vim silently stores every deletion of less than one line in the special "- register (the "small delete" register).
:let @q =
Instead of recording a macro with q, you can assign any string directly to a named register using :let @{register} = 'keys'.
:earlier
Vim's undo history is not just a linear list of changes — it records timestamps too.
:find
The :find command searches for a file by name across all directories listed in Vim's path option, so you can open files without typing full paths.
:tab split
:tab split opens the current buffer in a brand new tab page, giving you a second independent view of the same file.
!{motion}{command}
The ! operator filters the text covered by a motion through an external shell command, replacing the original lines with the command's stdout.
zx
The zx command resets and recomputes all folds in the current window based on the current foldmethod.
:%s/pattern//gn
The n flag on the substitute command reports the number of matches without performing any substitution.
:keeppatterns %s/old/new/g
The :keeppatterns modifier runs any Ex command without modifying Vim's last search pattern (stored in @/).
command-line #search #ex-commands #command-line #substitute #registers