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?

8
  • 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. Commented Jan 31, 2017 at 20:38
  • @SatoKatsura It is not bracketed pasting...it does not copy anything at all. Commented Jan 31, 2017 at 20:59
  • Out of curiosity, how did you conclude it isn't related to bracketed pasting? Commented Jan 31, 2017 at 21:04
  • @SatoKatsura It completely ignores the copy operation. The paste returns the previous copy before the intended. Commented Jan 31, 2017 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. Commented Jan 31, 2017 at 21:12

3 Answers 3

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.

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.

1
  • 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. Commented Jun 20, 2017 at 13:02
2

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

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

2
  • Unfortunately, it also does not work. Commented Feb 18, 2017 at 7:34
  • have various debian instances and one where only this works [shrug]
    – teknopaul
    Commented Dec 21, 2023 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .