Title here
Summary here
/pattern
and press Enter to search for pattern
forward through the text.?pattern
and press Enter to search for pattern
backward.n
to find the next occurrence and N
to find the previous occurrence.:s
command is used for substitution in Vim::s/old/new/
old
with new
in the current line.g
to the substitute command::s/old/new/g
%
to denote the entire file::%s/old/new/g
Vim’s substitution commands can be enhanced by regular expressions for more complex search patterns:
i
after the command::%s/old/new/gi
:%s/\(old\) text/\1 new/g
/\bold\b
ensures that only the whole word old
is matched.c
to prompt for confirmation for each replacement::%s/old/new/gc
u
to undo the last command..
(any single character), *
(zero or more of the preceding element), and []
(character class) can be used to match complex patterns.:10,20s/old/new/g
:global
to combine searching with other commands::g/pattern/norm dwiNew