perf(nvim): improve startup speed of neovim when treesitter fold missing
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 41s

This commit is contained in:
Price Hiller 2024-11-20 12:07:09 -06:00
parent 6d207e98c7
commit 201624c51a
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -71,15 +71,20 @@ M.setup = function()
opt.undofile = true
-- Better folding
opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
opt.foldmethod = "expr"
vim.api.nvim_create_autocmd("FileType", {
callback = function()
if not (pcall(vim.treesitter.start)) then
return
end
vim.opt_local.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt_local.foldmethod = "expr"
end,
})
opt.fillchars = { eob = " ", fold = " ", foldopen = "", foldsep = " ", foldclose = "" }
vim.o.foldcolumn = "1"
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
vim.wo.foldmethod = "expr"
-- Concealment for nicer rendering
opt.conceallevel = 2