Added extra argument to setup commands so that user can change the function args types

This commit is contained in:
badhi 2022-01-05 19:08:51 +05:30 committed by Stephan Seitz
parent a13b40248a
commit 763e0e43f7

View file

@ -12,10 +12,12 @@ end
function M.setup_commands(mod, commands)
for command_name, def in pairs(commands) do
local f_args = def.f_args or '<f-args>'
local call_fn = string.format(
"lua require'nvim-treesitter.%s'.commands.%s['run<bang>'](<f-args>)",
"lua require'nvim-treesitter.%s'.commands.%s['run<bang>'](%s)",
mod,
command_name
command_name,
f_args
)
local parts = vim.tbl_flatten {
"command!",