Search code examples
vimbufferx11pastexterm

VIM and X11: do not touch primary buffer


this should be simple to explain. I select some text from an random source, open an existing file in vim (which is running in an xterm session).

If I go to insert mode, I can paste the previously selected text with the mouse's middle button. It is my undestanding that the selected text is placed into the PRIMARY buffer.

If I delete a line with dd, the deleted line will be pasted with a middle click, and this is an unwaned behaviour. Setting clipboard to unnamed or unnamedplus does not change this behaviour.

If I set clipboard to autoselect, dd will not replace the selected text (which is an improvement) but selection in visual mode will (unwanted).

The behaviour I want is: yank, deletion and visual mode selection shall not overwrite what I selected with the mouse. The latter content shall always be pasteable with the middle click, regardless of what I did in vim. I never have the need to paste in an another application what I selected in vim.

Which configuration settings shall I use to get this behaviour?

Best regards, Patrik


Solution

  • Ok, it seems that this is the settings I am looking for

    set clipboard=exclude:cons\|linux\|xterm-256color