I use cscope+ctags+vim
to browse/edit my source code. I have put set title
in my .vimrc
to display the filename
I am currently editing/reading in the window title bar. This works perfectly in bash. However when I open vim
from tmux
, the window title bar doesn't not changes. How to fix this?
Asked
Active
Viewed 2,796 times
4

manav m-n
- 11,136
- 23
- 74
- 97
2 Answers
4
The issue was because $TERM
in bash
is xterm
whereas inside tmux
$TERM
is screen
. I updated my .vimrc
to select the correct term.
if &term == "screen"
set t_ts=^[k
set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
set title
endif
To get the escape sequence ^[
in vim, press Ctrl-V then Esc.

manav m-n
- 11,136
- 23
- 74
- 97
-
Works for me in tmux. Maybe all you need is to properly configure the `screen` terminfo – Steven Lu Feb 07 '17 at 23:37
2
From this answer here.
put this in your .vimrc:
autocmd BufReadPost,FileReadPost,BufNewFile * call system("tmux rename-window %")