diff --git a/home/common/core/nixvim/plugins/default.nix b/home/common/core/nixvim/plugins/default.nix index 2cde41e..53c5e8a 100644 --- a/home/common/core/nixvim/plugins/default.nix +++ b/home/common/core/nixvim/plugins/default.nix @@ -14,6 +14,7 @@ ./telescope.nix ./treesitter.nix ./alpha.nix + ./fold.nix ]; # Load Plugins that aren't provided as modules by nixvim diff --git a/home/common/core/nixvim/plugins/fold.nix b/home/common/core/nixvim/plugins/fold.nix new file mode 100644 index 0000000..c122c00 --- /dev/null +++ b/home/common/core/nixvim/plugins/fold.nix @@ -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 + }) + + ''; +} +