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