Como posso obter o arquivo que abri no vim para exibir na minha guia Iterm
Pergunta
Eu posso obter o título do VIM para exibir na minha janela fazendo isso:
let &titlestring = expand("%:t") . " @ " . hostname()
if &term == "screen"
set t_ts=^[k
set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
set title
endif
Mas as guias dirão "padrão".
Da linha de comando, posso fazer isso:
echo -ne "\e]1;hello world\a"
E isso mostrará "Hello World" em minhas guias.
Existe uma maneira de fazer com que o vim escreva essas coisas na minha guia em vez de título?
Solução
Eu não tenho Iterm, então não posso testar isso, mas tente adicionar isso a sua .vimrc
:
set t_ts=^[]1;
set t_fs=^G
Modelo CTRL-V Escape
por ^[
e CTRL-V CTRL-G
por ^G
.
Outras dicas
Isto é o que funcionou para mim:
" 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()
Fonte: https://gist.github.com/bignimbus/1da46a18416da4119778
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow