我怎样才能得到我在vim中显示打开的文件在我的iTerm标签
题
我可以这样做让VIM标题来显示我的窗口:
let &titlestring = expand("%:t") . " @ " . hostname()
if &term == "screen"
set t_ts=^[k
set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
set title
endif
但是,翼片会说 “默认”。
从命令行我可以做到这一点:
echo -ne "\e]1;hello world\a"
这会在我的标签显示 “Hello World” 的。
有没有办法让VIM写这个东西我标签,而不是标题呢?
解决方案
我没有的iTerm,所以我不能对此进行测试,但尝试添加这您.vimrc
:
set t_ts=^[]1;
set t_fs=^G
类型CTRL-V Escape
为^[
和CTRL-V CTRL-G
为^G
。
其他提示
这是对我工作:
" Set the title of the Terminal to the currently open file
function! SetTerminalTitle()
let titleString = expand('%:t')
if len(titleString) > 0
let &titlestring = expand('%:t')
" this is the format iTerm2 expects when setting the window title
let args = "\033];".&titlestring."\007"
let cmd = 'silent !echo -e "'.args.'"'
execute cmd
redraw!
endif
endfunction
autocmd BufEnter * call SetTerminalTitle()
不隶属于 StackOverflow