mirror of https://github.com/folke/lazy.nvim.git
fix(cmd): properly deal with commands with nargs=? or nargs=1. Fixes #659
This commit is contained in:
parent
b4b11f48aa
commit
efe36bdfda
|
@ -29,6 +29,13 @@ function M:_add(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:_load(cmd)
|
self:_load(cmd)
|
||||||
|
|
||||||
|
local info = vim.api.nvim_get_commands({})[cmd]
|
||||||
|
command.nargs = info.nargs
|
||||||
|
if event.args and event.args ~= "" and info.nargs and info.nargs:find("[1?]") then
|
||||||
|
command.args = { event.args }
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd(command)
|
vim.cmd(command)
|
||||||
end, {
|
end, {
|
||||||
bang = true,
|
bang = true,
|
||||||
|
|
Loading…
Reference in New Issue