akinsho / akinsho/toggleterm.nvim

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

Đang mở
#621 6 bình luận 9 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Lua
Star
5.6k
Fork
206
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.