configure folding
This commit is contained in:
43
lua/crentist/lazy/ufo.lua
Normal file
43
lua/crentist/lazy/ufo.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
'kevinhwang91/nvim-ufo',
|
||||
event = 'BufReadPost',
|
||||
dependencies = {
|
||||
'kevinhwang91/promise-async',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
{
|
||||
'luukvbaal/statuscol.nvim',
|
||||
config = function()
|
||||
local builtin = require('statuscol.builtin')
|
||||
require('statuscol').setup({
|
||||
relculright = true,
|
||||
segments = {
|
||||
{ text = { builtin.foldfunc }, sign = { colwidth = 2 }, click = 'v:lua.ScFa', },
|
||||
{ text = { '%s' }, click = 'v:lua.ScSa', },
|
||||
{ text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa', hl = 'FoldColumn' },
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
},
|
||||
init = function()
|
||||
vim.opt.foldenable = true
|
||||
vim.opt.foldcolumn = '1'
|
||||
vim.opt.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.fillchars = 'eob: ,fold: ,foldopen:,foldsep: ,foldclose:'
|
||||
vim.opt.foldtext = ''
|
||||
end,
|
||||
opts = {
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { 'treesitter', 'indent' }
|
||||
end
|
||||
},
|
||||
config = function()
|
||||
require('ufo').setup({
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { 'treesitter', 'indent' }
|
||||
end
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user