akinsho / akinsho/toggleterm.nvim

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

Ouverte
#455 5 commentaires 4 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Lua
Étoiles
5.6k
Forks
206
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.