Vim 8 goes Visual Mode on right click

Vim 8 shipped with Fedora 25 and Debian 9 when you mouse right click or use middle button to insert text to vim editor, it just go VISUAL mode.

This is because default changes in Vim 8.

Solution 1

The solution is to press SHIFT key before using mouse.

SHIFT + right mouse button = you will get paste option for copied text.

SHIFT + middle mouse button (press mouse wheel) = selected text will be pasted to vim.

SHIFT + INSERT = paste.

Solution 2

use vim.tiny, this can be activated by running

update-alternatives --config vi

Example

root@debug-instance:~# update-alternatives --config vi
There are 3 choices for the alternative vi (providing /usr/bin/vi).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/nvim        30        auto mode
  1            /usr/bin/nvim        30        manual mode
  2            /usr/bin/vim.basic   30        manual mode
  3            /usr/bin/vim.tiny    15        manual mode

Press  to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in manual mode
root@debug-instance:~# 

Solution 3

Run command

:set mouse-=a

to make this permanent, edit ~/.vimrc file, add

set mouse-=a

See vi

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *