[BUG] ClaudeCodeSend leaves source buffer in insert mode (snacks provider, focus_after_send off)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 50/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- vim
- Área
- devtools
Línea de trabajo
Start with send_at_mention in init.lua, which calls terminal.ensure_visible() after a successful send, then follow the fallback to ensure_terminal_visible_no_focus in terminal.lua for the snacks provider. Check whether the snacks buffer-local auto_insert BufEnter autocmd leaves a pending startinsert after the terminal is shown without focus. Done means the source window stays in its current mode after :ClaudeCodeSend when focus_after_send is off, with no change to focus-on behaviour.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
With the snacks provider and focus_after_send off (the default), sending a visual selection with :ClaudeCodeSend leaves the source buffer in insert mode. Focus is correctly kept on the source window, but Neovim is in insert mode there, so the next keystrokes are typed into the buffer.
To reproduce
- Use the snacks terminal provider with default
terminal.auto_insertandfocus_after_send = false. - Start Claude, then hide the terminal.
- In a normal file, select text in visual mode and run
:ClaudeCodeSend(mapped as<cmd>ClaudeCodeSend<cr>in visual mode). - The terminal is shown again and focus returns to the source window, which is now in insert mode.
Expected
Focus and mode of the source window are unchanged when focus_after_send is off.
Likely cause (not fully verified)
init.lua send_at_mention calls terminal.ensure_visible() after a successful send. The snacks provider has no ensure_visible, so terminal.lua falls back to ensure_terminal_visible_no_focus, which opens or shows the terminal. Entering the terminal buffer appears to trigger snacks' buffer-local auto_insert BufEnter autocmd, which runs startinsert. Focus then moves back to the source window, but the pending insert carries over. I did not trace which exact call triggers it.
Workaround
A User ClaudeCodeSendComplete autocmd that cancels the insert:
vim.api.nvim_create_autocmd("User", {
pattern = "ClaudeCodeSendComplete",
callback = function()
local function fix()
if vim.bo.buftype ~= "terminal" then
vim.cmd("stopinsert")
end
end
fix()
vim.schedule(fix)
end,
})
Setting terminal.auto_insert = false also avoids it, but then focusing Claude no longer enters insert mode.
Suggested fix
When ensure_visible opens or shows the terminal without focus, do not leave a pending startinsert. For example, run the show with snacks auto_insert/start_insert disabled, or call stopinsert when the current window is not the terminal after showing it.
Related
#145 and #232 cover focusing the terminal. This one is about the unfocused path.
- Lenguaje dominante
- Lua
- Estrellas
- 3.1k
- Forks
- 223
- Merge medio
- 6 h 47 min
- PR fusionados (30 d)
- 93
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de coder/claudecode.nvim
-
[BUG] ClaudeCodeAdd fails on paths with spacesPosiblemente ocupada @7A1T la tomó hace 80 días. Abiertobug needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
coder/claudecode.nvim#314 ·
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
coder/claudecode.nvim#313 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
coder/claudecode.nvim#434 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
coder/claudecode.nvim#433 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
coder/claudecode.nvim#309 ·
Los mantenedores suelen responder en 1 día
Todos los issues de coder/claudecode.nvim
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
rohit746/pdf-view.nvim#107 ·
Los mantenedores suelen responder en 1 día
-
bug guide
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
enhancement forever
Dificultad 2/5 1-3 horas Aptitud para principiantes 61/100
openmap-world/openmap#78 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AndyHazz/bookends.koplugin#130 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
carlos-algms/agentic.nvim#336 ·