mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -04:00
Added extra argument to setup commands so that user can change the function args types
This commit is contained in:
parent
a13b40248a
commit
763e0e43f7
1 changed files with 4 additions and 2 deletions
|
|
@ -12,10 +12,12 @@ end
|
||||||
|
|
||||||
function M.setup_commands(mod, commands)
|
function M.setup_commands(mod, commands)
|
||||||
for command_name, def in pairs(commands) do
|
for command_name, def in pairs(commands) do
|
||||||
|
local f_args = def.f_args or '<f-args>'
|
||||||
local call_fn = string.format(
|
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,
|
mod,
|
||||||
command_name
|
command_name,
|
||||||
|
f_args
|
||||||
)
|
)
|
||||||
local parts = vim.tbl_flatten {
|
local parts = vim.tbl_flatten {
|
||||||
"command!",
|
"command!",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue