Vim has (at least) two sets of commands that search in opposite directions. Typing /
and then a pattern will search forward through the document for the pattern; typing ?
and then a pattern will search backward. The same relationship exists between the *
and #
commands.
What I don’t like is that these commands also set the search direction for the n
and N
commands. After using /
, n
goes forward through the document and N
goes backward; after using ?
, n
goes backward and N
goes forward. (In other words, n
always goes in the same direction as the original search and N
always goes in the other direction.)
How can I get n
to go forward through the document, and N
to go backward, regardless of which direction I started searching in?