feat: fix q on close last window (#31)

* fix(plugin): allow command chaining with bar separator

Problem: :Pending|only failed because the command definition lacked the
bar attribute, causing | to be consumed as an argument.

Solution: Add bar = true to nvim_create_user_command so | is treated as
a command separator, matching fugitive's :Git behavior.

* fix: last window
This commit is contained in:
Barrett Ruth 2026-02-25 13:45:42 -05:00 committed by GitHub
parent 379e281ecd
commit b76c680e1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,7 +42,14 @@ function M.clear_winid()
end
function M.close()
if task_winid and vim.api.nvim_win_is_valid(task_winid) then
if not task_winid or not vim.api.nvim_win_is_valid(task_winid) then
task_winid = nil
return
end
local wins = vim.api.nvim_list_wins()
if #wins == 1 then
vim.cmd.enew()
else
vim.api.nvim_win_close(task_winid, false)
end
task_winid = nil