Vim Special Character Commands Cheatsheet

Search Commands

Command Description
* Search forward for word under cursor
# Search backward for word under cursor
/pattern Search forward for pattern
?pattern Search backward for pattern
n Repeat search in same direction
N Repeat search in opposite direction
:%s/old/new/g Replace all occurrences of 'old' with 'new' in file
:%s/old/new/gc Replace all occurrences with confirmation

Use \c at the end of a search pattern for case-insensitive search.

Text Object Selection

Command Description
vi" Select text inside double quotes
va" Select text including double quotes
vi( or vi) Select text inside parentheses
va( or va) Select text including parentheses
vi{ or vi} Select text inside curly braces
va{ or va} Select text including curly braces
vit Select text inside XML/HTML tag
vat Select text including XML/HTML tag

Combine these with operators like d (delete), c (change), or y (yank/copy).

Advanced Movement

Command Description
f{char} Move to next occurrence of {char} on current line
F{char} Move to previous occurrence of {char} on current line
t{char} Move to before next occurrence of {char}
T{char} Move to after previous occurrence of {char}
; Repeat last f, F, t, or T movement
, Repeat last f, F, t, or T movement, backwards
% Move to matching parenthesis, bracket, or brace

Special Registers

Register Description
"+ System clipboard (for copy/paste with other applications)
"* System selection (Linux) or clipboard (Windows/macOS)
"_ Black hole register (deleting without affecting other registers)
"0 Yank register (last yanked text)
": Last executed command
"% Name of the current file
"# Name of the alternate file

Use these registers with commands like y (yank), p (put/paste), or d (delete). For example, "+yy to copy a line to system clipboard.