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
  • 55,929
  • 26
  • 146
  • 227
  • Recent versions of Vim added bracketed pasting in `xterm`s. 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
  • @SatoKatsura Interesting. Will try to find more about it. – Rui F Ribeiro Jan 31 '17 at 21:14
  • [You can find the right solution or a keyboard trick explained here](https://unix.stackexchange.com/a/381625/197391) – snariom38 Jul 27 '17 at 09:57
  • @snariom38 At work I am having that bug using Mac and Windows, no xterm... – Rui F Ribeiro Jul 27 '17 at 10:04

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
  • 55,929
  • 26
  • 146
  • 227
  • 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
1

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

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

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Carlos
  • 11
  • 1