Nvim: add ufo fold plugin

main
Marko Korhonen 8 months ago
parent bf072046bf
commit af6c34baaa
No known key found for this signature in database
GPG Key ID: A7F78BCB859CD890

@ -212,6 +212,13 @@ local plugins = {
config = require("plugins.dashboard"),
dependencies = { { "kyazdani42/nvim-web-devicons" } },
},
-- Better folds
{
"kevinhwang91/nvim-ufo",
dependencies = { "kevinhwang91/promise-async" },
config = require("plugins.ufo"),
},
}
local lazy_opts = {}

@ -12,6 +12,13 @@ function m.setup()
-- Inform lsp about completion capabilities from cmp
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
-- for ufo
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
require("mason").setup()
local mason_lsp = require("mason-lspconfig")
mason_lsp.setup()

@ -0,0 +1,7 @@
return function()
require("ufo").setup({
close_fold_kinds = {
"imports",
},
})
end

@ -17,4 +17,8 @@ return function()
-- Exit terminal insert mode with esc
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", {})
-- Using ufo, need to remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
end

@ -49,10 +49,16 @@ o.shiftwidth = 4
o.smartindent = true
-- Firenvim settings
vim.g.firenvim_config = {
g.firenvim_config = {
localSettings = {
[".*"] = {
takeOver = "never",
},
},
}
-- Fold settings (for ufo)
o.foldcolumn = "1"
o.foldlevel = 99
o.foldlevelstart = 99
o.foldenable = true

Loading…
Cancel
Save