Subject: making GNU screen, bash and vim work with a new X server I have the same problem, and solved it with a few nasty hacks. I want to keep GNU screen, with bash and vim, running nicely when I start a new X server and the DISPLAY number changes. (We are using Xming on Windows with a Linux server on the LAN). There's no 'nice' way to do this, as far as I can tell. My hacky solution reloads DISPLAY from a file each time you press enter in bash, and provides a :R = Restart() command in vim, so I can easily restart vim with a new DISPLAY, but preserving the current session (files, windows, etc.). It also provides a default --servername (process ID). I'm somewhat embarrassed to post this! 0. Make a ~/tmp directory: mkdir -p ~/tmp 1. In my .bash_profile (local): echo "DISPLAY='$DISPLAY'" >~/.session-env 2. In my .bashrc (local): export PROMPT_COMMAND='source ~/.session-env' 3. Wrapper script for vim / vi, put it in e.g. $HOME/bin: #!/bin/bash export vim_session=$$ export vim_restart_file="$HOME/tmp/vim-restart-$vim_session" VIM="/usr/bin/vim --servername $vim_session" $VIM "$@" while [ -e "$vim_restart_file" ]; do source ~/.session-env tmp="$vim_restart_file.tmp" mv "$vim_restart_file" "$tmp" $VIM -S "$tmp" "$@" rm -f "$tmp" done 4. In my .vimrc: function! Restart() let $DISPLAY='' exe "mksession ".$vim_restart_file :xa endfun command! R call Restart() Well, it's a bit complicated, but it does seem to work!