vim forgets registers (*, +) after reattaching tmux session; E353: Nothing in register

Solution 1:

It bugged me for months that sometimes I get +-registry in tmux-vim and sometimes I do not. Thank you guys for populating this thread. There are two long discussions on vim+tmux and vim+screen with X11 server change, yet, I was not able to identify a quick fix.

For now, I use dhruvasagar/vim-prosession to recover the missing +-registries while maintaining the previous editing session. With the default configuration, the entire session is stored upon exit when a vim session is started using vim from a certain directory. Now, tmux logs the directory, and vim-prosession takes care of the previous editing session.


Clipboard access over SSH (Win10)

I use a Windows 10 machine to access Tmux sessions on a Linux machine, where X410 provides clipboard support. When +-registry is not available, likely, the Windows clipboard is not accessible. Restarting X410 manually should fix this clipboard issue. (To my understanding, X410 is stuck somewhere, prohibiting other programs to write to Windows' clipboard.)

Separately, to get "Ctrl+C" to write to the +-registry in a Vim instance that is nested in a Tmux session running on the remote machine, re-attaching to the Tmux session can also break the ability to write to +-registry using "Ctrl+C". ==> When this happens and the Windows system clipboard is still working, the fix is to start a new pane/split in Tmux, and load a "new" Vim instance vim-prosession.

(Edits on 2021-11-17: added troubleshooting steps for Win10-WSL2 after the horizontal divider.)