Did you check docs and existing issues?
Neovim version (nvim -v)
v0.12.5
Operating system/version
MacOS 26.5.2
Describe the bug
During beta testing of https://github.com/nvim-mini/mini.statuscolumn I found that when closing Lazygit, terminal and presumably other windows created through Snacks.win() with auto_close set to true causes the TermClose auto command being registered to eat other auto commands.
In case of mini.statuscolumn, it fails to reset the dimming when a buffer regains focus.
Echasnovski was able to reproduce it and pin-point it to a missing nested option in the registration of the TermClose auto command:
He found that by adding nested = true to the options when registering the auto command the issue resolved. I was able to replicate that when creating the repro.lua for this report.
I can imagine that adding nested = true to the auto command could have some weird consequences for user configurations, so I would imagine the fix for this to be allowing auto_close to be of type boolean|table.
Not setting auto_close or a boolean would retain its current behaviour. Setting it to a table could pass it to the auto command as options, or perhaps a property on the table could be passed (e.g. auto_close.opts). I'm not sure how you envision this could be done.
See nvim-mini/mini.nvim#2542 (comment) and nvim-mini/mini.nvim#2542 (comment) for details.
Steps To Reproduce
Given mapleader = " "
In repro.lua I added 4 keymaps for reproduction:
<leader>g1: Standard Lazygit opening through Snacks
<leader>g2: Lazygit opening with auto_close set to false, manual TermClose auto command registration
<leader>g3: Lazygit opening with auto_close set to false, manual TermClose auto command registration and nested set to true in options
<leader>t: Standard Lazygit terminal opening
- Create a new, empty, local git repo
- Create a file in it, any empty file will do
- Open the file using the repro.lua provided
- Note that the status column is properly lit up
- Press
<leader>g1, then q
- The status column is dimmed
:restart
- Press
<leader>g2, then q
- The status column is dimmed
:restart
- Press
<leader>g3, then q
- The status column regains its highlights
:restart
- Press
<leader>t, then <c-d>
- The status column is dimmed
Expected Behavior
When using the default Snacks.lazygit.open call, the status column should retain its highlight when a terminal is closed.
Repro
vim.g.mapleader = " "
vim.o.signcolumn = "yes"
vim.o.cursorline = true
vim.o.number = true
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{
"folke/snacks.nvim",
opts = {},
keys = {
{
"<leader>g1",
function()
require("snacks").lazygit.open()
end,
},
{
"<leader>g2",
function()
local terminal = require("snacks").lazygit.open({
auto_close = false,
})
terminal:on("TermClose", function()
terminal:close()
vim.cmd.checktime()
end, { buf = true })
end,
},
{
"<leader>g3",
function()
local terminal = require("snacks").lazygit.open({
auto_close = false,
})
terminal:on("TermClose", function()
terminal:close()
vim.cmd.checktime()
end, { buf = true, nested = true })
end,
},
{
"<leader>t",
function()
require("snacks").terminal.open()
end,
},
},
},
{ "nvim-mini/mini.statuscolumn", opts = {} },
},
})
Did you check docs and existing issues?
Neovim version (nvim -v)
v0.12.5
Operating system/version
MacOS 26.5.2
Describe the bug
During beta testing of https://github.com/nvim-mini/mini.statuscolumn I found that when closing Lazygit, terminal and presumably other windows created through
Snacks.win()withauto_closeset to true causes theTermCloseauto command being registered to eat other auto commands.In case of
mini.statuscolumn, it fails to reset the dimming when a buffer regains focus.Echasnovski was able to reproduce it and pin-point it to a missing
nestedoption in the registration of theTermCloseauto command:snacks.nvim/lua/snacks/terminal.lua
Line 146 in 882c996
He found that by adding
nested = trueto the options when registering the auto command the issue resolved. I was able to replicate that when creating the repro.lua for this report.I can imagine that adding
nested = trueto the auto command could have some weird consequences for user configurations, so I would imagine the fix for this to be allowingauto_closeto be of typeboolean|table.Not setting
auto_closeor a boolean would retain its current behaviour. Setting it to a table could pass it to the auto command as options, or perhaps a property on the table could be passed (e.g.auto_close.opts). I'm not sure how you envision this could be done.See nvim-mini/mini.nvim#2542 (comment) and nvim-mini/mini.nvim#2542 (comment) for details.
Steps To Reproduce
Given
mapleader = " "In
repro.luaI added 4 keymaps for reproduction:<leader>g1: Standard Lazygit opening through Snacks<leader>g2: Lazygit opening withauto_closeset tofalse, manualTermCloseauto command registration<leader>g3: Lazygit opening withauto_closeset tofalse, manualTermCloseauto command registration andnestedset to true in options<leader>t: Standard Lazygit terminal opening<leader>g1, thenq:restart<leader>g2, thenq:restart<leader>g3, thenq:restart<leader>t, then<c-d>Expected Behavior
When using the default
Snacks.lazygit.opencall, the status column should retain its highlight when a terminal is closed.Repro