fix(nvim): elegant fold configuration

This commit is contained in:
László Párkányi
2026-01-06 15:09:17 +01:00
parent 31c2f6a869
commit 90aa0c5868

View File

@@ -6,10 +6,29 @@ local autocmd = vim.api.nvim_create_autocmd
-- command = "tabdo wincmd =", -- command = "tabdo wincmd =",
-- }) -- })
-- Auto unfold all when entering a buffer autocmd({ "FileType" }, {
-- autocmd("BufWinEnter", { pattern = "*", command = "silent! :%foldopen!" }) callback = function()
-- Hyrplang filetype -- check if treesitter has parser
if require("nvim-treesitter.parsers").has_parser() then
-- use treesitter folding
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
-- use alternative foldmethod
vim.opt.foldmethod = "syntax"
end
end,
})
-- disable folding on startup
vim.opt.foldenable = false
-- disable folding on loading
vim.opt.foldlevel = 20
-- Hyrplang filetype
vim.filetype.add({ vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
}) })