jeromejj / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

feature request: Option for keeping cursor position while scrolling by mouse #155

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Right now, vim always shows cursor in viewable part of window by changing its 
position as viewport changes, even when user is scrolling by mouse wheel. 
Personally, I hate this. I understand that vim's philosophy is that you should 
never use a mouse, but mouse wheel is perfect for looking around document and 
no keyboard key can replace this functionality properly: users use mouse wheel 
to see what is out of the visible part of screen and no key replaces this 
properly. I don't think anybody use mouse wheel scrolling in vim for 
positioning cursor on exact line as they want as this method is highly 
inaccurate or slow for this - user have to scroll very slow to not overscroll 
desired line - if he does and still want to do this by mouse, he will need to 
scroll back by all of the height of buffer + missed lines because cursor stays 
on position if it does not reach border of viewport.

Because of this, if user want to go to new position below viewport, he instead 
use mouse scrolling only to position viewport to part of document where 
approximately is located line which user want to edit and then he will most 
probably use mouse click (they are still holding mouse right?) or use gg 
instead (or similar movement commands) as he now see line number.

I understand that some users maybe prefer it the way it is now - e.g. people 
using relative line numbering thanks to this feature don't have to type 1350gg 
to move to desired line, but instead 15+ as cursor is closer to desired line. 
That's why I'm asking for option for us.

If this is implemented, people can use mouse wheel in vim not only for changing 
cursor position to new unknown location (outside of view) but they can use it 
too in a way that they can scroll down/up to see what is below/above viewport, 
but when they want to continue in editing line they were editing, they just do 
it and viewport automatically changes to cursor position. If user want do this 
now without this proposed option, he has to use mark - and if he is in other 
mode, he have to exit this mode and then enter to this mode again (or use <C-o> 
in insert mode or key binding, doesn't matter still a lot more unergonomic than 
doing nothing). Because jumplist changes as cursor changes its position line by 
line when scrolling out of viewport, it can't be used comfortably either - 
because user doesn't know position of item in jumplist as it changed multiple 
times since then.

Also, it wouldn't manipulate with selection if user is in visual mode as it is 
now.

As another added benefits, scrolling with this options would be faster and more 
neat - without flickering cursor which position constantly changes. It would be 
faster because vim won't have to:
- calculate new location of cursor (start/end of line, start/end of words or 
similar behaviour which vim has now)
- move and display cursor to new position
- change active line background if option cursorline  is set
- highlight current line number
- expand current visual selection

Original issue reported on code.google.com by gade...@gmail.com on 22 Jul 2013 at 5:49