How can I switch from forward to backward search in Vim?
In Vim, I know that /
will search forward from the cursor, with n
and N
repeating the search forward and backward, respectively.
I also know that ?
will search backward from the cursor, with n
and N
repeating the search backward and forward, respectively.
My question is, if I've done a ?
search, and I want to re-run that as a /
search (so I don't have to keep holding shift to move forward), is there a way to switch the previous search's direction without retyping the search term?
Simply typing a ?
without any text following it will re-run the search backwards.
I.e. typing /
Return or ?
Return will always rerun the last search, but in the direction you want.
Is this more easier?
ctrl-o, ctrl-i - go through jump locations
Searching REF