Nvim: add ufo fold plugin
This commit is contained in:
parent
bf072046bf
commit
af6c34baaa
|
@ -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()
|
||||
|
|
7
home/.config/nvim/lua/plugins/ufo.lua
Normal file
7
home/.config/nvim/lua/plugins/ufo.lua
Normal file
|
@ -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…
Reference in a new issue