I have the following situation. If I open a file in Vim, say by running vim myfile.tex, select something in visual mode, and do "+y, it is in the system clipboard as one would hope. If however I open a project, say vim -S myproject.vim, in which the same files are open, "+y does not change the system clipboard. This behavior is actually new; it did not do it before yesterday. I did not to my knowledge change anything in the configuration in the intervening period.

My current default Vim does return -clipboard among other things from vim --version, so I suppose I am lucky it works in even setting, but I am reluctant to switch to a different version of Vim because I switched to the present one because another extension was broken. The computer is running Ubuntu 22.04.

  • 2
    Which platform are you using? Did you close the Vim window before you tried to paste things? Commented Sep 22, 2022 at 13:16
  • Does this answer your question? How can I copy text to the system clipboard from Vim? Commented Sep 22, 2022 at 16:41
  • No, I know how to do that. The issue initially was that that vnoremap Y "+y was not behaving as expected, but I realized afterward that generally, "+yy was not functioning, but only within a project, like vim -S myproject.vim; in the context vim myfile.tex it was working just fine. I have checked :vim --version on both versions, and it comes up with -clipboard, so one wouldn't expect it to work at all, but it does work consistently when I simply open a file.
    – jdc
    Commented Sep 23, 2022 at 14:58
  • @MartinTournoij, my apologies, I wrote a response yesterday and then presumably lost connection before I hit "Add comment." I am using Ubuntu 22.04. I had not closed the terminal tab running Vim.
    – jdc
    Commented Sep 23, 2022 at 15:00
  • 1
    Might be worth trying How to debug my vimrc on your vimrc and on the session file
    – D. Ben Knoble
    Commented Sep 23, 2022 at 15:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.