diff options
| author | badhi <bmadhikarinayake@gmail.com> | 2022-01-05 19:08:51 +0530 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-02-13 10:39:55 +0100 |
| commit | 763e0e43f784332b0cd2918ead4efe547aeea843 (patch) | |
| tree | 79ccad96c86eeea2fd4de58e98b153216bae1455 /lua | |
| parent | a13b40248a1f467dd7794b2860492fe23fdad098 (diff) | |
Added extra argument to setup commands so that user can change the function args types
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/utils.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lua/nvim-treesitter/utils.lua b/lua/nvim-treesitter/utils.lua index b828d28a..235ec457 100644 --- a/lua/nvim-treesitter/utils.lua +++ b/lua/nvim-treesitter/utils.lua @@ -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!", |
