Skip to content

Commit

Permalink
fix(cmd): properly deal with commands with nargs=? or nargs=1. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 16, 2023
1 parent b4b11f4 commit efe36bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/lazy/core/handler/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ function M:_add(cmd)
end

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)
end, {
bang = true,
Expand Down

0 comments on commit efe36bd

Please sign in to comment.