Go to the first, previous, next, last section, table of contents.

Search and Replace

See section Groundwork, for Ex address syntax. See section Options to see how to get literal (non-regular-expression) search and how to stop search from wrapping around.

<count> /<string>
To the <count>th occurrence of <string>.
<count> ?<string>
To the <count>th previous occurrence of <string>.
<count> g<move>
Search for the text described by move. (off by default)
n
Repeat latest / ? (next).
N
Idem in opposite direction.
%
Find the next bracket and go to its match
:[x,y]g/<string>/<cmd>
Search globally [from line x to y] for <string> and execute the ex <cmd> on each occurrence.
:[x,y]v/<string>/<cmd>
Execute <cmd> on the lines that don't match.
#g<move>
Execute the last keyboard macro for each line in the region. @xref{Macros and Registers}, for more info.
Q
Query Replace.
:ta <name>
Search in the tags file where <name> is defined (file, line), and go to it.
:[x,y]s/<p>/<r>/<f>
Substitute (on lines x through y) the pattern <p> (default the last pattern) with <r>. Useful flags <f> are `g' for `global' (i.e. change every non-overlapping occurrence of <p>) and `c' for `confirm' (type `y' to confirm a particular substitution, else `n'). Instead of / any punctuation CHAR unequal to <space> <tab> and <lf> can be used as delimiter.
&
Repeat latest ex substitute command, e.g. :s/wrong/good.


Go to the first, previous, next, last section, table of contents.