4

After upgrading to Debian Stretch, we have been unable to copy&paste with the mouse in MacOS Sierra and Windows clients alike.

I have tried several solutions, including from this thread, without much sucess. Copy-paste for vim is not working when mouse (:set mouse=a) is on?

I have tried to place in /etc/vim/vimrc.local the followings lines:

set vb t_vb=
set mouse="" 

and besides mouse="", mouse="a" mouse="r" and mouse="v", and none of the solutions worked.

What do seems to work, it to comment in the file /usr/share/vim/vim80/defaults.vim the following lines:

"if has('mouse')
"  set mouse=a
"endif

As soon those lines are commented out, we are able to copy&paste again.

However, those changes are lost in the next vim upgrade.

Any suggestions for a more permanent solution?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

3 Answers3

5

Do:

sudo touch /etc/vim/vimrc.local

Then edit the file:

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.

" Load the defaults
source /usr/share/vim/vim80/defaults.vim

" Prevent the defaults from being loaded again later, if the user doesn't
" have a local vimrc (~/.vimrc)
let skip_defaults_vim = 1


" Set more options (overwrites settings from /usr/share/vim/vim80/defaults.vim)
" Add as many options as you whish

" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif

This will apply the rule for the whole system and all users. Tested on Debian 9.3.

Nomura
  • 51
  • 1
  • 2
4

It's

set mouse=r

I did edit the default file because there were more defaults changed since jessie.

vi /usr/share/vim/vim80/defaults.vim

because somehow now syntax highlighting was on at default and all the users complained.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • 2
    Do not edit defaults.vim as that file will be squashed in each upgrade. However I do confirm that set mouse=r now is working. As per my question, it was not working in the beta I tried. – Rui F Ribeiro Jun 20 '17 at 13:02
2

I did it, setting this option in my local vimrc file

echo "set mouse-=a" > ~/.vimrc

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Carlos
  • 21