4

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. – Martin Tournoij Feb 27 '17 at 10:18
  • Oh interesting. My $TERM variable is 'screen'. What should it be set to? – Solomon Bothwell Feb 27 '17 at 20:48
1
'titleold'      string  (default "Thanks for flying Vim")
                global

    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.

So

autocmd VimLeave * set notitle

should fix it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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