aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/dev.lua
diff options
context:
space:
mode:
author再生花 <hoangtun0810@gmail.com>2024-02-23 05:58:59 +0900
committerGitHub <noreply@github.com>2024-02-22 14:58:59 -0600
commitbb15fa035610bb9765ca16900703804a88faa3bb (patch)
treec3531fb1162c8fadf2aaecb6f308fdd24f92ba0c /runtime/lua/vim/treesitter/dev.lua
parent85cb0b0ddc59cd1b3a911e5b4a358e5404c1d0d8 (diff)
downloadrneovim-bb15fa035610bb9765ca16900703804a88faa3bb.tar.gz
rneovim-bb15fa035610bb9765ca16900703804a88faa3bb.tar.bz2
rneovim-bb15fa035610bb9765ca16900703804a88faa3bb.zip
feat(treesitter): add folding for `InspectTree` (#27518)
As the InspectTree buffer is now a valid tree-sitter query tree, we can use the bundled fold queries to have folding for the tree.
Diffstat (limited to 'runtime/lua/vim/treesitter/dev.lua')
-rw-r--r--runtime/lua/vim/treesitter/dev.lua5
1 files changed, 4 insertions, 1 deletions
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'