mirror of
https://github.com/Derisis13/dotfiles.git
synced 2026-02-01 07:44:50 +01:00
fix(nvim): elegant fold configuration
This commit is contained in:
@@ -6,8 +6,27 @@ 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()
|
||||||
|
|
||||||
|
-- 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
|
-- Hyrplang filetype
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
|
|||||||
Reference in New Issue
Block a user