nixos/home/common/core/nixvim/plugins/fold.nix

32 lines
800 B
Nix
Raw Permalink Normal View History

2024-07-07 16:23:05 +01:00
{
2024-07-07 16:24:50 +01:00
programs.nixvim.plugins.nvim-ufo = {
2024-07-07 16:23:05 +01:00
enable = true;
};
programs.nixvim.extraConfigLua = ''
-- default fold options
2024-07-07 16:23:05 +01:00
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- nvim_ufo options
2024-07-07 16:23:05 +01:00
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', 'zK', function()
2024-07-07 16:23:05 +01:00
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
})
'';
}