Skip to content

How to fix scroll not working in VIM Linux?

  • by
  • 2 min read

Linux has become far easier for those not used to terminals and command-line interfaces. That said, there are still a lot of features and tools that rely on CLIs, and these can be a bit of a hassle to work with, especially if you don’t know what you’re doing. 

Linux’s Vim editor is a simple example of this. The editor is easy to open and use, but that’s just about where the ease of use ends. Anything after that will require you to enter shortcodes and commands for different things you need to do in the editor, making it not everyone’s cup of tea. 

In this article, we’re talking about scrolling in Vim, why it is not working and what you can do to fix this.

Also read: How to save and exit in Vim?


What causes this issue?

You’re not able to scroll in Vim because the usual mouse scroll wheel that we use to scroll other windows like webpages or documents doesn’t work the same way in Vim that it does in other applications. 

How to fix scroll not working in VIM Linux?
You’ll need Vim in command mode to activate mouse input.

That’s because Vim was made for terminal-based CLI systems, which didn’t require a mouse input. Hence there’s no default support for mice in the editor. 


How to fix this?

Fixing the issue is rather simple; you have to enable mouse scrolling and selection in Vim. You can do this by typing the following command in command mode (accessed by pressing the Esc key)

:set mouse=a

However, remember that this will only enable mouse scrolling and selection for your current session. If you close and restart Vim, you’ll have to type the command again. To avoid this, you can place this command in your .vimrc file. 

The file should be located in your user directory ($HOME for Linux) and if it isn’t, feel free to make it on your own and add the command to the file. This can also be used to create other shortcuts and keybinds that can help speed up your Vim workflow. 

Also read: How to count files in a directory in Linux?

>