aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/treesitter.lua3
-rw-r--r--runtime/lua/vim/treesitter/dev.lua5
2 files changed, 6 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 88b68ff658..2aa46ceebd 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -461,7 +461,8 @@ end
---
--- While in the window, press "a" to toggle display of anonymous nodes, "I" to toggle the
--- display of the source language of each node, "o" to toggle the query editor, and press
---- <Enter> to jump to the node under the cursor in the source buffer.
+--- <Enter> to jump to the node under the cursor in the source buffer. Folding also works
+--- (try |zo|, |zc|, etc.).
---
--- Can also be shown with `:InspectTree`. *:InspectTree*
---
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index 551067533a..4c8f6e466f 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -159,7 +159,10 @@ end
local function set_dev_properties(w, b)
vim.wo[w].scrolloff = 5
vim.wo[w].wrap = false
- vim.wo[w].foldmethod = 'manual' -- disable folding
+ vim.wo[w].foldmethod = 'expr'
+ vim.wo[w].foldexpr = 'v:lua.vim.treesitter.foldexpr()' -- explicitly set foldexpr
+ vim.wo[w].foldenable = false -- Don't fold on first open InspectTree
+ vim.wo[w].foldlevel = 99
vim.bo[b].buflisted = false
vim.bo[b].buftype = 'nofile'
vim.bo[b].bufhidden = 'wipe'