Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a pretty nice screen rc file that shows me the open screen windows almost like tabs at the bottom of the terminal. Currently the windows are named according to my prompt which is not so useful. Is there a way to automatically name the windows based on the filename of an open vim session currently in the window? I think this would make a supreme multi window editor if it were possible.

share|improve this question

1 Answer 1

Set the title option. This works out of the box for me in xterm and the like but not in screen. This tip works:

if &term == "screen"
  set t_ts="\ek"
  set t_fs="\e\\"
  set title

A different approach is to write a preexec function in your shell that sets the window title to the command being run. Zsh supports preexec natively, and bash can do it too. Here's a zsh example.

share|improve this answer
Hi. That did not work for me but I think it is because of how my .screenrc file is setup. 1 termcapinfo xterm* ti@:te@ 2 hardstatus alwayslastline 3 hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{= b C}[ %m/%d %c ]%{W}' –  user4785 Feb 16 '11 at 16:24
@user4785: If your prompt can set the Screen window title, Vim should be able to do it as well. What is your prompt? Does my .vimrc snippet work without your .screenrc? –  Gilles Feb 16 '11 at 20:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.