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

Won't they move the boundary of the visual area together with the cursor?


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






Best regards,
Tony.

Reply via email to