Add nvim-ufo for fancier folding

This commit is contained in:
2023-12-01 15:26:02 -05:00
parent c2e6c41cd4
commit 7543e338db
3 changed files with 36 additions and 2 deletions

33
lua/plugins/folding.lua Normal file
View File

@@ -0,0 +1,33 @@
return {
-- add folding range to capabilities
{
"neovim/nvim-lspconfig",
opts = {
capabilities = {
textDocument = {
foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
},
},
},
},
},
-- add nvim-ufo
{
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
event = "BufReadPost",
opts = {},
init = function()
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
vim.keymap.set("n", "zR", function()
require("ufo").openAllFolds()
end)
vim.keymap.set("n", "zM", function()
require("ufo").closeAllFolds()
end)
end,
},
}