>> vnoremap gt <esc>`>:exec 'norm '.visualmode().'`<lt>'<cr>
>> vnoremap gb <esc>`<lt>:exec 'norm '.visualmode().'`>'<cr>
>
> I don't understand why this works.
>
> There must be a difference between
>    `>v`<
> and
>    :normal `>v`<
>
> "v" defines a new visual area and overwrites the `<,`>
> markers.  Why does "`<" after ":normal" move the cursor to
> the start of the _previously_ selected visual area?

Sorry it's taken me a while to get back on this...life got a
little crazy.

Buried away in the help just above

        :help :map-verbose

and in the section

        :help map-listing

one finds this little morsel of help:

        Note: When using mappings for Visual mode, you can use
        the "'<" mark, which is the start of the last selected
        Visual area in the current buffer |'<|.

It's also possible to read the help at

        :help '<

either way, as it refers to the "last selected visual area"
which in visual-mode could mean either "the area selected
before the the one I'm currently in", or "the current visual
selection which is now the 'last selected visual area'
because I'm now doing something other than selecting".  It
might help to have an extra sentence at this help to say
something like

        If you are currently in visual mode, this refers to the
        beginning/end of the *previous* visual selection

Hope this helps shed light on your question rather than
muddy the waters.

-tim





Reply via email to