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?

Not from my testing...

[ed: a hush falls over the mailing-list...Tim actually tested this response?! :) ]

Perhaps a diff. setting between our setups if you're experiencing drifting?

Other than the peculiar caveat regarding blockwise visual mode, it worked for me. Even in blockwise mode, it successfully went to the top, but wasn't always the top-*left* anchor.

Note that the ">" and "<" marks are jumped-to with the back-tick (rather than a regular apostrophe) which remembers column information as well, so when "gt" is run/expanded/executed, it

1) leaves visual mode
2) jumps to the exact anchor position of the bottom/top mark
3) enters the previous visual-mode as returned by the visualmode() function 4) and then jumps to the previous exact anchor position of the top/bottom mark

-tim






Reply via email to