diff options
Diffstat (limited to 'runtime/plugin/nvim.lua')
-rw-r--r-- | runtime/plugin/nvim.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/runtime/plugin/nvim.lua b/runtime/plugin/nvim.lua index e4b099f7ad..0a33826b82 100644 --- a/runtime/plugin/nvim.lua +++ b/runtime/plugin/nvim.lua @@ -6,6 +6,15 @@ vim.api.nvim_create_user_command('Inspect', function(cmd) end end, { desc = 'Inspect highlights and extmarks at the cursor', bang = true }) -vim.api.nvim_create_user_command('InspectTree', function() - vim.treesitter.inspect_tree() -end, { desc = 'Inspect treesitter language tree for buffer' }) +vim.api.nvim_create_user_command('InspectTree', function(cmd) + if cmd.mods ~= '' or cmd.count ~= 0 then + local count = cmd.count ~= 0 and cmd.count or '' + local new = cmd.mods ~= '' and 'new' or 'vnew' + + vim.treesitter.inspect_tree({ + command = ('%s %s%s'):format(cmd.mods, count, new), + }) + else + vim.treesitter.inspect_tree() + end +end, { desc = 'Inspect treesitter language tree for buffer', count = true }) |