setup ufo for code folding

This commit is contained in:
lobneroO 2024-01-21 08:51:02 +01:00
parent 8baa1144ab
commit ebf58a549f
1 changed files with 17 additions and 18 deletions

View File

@ -4,24 +4,23 @@ return {
"kevinhwang91/nvim-ufo", "kevinhwang91/nvim-ufo",
event = "BufRead", event = "BufRead",
dependencies = { "kevinhwang91/promise-async" }, dependencies = { "kevinhwang91/promise-async" },
config = function() config = function()
-- setup folding source: first lsp, then indent as fallback -- default settings to enable
require("ufo").setup({ vim.o.foldcolumn = "1"
provider_selector = function(bufnr, filetype, buftype) vim.o.foldlevel = 99
return { 'lsp', 'indent' } vim.o.foldlevelstart = 99
end vim.o.foldenable = true
})
-- setup folding source: first lsp, then indent as fallback
-- default settings to enable require("ufo").setup({
vim.o.foldcolumn = '1' provider_selector = function(bufnr, filetype, buftype)
vim.o.foldlevel = 99 return { 'lsp', 'indent' }
vim.o.foldlevelstart = 99 end
vim.o.foldenable = true })
-- remap keys for "fold all" and "unfold all" -- remap keys for "fold all" and "unfold all"
vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = "Open all folds" }) vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = "Open all folds" })
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = "Close all folds" }) vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = "Close all folds" })
end,
end
} }