On 2007-03-26, Some user <[EMAIL PROTECTED]> wrote:
> Yakov Lerner-3 wrote:
> > 
> > On 3/26/07, Some user <[EMAIL PROTECTED]> wrote:
> >>
> >> Hello,
> >>
> >> I'm using gVim on Windows and like it so far. There is one minor
> >> annoyance:
> >> when I scroll with the mouse wheel (I'm trying to use only keyboard but
> >> it'll take me a lot of time trying to break habit of using mouse to
> >> scroll),
> >> the cursor moves with the screen. Is there a setting I can set that will
> >> allow the cursor to remain fixed at one position when scrolling with the
> >> mouse wheen/scrollbar?
> > 
> > Are you talknig about the case (1) where you scroll by more
> > that screenful of text , or (2) when you scroll just several lines ?
> > 
> > If you mean (1) , then I  think vim must keep cursor position on-screen,
> > so
> > this is impossible. But you can have some mapping that let
> > you quickly jump to where the cursor was before scrolling (use marks).
> > 
> > Yakov
> > 
> > 
> 
> Yes, I mean (1). Why is it impossible? In gVIM you can also use the mouse to
> place cursor so I don't see a scenario where you'll "lose" the cursor. 
> 
> I hope there is a way to force it to keep cursor in one position without the
> overhead of using marks. :) Maybe some complex add-in or script or
> something?

For all vim's flexibility, it is not arbitrarily configurable.  
There are certain concepts that are fundamental to its behavior, and 
that would have far-reaching, mostly undesirable consequences if 
changed.  One of those is the "rule" that the cursor is always 
somewhere on the screen.  FWIW, emacs behaves the same way in that 
regard.

The only way I can think of to change this behavior for the case of 
scrolling with the mouse wheel would include hooking the scroll 
event with an autocommand, and I don't see an autocommand that 
allows that.  Further, ":help scroll-mouse-wheel" says:

    For the Win32 GUI the scroll action is hard coded.  It works 
    just like dragging the scrollbar of the current window.

That leads me to believe that the Windows mouse wheel does not 
generate a key code that could be mapped, either.  So I don't think 
it's possible to use a script to change this.

Therefore, I think your best bet is to add this to the list of vim 
quirks/features that you'll just have to get used to and to adapt 
your editing habits accordingly.

Regards,
Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Mobile Broadband Division
                             | Spokane, Washington, USA

Reply via email to