Wednesday, December 31, 2014

Re: gvim visual mode selection changes as you scroll up and down, how to fix it?

On 2014-12-31 12:59, Bao Niu wrote:
>>> On Sun, Dec 28, 2014 at 7:24 PM, Bao Niu wrote:
>>>> If I select a long patch of code spanning several pages, I'd
>>>> like to view how much I actually selected by scrolling up and
>>>> down. However this will automatically 'ruins' what I have
>>>> selected because it changes the anchor!
>
> So is this a bug? I mean, scrolling a screen up or down shouldn't
> affect my selection, should it?

It may be an annoyance, but it's a documented behavior rather than a
bug. You can read at

:help scrolling

where the first paragraph states "If the cursor position is
moved off of the window, the cursor is moved onto the window (with
'scrolloff' screen lines around it)."

This is because historically it's been safe to assume that the cursor
was always within the window, so changing this would likely break
numerous plugins.

A little further testing shows that you can drop a mark in visual
mode, scroll around, and then jump back to that mark when you're done:

v
{move to the other end of the desired selection}
ma " drop the "a" mark
{move around wherever you want in visual mode}
`a " jump back to where you dropped the "a" mark

which differs from my previous suggestion by allowing you to remain
in visual mode, and only using one mark rather than two (not that I
ever use more than about 4 marks in any one editing session)

-tim



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment