On Linux/Unix, the Vim clipboard support communicates with the X11 system to synchronize the selection referred to by the "+ and "* registers.
For this feature to work, Vim needs to be able to communicate with the X11 server.
X11 is designed in a way that allows you to run multiple instances on the same host (multiple "displays") and applications use the $DISPLAY environment variable to determine which X11 display to use (in other words, which X11 server to connect to.)
In your case, you noticed you had DISPLAY=:0 inside tmux, where you're running Vim... While outside of tmux your terminal emulator reports DISPLAY=:1... What that means is that Vim inside tmux is trying to connect to the wrong X11 server.
Using export DISPLAY=:1 in your shell inside tmux fixes your problem, by having Vim inside tmux connect to the correct X11 server. (You might need to also reset this in other tmux windows/panes or in new shells that you open in tmux.)
This problem is most likely related to you having started tmux on one X11 session, then later reconnecting to it from another X11 session (perhaps you logged out from the GUI and logged in again, or a similar operation.) Since the selection of X11 display is controlled by an environment variable, once you start tmux in a specific display, it will by default stick to that display, which will also be inherited by shells and processes spawned in that tmux instance.
(Unfortunately, there doesn't seem to be a more general solution to this problem that doesn't involve updating the $DISPLAY variable once you reconnect, or once you notice the issue...)
"*y, but I’m on a mac and I’m not sure if that makes a difference. – D. Ben Knoble Feb 20 '20 at 18:18echo $DISPLAY(either outside Vim, on the shell, or inside Vim using the:echocommand), do you see some output indicating where Vim should connect for the clipboard? – filbranden Feb 21 '20 at 01:19vim --versionoutput include+clipboard? That's the one that actually matters for"+and"*... But if you have+X11and gtk and are usingvimx, I'd expect that to be the case... – filbranden Feb 21 '20 at 01:20waylandor editing remote files usingssh? – Christian Brabandt Feb 21 '20 at 07:01echo $DISPLAYgives me:0. Could you please explain what that means?Not sure what you mean by this.
– Armin Feb 21 '20 at 10:00echo $DISPLAYprints:1and the problem disapears. That's a starting point. – Armin Feb 21 '20 at 10:05export DISPLAY=':1'fixed this. Is it a reasonable thing to do? – Armin Feb 21 '20 at 10:11