commit a94a2927d00a80e5e00a4f358db581c7d2a7e525
parent 092529ebbf6fe566399aa47c274d708b8dea5334
Author: Maria José Solano <majosolano99@gmail.com>
Date: Tue, 11 Mar 2025 21:54:25 -0700
feat(treesitter): allow passing lang to InspectTree
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
@@ -9,17 +9,17 @@ do
end, { desc = 'Inspect highlights and extmarks at the cursor', bang = true })
vim.api.nvim_create_user_command('InspectTree', function(cmd)
+ local opts = { lang = cmd.fargs[1] }
+
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()
+ opts.command = ('%s %s%s'):format(cmd.mods, count, new)
end
- end, { desc = 'Inspect treesitter language tree for buffer', count = true })
+
+ vim.treesitter.inspect_tree(opts)
+ end, { desc = 'Inspect treesitter language tree for buffer', count = true, nargs = '?' })
vim.api.nvim_create_user_command('EditQuery', function(cmd)
vim.treesitter.query.edit(cmd.fargs[1])