mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 21:06:46 +00:00
fix(cmd): properly deal with commands with nargs=? or nargs=1. Fixes #659
This commit is contained in:
parent
b4b11f48aa
commit
efe36bdfda
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue