From my ~/.gvimrc:
" Scroll Wheel = Up/Down 4 lines
" Shift + Scroll Wheel = Up/Down 1 page
" Control + Scroll Wheel = Up/Down 1/2 page
" Meta + Scroll Wheel = Up/Down 1 line
noremap <ScrollWheelUp> 4<C-Y>
noremap <ScrollWheelDown> 4<C-E>
noremap <S-ScrollWheelUp> <C-B>
noremap <S-ScrollWheelDown> <C-F>
noremap <C-ScrollWheelUp> <C-U>
noremap <C-ScrollWheelDown> <C-D>
noremap <M-ScrollWheelUp> <C-Y>
noremap <M-ScrollWheelDown> <C-E>
inoremap <ScrollWheelUp> <C-O>4<C-Y>
inoremap <ScrollWheelDown> <C-O>4<C-E>
inoremap <S-ScrollWheelUp> <C-O><C-B>
inoremap <S-ScrollWheelDown> <C-O><C-F>
inoremap <C-ScrollWheelUp> <C-O><C-U>
inoremap <C-ScrollWheelDown> <C-O><C-D>
inoremap <M-ScrollWheelUp> <C-O><C-Y>
inoremap <M-ScrollWheelDown> <C-O><C-E>
This has the unfortunate side effect of making it so the scroll wheel doesn't scroll the window under the mouse cursor, but rather the currently active window.
As for whether Vim in a terminal will be able to scroll with the mouse, it depends on if your terminal emulator will pass escape sequences to Vim when the scroll wheel is used. Xterm can do it, although it may require a little help on your part—see ":help xterm-mouse-wheel
".
If this then causes problems with copying, there are some solutions here.
– Sparhawk – 2014-10-20T23:34:28.630