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?

  • Recent versions of Vim added bracketed pasting in xterms. The initial implementation was less than perfect, and a number of bugs were fixed in subsequent patches. So if you're running a recent version but not the latest, you may be affected by said bugs. FWIW. – Satō Katsura Jan 31 '17 at 20:38
  • @SatoKatsura It is not bracketed pasting...it does not copy anything at all. – Rui F Ribeiro Jan 31 '17 at 20:59
  • Out of curiosity, how did you conclude it isn't related to bracketed pasting? – Satō Katsura Jan 31 '17 at 21:04
  • @SatoKatsura It completely ignores the copy operation. The paste returns the previous copy before the intended. – Rui F Ribeiro Jan 31 '17 at 21:09
  • 2
    Yup, this sounds quite similar to a problem reported to vim_dev. It turned out it was related to bracketed pasting. It certainly isn't normal behavior, so feel free to post a bug report if you think it's something else. – Satō Katsura Jan 31 '17 at 21:12
up vote 1 down vote accepted

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.

  • 1
    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

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

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

Hope this help you

  • Unfortunately, it also does not work. – Rui F Ribeiro Feb 18 '17 at 7:34

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.