我可以这样做让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()

来源: https://gist.github.com/bignimbus/1da46a18416da4119778

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top