akinsho / akinsho/toggleterm.nvim

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

Abierto
#455 5 comentarios 4 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Lua
Estrellas
5.6k
Forks
206
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.