Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

From this answer here.

put this in your .vimrc:

autocmd BufReadPost,FileReadPost,BufNewFile * call system("tmux rename-window %")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top