-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
return { | ||
{ | ||
'kevinhwang91/nvim-ufo', | ||
event = 'BufRead', | ||
dependencies = { | ||
'kevinhwang91/promise-async', | ||
{ | ||
'luukvbaal/statuscol.nvim', | ||
config = function() | ||
local builtin = require 'statuscol.builtin' | ||
require('statuscol').setup { | ||
relculright = true, | ||
segments = { | ||
{ text = { builtin.foldfunc }, click = 'v:lua.ScFa' }, | ||
{ text = { '%s' }, click = 'v:lua.ScSa' }, | ||
{ text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa' }, | ||
}, | ||
} | ||
end, | ||
}, | ||
}, | ||
config = function() | ||
-- default settings to enable | ||
vim.o.foldcolumn = '1' | ||
vim.o.foldlevel = 99 | ||
vim.o.foldlevelstart = 99 | ||
vim.o.foldenable = true | ||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] | ||
|
||
-- setup folding source: first lsp, then indent as fallback | ||
require('ufo').setup { | ||
provider_selector = function() | ||
return { 'treesitter', 'indent' } | ||
end, | ||
} | ||
|
||
-- remap keys for "fold all" and "unfold all" | ||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = 'Open all folds' }) | ||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = 'Close all folds' }) | ||
end, | ||
}, | ||
-- Folding preview, by default h and l keys are used. | ||
-- On first press of h key, when cursor is on a closed fold, the preview will be shown. | ||
-- On second press the preview will be closed and fold will be opened. | ||
-- When preview is opened, the l key will close it and open fold. In all other cases these keys will work as usual. | ||
{ 'anuvyklack/fold-preview.nvim', dependencies = 'anuvyklack/keymap-amend.nvim', config = true }, | ||
} |