akinsho / akinsho/toggleterm.nvim

[BUG] Navigating inside an already open and showing terminal does not enter insert mode

Offen
#455 5 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Lua
Sterne
5.6k
Forks
206
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

When a terminal is already open and showing and I navigate into another buffer split and go back to the terminal again, it does not enter inser mode. I have terminal_mapping and inser_mapping set to true. When opening the terminal with the mapping it works but once I navigate out and let it open, it does not enter insert automatically again.

I tried setting up a autocmd for TermEnter and BufEnter for term://* pattern but was not able to manage to do it.
Like so:

```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://*',
command = 'startinsert'
})
```

I am not sure if this should already work and is a configuration issue on my side or if the terminal_mapping only works for opening and closing the terminal by design.

### Expected Behavior

navigating out and inside to the terminal buffer should work as expected. when coming back to the terminal buffer, enter insert mode, like when opening it with mapping.

### Steps To Reproduce

setup toggleterm with the default config

### Environment

```Markdown
- OS: macOS 13.4.1 (22F82)
- neovim version: v0.9.1
- Shell: zsh 5.9 (x86_64-apple-darwin22.0)
```

### Anything else?

_No response_

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.