Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/config/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ vim.o.listchars = "extends:…,nbsp:␣,precedes:…,tab:> "

-- folding
vim.o.foldlevel = 10
vim.o.foldmethod = "indent"
vim.o.foldmethod = "expr"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore fallback folding for non-Tree-sitter filetypes

When a buffer has no Tree-sitter parser or vim.treesitter.start() fails, this global foldmethod=expr still leaves foldexpr as vim.treesitter.foldexpr(), which returns 0 without a parser, so those files have no folds at all. The repo only installs parsers for a limited set of languages in lua/config/treesitter.lua, and its FileType fallback only enables syntax on; it does not switch folding back from expr, so opening unsupported filetypes such as YAML/JSON or any parser install failure regresses from the previous indent-based folding to no usable folds.

Useful? React with 👍 / 👎.

vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.o.foldnestmax = 10
vim.o.foldtext = ""
Expand Down
Loading