Skip to content

Commit

Permalink
feat(options): enabled treesitter folding and foldtext when available
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 3, 2023
1 parent 450e0c6 commit 19926d2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/lazyvim/config/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,17 @@ if vim.fn.has("nvim-0.10") == 1 then
opt.smoothscroll = true
end

-- Folding
vim.opt.foldlevel = 99
if vim.treesitter.foldexpr then
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
else
vim.opt.foldmethod = "indent"
end
if vim.treesitter.foldtext then
vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
end

-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0

0 comments on commit 19926d2

Please sign in to comment.