foldexpr=nvim_treesitter#foldexpr() is unstable and buggy. I spotted a problem with treesitter folding: the foldings are not updated after I changed the file, and I have to :e for the folding structure to reload.
Occasionally the treesitter fold closes the region where I have just editted (in python etc.)
I use kevinhwang91/nvim-ufo for more reliable folding. It can utilize treesitter (or LSP) as its
backend, and work with the default foldexpr=manual. More customization is also available, such as getting a foldcolumn like VSCode.
foldexpr=nvim_treesitter#foldexpr()
is unstable and buggy. I spotted a problem with treesitter folding: the foldings are not updated after I changed the file, and I have to:e
for the folding structure to reload.Occasionally the treesitter fold closes the region where I have just editted (in python etc.)
I use
kevinhwang91/nvim-ufo
for more reliable folding. It can utilize treesitter (or LSP) as its backend, and work with the defaultfoldexpr=manual
. More customization is also available, such as getting a foldcolumn like VSCode.