VIMで開いているファイルをITERMタブに表示するにはどうすればよいですか

StackOverflow https://stackoverflow.com/questions/2105880

  •  21-09-2019
  •  | 
  •  

質問

これを行うことで、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