I use vim inside tmux over an ssh session and I often run into the issue where the
$DISPLAY variable gets changed, screwing up my copy-paste.
When I log in, $DISPLAY gets assigned to something new:
localhost:B.0 let's say. When this happens, any open tmux pane still has the old DISPLAY saved
localhost:A.0. Inside tmux that's easy enough to change, just
But, any open VIM sessions will also have the old display,
localhost:A.0. Now, I can quit out, change DISPLAY, and reopen vim, but that's a nuisance.
Is there a way to change OS environment variables from inside of vim?
- Suspending vim,
ctr+z, setting the environment variable and bringing vim back to the foreground,
- Setting the vim DISPLAY via
- Running shell commands from vim
But these don't work. Are there any other options?