On 24/08/2025 02:11, tomas wrote:
- Vi has lately changed its defaults for copy-paste (in an
X terminal, at least). I always have to "set mouse=" to get
my old behaviour back (and secretly curse at whoever had
this brilliant idea).
I have "set mouse=" in my vimrc as well, but writing about the "hold
Shift to select" trick in another message, I have realized that you may
have another reason to dislike default behavior.
Are your complains related to selected text missed in PRIMARY selection
(used by other applications) or you prefer to keep cursor in its
position? In the former case, is vim package, you installed, compiled
with enabled clipboard and "+,"* registers?
:echo has("xterm_clipboard")
Perhaps the snippet in /usr/share/vim/vim9*/defaults.vim (stripping
prior comments):
if has('mouse')
if &term =~ 'xterm'
set mouse=a
else
set mouse=nvi
endif
endif
may be extended to use has("clipboard_working") to enable mouse only if
selected text may be put to PRIMARY selection.
Inconvenience of selection handled by terminal (with disabled mouse or
holding Shift) is trouble with multiline text in vertically split
window. For pasting text it is safer to avoid middle click and to use
"*p or <C-R>* depending on current mode instead.