Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim can't scroll in iTerm2

Tags:

vim

iterm2

My vim can't scroll in iTerm2 even set mouse=a has added in .vimrc file.

Within tmux, however, vim's scroll function works correctly.

What's wrong with my vim?

like image 434
Douglas Su Avatar asked Aug 19 '15 19:08

Douglas Su


People also ask

How do I enable scrolling in Vim?

":set mouse=a" is used to enable mouse scrolling/selection.


2 Answers

Recent versions of vim support the "SGR" protocol, you can add code bellow to your .vimrc:

set mouse=a
if has("mouse_sgr")
    set ttymouse=sgr
else
    set ttymouse=xterm2
end
like image 168
Valery Viktorovsky Avatar answered Sep 17 '22 23:09

Valery Viktorovsky


I had the same issue, and Valery's answer did not work for me. What did work is checking the "Enable mouse reporting" box under Profiles > Terminal in the iTerm preferences.

like image 28
Simon Alford Avatar answered Sep 19 '22 23:09

Simon Alford