4
votes

I have mouse scrolling turned on in vim and tmux and I'm using iTerm 2 because it has mouse support. But when I'm running vim inside of tmux, sometimes I have the problem that tmux is catching or stealing the scroll event from vim, I can scroll down in vim just fine. That's probably because in tmux I'm already scrolled all the way down, but when I try to scroll back up in vim, it goes into tmux scrolling mode and I see [0/0] at the top and I can't scroll up in vim.

How can I get mouse scrolling to work with vim inside of tmux?

1
It works for me out of the box with the Konsole terminal emulator... Getting those character codes right can be very tricky. - George Karpenkov
What do you mean character codes? I'm scrolling with the mouse... - aharris88
You might try putting set mouse-utf8 1 in your tmux.conf Not sure if that would help, as I use kubuntu with konsole. - EvergreenTree
I just tried putting set mouse-utf8 1 in my tmux.conf and when I open tmux it says: couldn't set 'mouse-utf8' need target session or -g - aharris88

1 Answers

0
votes

It turns out that the problem for me was caused by a vim plugin called tagbar: https://github.com/majutsushi/tagbar

I removed this plugin and I could scroll with the mouse just fine.