Skip to content

Commit efe36bd

Browse files
committedMar 16, 2023
fix(cmd): properly deal with commands with nargs=? or nargs=1. Fixes #659
1 parent b4b11f4 commit efe36bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎lua/lazy/core/handler/cmd.lua

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ function M:_add(cmd)
2929
end
3030

3131
self:_load(cmd)
32+
33+
local info = vim.api.nvim_get_commands({})[cmd]
34+
command.nargs = info.nargs
35+
if event.args and event.args ~= "" and info.nargs and info.nargs:find("[1?]") then
36+
command.args = { event.args }
37+
end
38+
3239
vim.cmd(command)
3340
end, {
3441
bang = true,

0 commit comments

Comments
 (0)
Please sign in to comment.