/patternType Enter to execute the search.
Search efficiently, run substitutions, and automate repetitive edits with macros.
Search forward and backward and reuse patterns efficiently.
/patternType Enter to execute the search.
?patternUseful when you overshoot or are tracing a prior reference.
n N`n` follows the search direction and `N` reverses it.
* #Great for moving through repeated identifiers in code.
Use Ex substitution commands for local and global refactors.
:s/old/new/gThe `g` flag replaces all matches on the current line.
Perform a global replacement across the buffer.
:%s/old/new/gcAdd `c` to confirm each replacement interactively.
Restrict replacement to a selected range.
:'<,'>s/old/new/gVisual ranges are useful for safer targeted edits.
:nohlsearchKeeps the screen clean after repeated searching.
Record and replay repeatable editing sequences.
qqStart with `q{register}` and press `q` again to stop.
@q 10@qCounts let you replay the macro over many lines.
@@Useful when stepping through repetitive records line by line.
:'<,'>normal @qA very efficient way to transform multiple lines using one recording.