diff options
| author | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-04-25 10:38:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-25 10:38:20 +0200 |
| commit | bae9f329521f98a3d841e056a4ad701bd782a9a5 (patch) | |
| tree | 8ded4449cfabc5f318fd62318ec37eaabc749b5e /lua/nvim-treesitter/utils.lua | |
| parent | 2a4fece2b65929299e63d86c4fac09e79b4bdcee (diff) | |
| parent | 62786ec7c60ea29cbbd48ae658cde7042dba4bb3 (diff) | |
Merge pull request #18 from kyazdani42/improve-configs
feat/refacto: add user interactions, improve configurations
Diffstat (limited to 'lua/nvim-treesitter/utils.lua')
| -rw-r--r-- | lua/nvim-treesitter/utils.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/utils.lua b/lua/nvim-treesitter/utils.lua index 8313a46a..59de5dd5 100644 --- a/lua/nvim-treesitter/utils.lua +++ b/lua/nvim-treesitter/utils.lua @@ -63,4 +63,17 @@ function M.is_parent(dest, source) return false end +function M.setup_commands(mod, commands) + for command_name, def in pairs(commands) do + local call_fn = string.format("lua require'nvim-treesitter.%s'.commands.%s.run(<f-args>)", mod, command_name) + local parts = vim.tbl_flatten({ + "command!", + def.args, + command_name, + call_fn, + }) + api.nvim_command(table.concat(parts, " ")) + end +end + return M |
