fix(defaults): auto-close terminal for &shell with args (#28276)

Problem:
The `:terminal` auto-close logic does not support `&shell` that has
arguments, e.g., `/bin/bash -O globstar`.

Solution:
Join `argv` and match `&shell`. This is not perfect since `&shell` may
contain irregular spaces and quotes, but it seems to be good enough.
This commit is contained in:
Jaehwang Jung 2024-04-13 20:41:59 +09:00 committed by GitHub
parent 5ce6b4a294
commit 328a237351
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,7 +175,7 @@ do
end
local info = vim.api.nvim_get_chan_info(vim.bo[args.buf].channel)
local argv = info.argv or {}
if #argv == 1 and argv[1] == vim.o.shell then
if table.concat(argv, ' ') == vim.o.shell then
vim.api.nvim_buf_delete(args.buf, { force = true })
end
end,