I would like to know if/how I can make vim look for the next occurrence of a variable. Let\'s say the variable\'s name is simply \'n\', then /n
would give me all oc
If you press n
in command mode it will give you the next match of your search.
More detail:
/
will start forward search?
will start backward searchn
will give you the next result in the direction you are searchingN
will give you the previous result wrt the direction you are searching inIf you have the cursor over the variable in question, you can press *
and it will search for the next occurrence or #
will search for the previous one.
This is equivalent to typing:
/\<n\>
(\<
matches on the start of a word and \>
matches on the end of word). The only difference (for reasons I'm not sure of) is that *
and #
don't pay attention to the 'smartcase'
option.
See:
:help *
:help /\<