[BUG] Entering an existing terminal buffer does not trigger TermEnter event
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
Entering an already open terminal buffer does not trigger the TermEnter event. This leads to the issue, that my autocmd for TermEnter does not switch to insert mode when entering the terminal. TermEnter is now triggered after insert mode is activated in the terminal. Version 2.12.0 does not have this issue and works as expected.
Expected Behavior
TermEnter event should be triggered when the cursor enters the buffer, not only when in insert mode in terminal.
Steps To Reproduce
Use this autocmd and see if it gets triggered when entering the terminal buffer:
-- Auto insert mode when entering terminal
local augroup_term_insert = vim.api.nvim_create_augroup("Term-Insert", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter", "WinEnter", "TermOpen", "TermEnter" }, {
group = augroup_term_insert,
pattern = 'term://*',
callback = function(ev)
print("Auto-command triggered")
vim.cmd('startinsert')
end
})
Insert mode is only entered when the terminal is opened the fist time. Navigating out of the terminal buffer and navigating back should trigger the TermEnter event but does not. 2.12.0 does not have this issue
Environment
- OS:
- neovim version:
- Shell:
Anything else?
No response