Vim8 now has a terminal feature, how can I detect when a terminal is started?

Neovim has TermOpen and TermClose autocommand events, does vim8 has an equivalent?

  • What is terminal enter? – Herb Wolfe Sep 3 '17 at 4:21
  • 4
    I don't think you can (yet). Remember that terminal support in Vim is highly experimental at the moment; as :help terminal.txt notes: WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE. That being said, you could maybe use BufEnter or WinEnter and check buftype? – Martin Tournoij Sep 3 '17 at 4:21
  • Why do you need this? Isn't a BufEnter/WinEnter autocommand enough? – Christian Brabandt Sep 3 '17 at 19:49
  • 1
    @ChristianBrabandt hi, autocmd BufEnter * if &buftype=="terminal" | echom "Enter terminal" | endif, It is not work at the first time create a new terminal buffer. – tracyone Sep 5 '17 at 5:17
  • 1
    true. That is a bug I also noticed. That is a bug, that should probably be reported to vim-dev and will be fixed hint note, you could currently test for bufname starting with '!' or so. However, it does not mean, that BufEnter autocommand does not work. – Christian Brabandt Sep 5 '17 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.