How do I do a whole-word search like grep -w in Vim, which returns only lines where the sought-for string is a whole word and not part of a larger word?
grep -w
\
matches bar but neither foobar nor barbaz nor foobarbaz.
bar
foobar
barbaz
foobarbaz
Use it like this in a substitution:
:s/\/baz
Use it like this to list all the lines containing the whole word bar:
:g/\
:h pattern is a good read.
:h pattern