1

I find myself often selecting text and then wanting to go to the start of that selection rather than the end. For example in the following:

enter image description here

If I press esc, it will take me to the end of the selection, but often I find myself wanting to go to the beginning of a visual selection. Is there an easy way to do this?

3
  • 1
    Just o...and this must be a duplicate.
    – B Layer
    Apr 24 '20 at 23:55
  • @BLayer how would o work? Doesn't that create a new line below the current one? Oh -- I mean after the text is un-selected, does the visual mode create a marker or something?
    – David542
    Apr 25 '20 at 0:11
  • Yeah, sorry, I went to see if I could find an existing answer...otherwise I would add one here. But I got pulled away for a bit. Seems some eager beaver took care of half those steps.
    – B Layer
    Apr 25 '20 at 2:05
5

You can use the o visual-mode command to jump to the "other" end of the visual selection.

1

For normal mode see: quasi duplicate

You can unify all those mappings. E.g. if gv stands for select last visual selection, then append suffix 0 to go to start, or $ to end:

nnoremap gv0 `<
nnoremap gv$ `>
vnoremap gv0 o
vnoremap gv$ o

Basic visual block tips: http://vimcasts.org/episodes/selecting-columns-with-visual-block-mode/

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.