akinsho / akinsho/toggleterm.nvim

[BUG] Entering an existing terminal buffer does not trigger TermEnter event

Aperta
#621 6 commenti 9 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Lua
Stelle
5.6k
Fork
206
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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:

```lua
-- 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

```Markdown
- OS:
- neovim version:
- Shell:
```

### Anything else?

_No response_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.