tmux tabs with name of file open in vim

后端 未结 6 736
孤街浪徒
孤街浪徒 2020-12-04 15:42

I\'m new to tmux and am trying to figure out how to edit the configuration so that windows with vim open show up in the taskbar not as #:vim but as whatever the

6条回答
  •  无人及你
    2020-12-04 16:17

    Great answers here, but I still couldn't get it to work the way I wanted it, which is: 1) Change the TMUX window name on opening vim 2) On quit. return it to the previous name when finished I achieved it with the following 3 vimrc lines:

    autocmd BufReadPost,FileReadPost,BufNewFile * call system("tmux rename-window " . expand("%:t"))
    let tmuxtitle = system("tmux display-message -p '#W'")
    autocmd VimLeave * call system("tmux rename-window " . shellescape(tmuxtitle))
    

提交回复
热议问题