vim and accessing the system clipboard

Message
Author
VictorRotha
Posts: 13
Joined: Fri Jan 19, 2024 3:32 am

vim and accessing the system clipboard

#1 Post by VictorRotha »

Hi all, this is following on from an older post: viewtopic.php?p=647981 where they deal with the same question.

Off a reasonable clean install of MX KDE Plasma, I see that within the cli vim, the normal SHIFT-CTRL-C doesn't load highlighted text into the system clipboard. SHIFT-CTRL-P does paste the clipboard contents into vim as it should. The SHIFT-CTRL-C arrangement works fine off shell text or in less. I don't have a ~/.vimrc file.

The packages I have installed:

ii vim 2:9.0.1378-2
ii vim-common 2:9.0.1378-2
ii vim-gtk3 2:9.0.1378-2
ii vim-gui-common 2:9.0.1378-2
ii vim-runtime 2:9.0.1378-2

I've read the above thread, also a few from stackoverflow. One thing is the clipboard feature is not included in the mx/debian package. The forum reference above claims that by installing the vim-gtk package, that feature is then added - this is not the case with me; even in gvim - the shift sequences don't work, nor do the cut/paste escape mode commands displayed in the Edit menu, but it does work if I click on the Edit drop down menu, then click on cut or paste. Using set clipboard=unnamedplus or set clipboard=unnamed at the escape command line has no effect (nor do they in a .vimrc, which was subsequently deleted). The escape mode commands I tried were: "+yy , "+y , "*yy , "*y .

Does anyone have any ideas? Perhaps because I'm not using X11? Thanks.

User avatar
Adrian
Developer
Posts: 9195
Joined: Wed Jul 12, 2006 1:42 am

Re: vim and accessing the system clipboard

#2 Post by Adrian »

I think my recommendation of installing vim-gtk was ridiculous... it should work without that.

vim has its own highlighting way and it doesn't integrate nicely, I think the easiest way to do that is to hold Shift and highlight text with the mouse, then you should be able to copy the text with Shift-CTRL-C and paste with Shift-CTRL-P (or middle-click)

VictorRotha
Posts: 13
Joined: Fri Jan 19, 2024 3:32 am

Re: vim and accessing the system clipboard

#3 Post by VictorRotha »

I won't swear! Yes of course, SHIFT and select the text would work - I didn't think to continue the SHIFT 'meme' to escape vim's VISUAL clutches. I guess its always easy once you know and of course it is assumed knowledge otherwise. Thanks, I really appreciate the help.

Post Reply

Return to “Software / Configuration”