كيف يمكنني الحصول على الملف الذي فتحته في 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 يكتب هذه الأشياء إلى علامة التبويب الخاصة بي بدلاً من العنوان بدلاً من ذلك؟

هل كانت مفيدة؟

المحلول

ليس لدي أيها ، لذلك لا يمكنني اختبار هذا ، لكن حاول إضافة هذا إلى لك .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