akinsho / akinsho/toggleterm.nvim

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

オープン
#621 コメント 6 件 リアクション 9 件 担当者 0 名 GitHub で見る
主要言語
Lua
スター
5.6k
フォーク
206
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。