I'm labeling my Tmux tabs with the current file in vim like so:

autocmd BufEnter * let &titlestring = ' ' . expand("%:t")
set title
set t_ts=k

Then I have a VimLeave autocmd to have tmux rename the tab when I exit:

autocmd VimLeave * call system("tmux setw automatic-rename")

However, when I exit vim, the tab is renamed to "Thanks for flying Vim"

Any ideas how to fix this?

  • There is no need to set the t_ts option. If you find that this option is the wrong value in Vim, then you probably just set the wrong TERM environment variable. This is probably why restoring the old title doesn't work. Feb 27, 2017 at 10:18
  • Oh interesting. My $TERM variable is 'screen'. What should it be set to? Feb 27, 2017 at 20:48

1 Answer 1

'titleold'      string  (default "Thanks for flying Vim")

    This option will be used for the window title when exiting Vim if the
    original title cannot be restored.  Only happens if 'title' is on or
    'titlestring' is not empty.


autocmd VimLeave * set notitle

should fix it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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