Tim Chase schrieb:
 >> 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 |'<|.

Thanks for the pointer!  I couldn't find hints about this in the help.

Interesting that "mappings for Visual mode" include commands given
with :normal (emphasize on "mappings").

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

This phrase would be more comprehensible, indeed.

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

-tim

Most important: It turned out to be documented :-)

Regards,
Andy

--
EOF








        
                
___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

Reply via email to