fix(nvim_create_user_command): make smods work with nvim_cmd

Closes #18876.
This commit is contained in:
Famiu Haque
2022-06-08 09:06:36 +06:00
parent 3cd22a3485
commit c84bd9e21f
3 changed files with 30 additions and 15 deletions

View File

@@ -136,7 +136,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 0,
@@ -170,7 +170,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 0,
@@ -204,7 +204,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 0,
@@ -238,7 +238,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "botright",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 1,
@@ -272,7 +272,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 1,
@@ -306,7 +306,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 0,
@@ -352,7 +352,7 @@ describe('nvim_create_user_command', function()
silent = false,
split = "",
tab = 0,
verbose = 0,
verbose = -1,
vertical = false,
},
range = 0,
@@ -418,6 +418,16 @@ describe('nvim_create_user_command', function()
vim.api.nvim_create_user_command('💩', 'echo "hi"', {})
]]))
end)
it('smods can be used with nvim_cmd', function()
exec_lua[[
vim.api.nvim_create_user_command('MyEcho', function(opts)
vim.api.nvim_cmd({ cmd = 'echo', args = { '&verbose' }, mods = opts.smods }, {})
end, {})
]]
eq("3", meths.cmd({ cmd = 'MyEcho', mods = { verbose = 3 } }, { output = true }))
end)
end)
describe('nvim_del_user_command', function()