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 TournoijSep 03 '17 at 04:21
@tracyone cannot reproduce. BufEnter autocommands are triggered when entering the terminal. so works as expected
– Christian BrabandtSep 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.
– tracyoneSep 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 BrabandtSep 05 '17 at 05:31
:help terminal.txtnotes:WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE. That being said, you could maybe useBufEnterorWinEnterand checkbuftype? – Martin Tournoij Sep 03 '17 at 04:21