Here’s a partial answer. It can be improved, but I don’t have time to work it out right now.
Put the following in your .vimrc
:
autocmd BufReadPost,FileReadPost,BufNewFile * call system("tmux rename-window " . expand("%"))
There are other events (see :help autocmd-events
in Vim) that may be used to handle
as well. One thing I haven’t figured out is how to change the window name if you
have an instance of vim
open in each of two panes, and you switch from one pane
to the other. vim
is unaware of the activity in tmux
, so no vim
events are triggered.