Whenever I start screen, it changes the title of the terminal window to 'screen'. Can I prevent that and have the window title remain what it would be if I hadn't run my command under screen?
More specifically, I'd like gnome-terminal to display the name of the buffer I'm editing in vim. I can do this by adding set title
to my .vimrc. Now when I run vim, the buffer name (along with some other information), shows up in the title of gnome-terminal. When I start screen and run vim, the title changes to 'screen'.
I've looked at the following page:
http://beautifulpixels.blogspot.co.at/2012/01/automatic-screen-window-titles-in-bash.html
But the suggested solution places the window title in the screen status line. I also tried adding this:
case $TERM in
screen*)
# http://dtfm.tumblr.com/post/7193076007/the-sweetest-screenrc-hack-ever
SCREENTITLE='\[\ek\e\\\]\[\ek\W\e\\\]'
;;
*)
SCREENTITLE=''
;;
esac
TITLEBAR='\[\e]0;\a\]'
export PS1="${SCREENTITLE}${TITLEBAR}[\u@\h \W]\$ "
To my .bashrc, but this only sets the window title to the current directory. Even if I run vim, the window title remains the current working directory. This is not the case if I run it outside of screen.
Any ideas?