aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/news.txt5
-rw-r--r--runtime/doc/treesitter.txt2
-rw-r--r--runtime/lua/vim/treesitter.lua2
-rw-r--r--runtime/plugin/nvim.lua4
4 files changed, 11 insertions, 2 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 226444ccb5..0ffd335520 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -89,8 +89,9 @@ The following new APIs or features were added.
See |lsp-semantic_tokens| for more information.
-• |vim.treesitter.inspect_tree()| opens a split window showing a text
- representation of the nodes in a language tree for the current buffer.
+• |vim.treesitter.inspect_tree()| and |:InspectTree| opens a split window
+ showing a text representation of the nodes in a language tree for the current
+ buffer.
• Added support for the `willSave` and `willSaveWaitUntil` capabilities to the
LSP client. `willSaveWaitUntil` allows a server to modify a document before it
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index b75e879424..5ac24de70a 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -603,6 +603,8 @@ inspect_tree({opts}) *vim.treesitter.inspect_tree()*
to toggle the display of the source language of each node, and press
<Enter> to jump to the node under the cursor in the source buffer.
+ Can also be shown with `:InspectTree`. *:InspectTree*
+
Parameters: ~
• {opts} (table|nil) Optional options table with the following possible
keys:
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 412140b757..09e3814a17 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -424,6 +424,8 @@ end
--- display of the source language of each node, and press <Enter> to jump to the node under the
--- cursor in the source buffer.
---
+--- Can also be shown with `:InspectTree`. *:InspectTree*
+---
---@param opts table|nil Optional options table with the following possible keys:
--- - lang (string|nil): The language of the source buffer. If omitted, the
--- filetype of the source buffer is used.
diff --git a/runtime/plugin/nvim.lua b/runtime/plugin/nvim.lua
index 815886f896..762e9519db 100644
--- a/runtime/plugin/nvim.lua
+++ b/runtime/plugin/nvim.lua
@@ -5,3 +5,7 @@ vim.api.nvim_create_user_command('Inspect', function(cmd)
vim.show_pos()
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' })