Tim Chase schrieb:
How can I move the cursor the start of the visual selection?
With the "o" command, yes. But how can I make sure the cursor
is at the start while visual mode is on? The "`<" motion
followed by "gv" sets the cursor back to the end if it was
there.
I think it sounds like you want something like the following:
vnoremap gt <esc>`>:exec 'norm '.visualmode().'`<lt>'<cr>
vnoremap gb <esc>`<lt>:exec 'norm '.visualmode().'`>'<cr>
which gives you a "Go to the Top" and "Go to the Bottom" mapping within
visual mode.
It can be a little funky in blockwise visual-mode, if your '< and '>
points are top-right and bottom-left (rather than top-left and
bottom-right), as the "top" will go to the top-right, not the top-left.
I haven't figured out a good way to do this without considerably more
code in the mapping (save the column of '< and then "gvO" to go back to
visual-mode but in the other corner and then compare the columns to see
which you want, perhaps needing to switch back...it's ugly).
However, it should work fine in character-wise and line-wise visual modes.
HTH,
-tim
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?
Thx,
Andy
--
kühl, @vim.org ist wieder zurück
EOF
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de