3

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?

statox
  • 49,782
  • 19
  • 148
  • 225
tracyone
  • 345
  • 1
  • 6
  • What is terminal enter? – Herb Sep 03 '17 at 04: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 03 '17 at 04:21
  • Why do you need this? Isn't a BufEnter/WinEnter autocommand enough? – Christian Brabandt Sep 03 '17 at 19:49
  • autocmd WinEnter or BufEnter not work – tracyone Sep 04 '17 at 02:40
  • @tracyone cannot reproduce. BufEnter autocommands are triggered when entering the terminal. so works as expected – Christian Brabandt Sep 04 '17 at 06:35
  • 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 05 '17 at 05: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 05 '17 at 05:31

0 Answers0