Wed, 04 Jun 2025 12:11:12 +0530
I hope I am not committing blasphemy but you can use the mouse in Vim.
Press Esc to go to command mode in Vim and use:
:set mouse=a
It will enable mouse mode immediately in all Vim modes, i.e. normal, insert and visual. To disable the mouse mode, use this:
:set mouse=
If you want to use mouse mode all the time, I am not judging you, add this entry to your ~/.vimrc
file:
set mouse=a
Save, restart Vim, and your mouse now works for clicking, scrolling, and selecting text.
What does mouse mode do in Vim?
First thing first, the mouse mode has limited usage in Vim. Don't expect to get a notepad like experience just because you enabled mouse mode.
It does add some functionality and ease of use like:
- Jump to exact locations without counting lines or using search
- Wheel scrolling while dealing with long files
- Easy text selection: double click to select a word, triple click to select an entire line, use mouse click and drag for the desired text selection
- Click between panes and resize them easily while using split windows in Vim
- While using tabs, click on other tabs to switch, click on X (should be visible at top right in mouse mode) to close a tab, double click on tab bar to create new empty files in new tabs
- Use middle click to paste from system clipboard
The video below shows some of the above discussed featured in action:
Vim Mouse Mode demonstration
Mouse mode doesn't replace Vim's keyboard efficiency - it complements it. Think of it as having both a sports car's manual controls and cruise control available.
Understanding mouse mode Options
Vim's mouse configuration works like a permission system:
set mouse=a " All modes (normal, visual, insert, command)
set mouse=n " Normal mode only
set mouse=v " Visual mode only
set mouse=i " Insert mode only
set mouse=c " Command mode only
set mouse=nv " Normal and visual modes
Mostly, you would want mouse=a
- which is like having universal access rather than mode-specific restrictions.
:help mouse-using
Conclusion
I am not a Vim purist and I won't judge you if you use mouse in Vim, which is known for its keyboard-centric approach to productivity.
Mouse mode doesn't diminish Vim's keyboard efficiency - it provides additional options for specific scenarios.
If you feel too uncomfortable with Vim at the beginning, opt for the hybrid approach where you use mouse for navigation and positioning, keyboard for editing operations.
I welcome your comments.
Recommended Comments