Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mouse scrolling in vim scrolls terminal window

Tags:

vim

I am just getting started using Vim and came across :set mouse=a which I've found really useful for navigating a file, however for some reason when I try and scroll now it scrolls the whole terminal window and not just the vim window.

enter image description here

Then I scroll up and can see the terminal outside Vim

enter image description here

Any ideas on how to fix this? I've tried resetting mouse= and exiting and re entering vim.

like image 295
Simon Legg Avatar asked Dec 19 '22 20:12

Simon Legg


2 Answers

The problem was that I had accidentally disabled Allow Mouse Reporting in error.

Checking Menu > View > Allow Mouse Reporting or Cmd + R has fixed it!

like image 101
Simon Legg Avatar answered Jan 15 '23 01:01

Simon Legg


I think the cheap answer to your question is that you should be navigating through files in vim using motion commands, Ctrl + d, etc. It might seem slow at first, but it really becomes more natural down the line.

That said, if you are on Mac and using Terminal, you might need to hold the Fn to temporarily disable mouse support. (Check this out for reference: OS X Terminal Mouse Support

Also, you can always try MacVim, which supports mouse scrolling out of the box.

If neither of those solutions work for you, some more information would be helpful for troubleshooting, e.g., your operating system, recent changes to your vimrc, etc.

like image 36
yam Avatar answered Jan 15 '23 02:01

yam