Disable Macvim scrolloff when selecting with the mouse

Go To StackoverFlow.com


I have set a high value for scrolloff, which works really well for me when I am moving around with the keyboard. However, any time I try to select something with the mouse in an off-center line (so that I can copy some text), that line jumps to the center, preventing me from selecting that text. Is there a way to keep the scrolloff setting but prevent a mouse click from moving the cursor to that line?

2012-04-04 19:32
by Abhi
Simple: don't use the mouse - romainl 2012-04-04 20:14


I don't believe that there is a way to use an autocmd to set scrolloff=0 when using the mouse, but you could map a key to toggle between scrolloff=0 and scrolloff=50(or whatever value you are using) and just use that mapping before selecting text:

map <silent> <Leader>m :exec &scrolloff==0? "set scrolloff=50" : "set scrolloff=0"<CR>
2012-04-04 23:15
by Nolen Royalty