In Visual Mode, you can do this using the o keystroke.

However with search highlighting, ie ? or / -- I have a whole selection, but I want to move specifically to the last character of the highlight.

I'm assuming there is a keystroke out there that accomplishes this. Is this the case?

Thanks in advance.


gn + <Escape>

gn                      Search forward for the last used search pattern, like
                        with n, and start Visual mode to select the match.
                        If the cursor is on the match, visually selects it.
                        If an operator is pending, operates on the match.
                        E.g., "dgn" deletes the text of the next match.
                        If Visual mode is active, extends the selection
                        until the end of the next match.

This will leave you already on the last character of the highlight so you only need to press <Escape>.


You can add various parameters or commands for the offset of where the cursor lands.

/test/e         on the last t of "test

More info here: http://vimdoc.sourceforge.net/htmldoc/pattern.html#search-offset

  • Interesting, but not quite. I'm looking for a cursor movement that will move the cursor to the end of the highlight.
    – Anon
    Mar 19 '17 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.