Come posso ottenere il file che ho aperto in vim per visualizzare nella mia scheda iTerm

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

  •  21-09-2019
  •  | 
  •  

Domanda

Posso ottenere il titolo vim per visualizzare sulla mia finestra in questo modo:

let &titlestring = expand("%:t") . " @ " . hostname()
if &term == "screen"
  set t_ts=^[k
  set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
  set title
endif

Ma le linguette diranno "Default".

Dalla linea di comando posso fare questo:

echo -ne "\e]1;hello world\a"

E questo lo mostrerò "Ciao Mondo" nelle mie schede.

C'è un modo per avere vim scrivere questa roba alla mia scheda, invece di titolo, invece?

È stato utile?

Soluzione

Non ho iTerm, quindi non posso provare questo, ma prova ad aggiungere questo a vostro .vimrc :

set t_ts=^[]1;
set t_fs=^G

Tipo CTRL-V Escape per ^[ e CTRL-V CTRL-G per ^G.

Altri suggerimenti

Questo è ciò che ha funzionato per me:

" 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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top