.dotfiles/nvim/lua/folding.lua

17 lines
622 B
Lua

require('fold-cycle').setup({
open_if_closed = true,
close_if_opened = true,
softwrap_movement_fix = true,
})
vim.keymap.set('n', '<tab>',
function() return require('fold-cycle').open() end,
{silent = true, desc = 'Fold-cycle: open folds'})
vim.keymap.set('n', '<s-tab>',
function() return require('fold-cycle').close() end,
{silent = true, desc = 'Fold-cycle: close folds'})
vim.keymap.set('n', 'zC',
function() return require('fold-cycle').close_all() end,
{remap = true, silent = true, desc = 'Fold-cycle: close all folds'})
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"