Friday 2010-12-31

Xorg + screen + vim has an issue where vim's input/output get trashed when you kill Xorg, restart Xorg, and screen -R. I tested the following:

  1. rebuilt vim-7.3 from scratch, same prob
  2. ran vim under tmux, same prob
  3. ran nano under screen, works fine

I worked around this with this snippet in my xinitrc:

ls /tmp/screens/S-${USER} 2>&1 >/dev/null && {
	screen_arg="-R"
   	screen -p 0 -X kill
   	screen -X screen -t vim /opt/vim-7.3/bin/vim --servername local $HOME/etc/notes.txt
}

A cooler solution would use vim's mksession to save state. I don't need that as this is just to handle me (auto-)logging out of X. Although this did make me update my vim python scripts to python3.