nvim_ufo fold plugin

This commit is contained in:
Sam 2024-07-07 16:23:05 +01:00
parent 653901f823
commit aa8d4ca3ae
2 changed files with 32 additions and 0 deletions

View File

@ -14,6 +14,7 @@
./telescope.nix
./treesitter.nix
./alpha.nix
./fold.nix
];
# Load Plugins that aren't provided as modules by nixvim

View File

@ -0,0 +1,31 @@
{
programs.nixvim.plugins.nvim_ufo = {
enable = true;
};
programs.nixvim.extraConfigLua = ''
# default fold options
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
# nvim_ufo options
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', function()
local winid = require("ufo").peekFoldedLinesUnderCursor()
if not winid then
vim.lsp.buf.hover()
end
end , { desc = "Peed fold" })
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
return { 'lsp', 'indent' }
end
})
'';
}