Folding is added as per lazy config
This commit is contained in:
parent
b03ea9dd9b
commit
4fcc6399a5
|
@ -1,32 +1,35 @@
|
|||
return {
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
event = { "User AstroFile", "InsertEnter" },
|
||||
dependencies = { "kevinhwang91/promise-async" },
|
||||
opts = {
|
||||
preview = {
|
||||
mappings = {
|
||||
scrollB = "<C-b>",
|
||||
scrollF = "<C-f>",
|
||||
scrollU = "<C-u>",
|
||||
scrollD = "<C-d>",
|
||||
event = "BufRead",
|
||||
dependencies = {
|
||||
{ "kevinhwang91/promise-async" },
|
||||
{
|
||||
"luukvbaal/statuscol.nvim",
|
||||
config = function()
|
||||
local builtin = require("statuscol.builtin")
|
||||
require("statuscol").setup({
|
||||
-- foldfunc = "builtin",
|
||||
-- setopt = true,
|
||||
relculright = true,
|
||||
segments = {
|
||||
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
|
||||
{ text = { "%s" }, click = "v:lua.ScSa" },
|
||||
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
|
||||
},
|
||||
},
|
||||
provider_selector = function(_, filetype, buftype)
|
||||
local function handleFallbackException(bufnr, err, providerName)
|
||||
if type(err) == "string" and err:match "UfoFallbackException" then
|
||||
return require("ufo").getFolds(bufnr, providerName)
|
||||
else
|
||||
return require("promise").reject(err)
|
||||
end
|
||||
end
|
||||
|
||||
return (filetype == "" or buftype == "nofile") and "indent" -- only use indent until a file is opened
|
||||
or function(bufnr)
|
||||
return require("ufo")
|
||||
.getFolds(bufnr, "lsp")
|
||||
:catch(function(err) return handleFallbackException(bufnr, err, "treesitter") end)
|
||||
:catch(function(err) return handleFallbackException(bufnr, err, "indent") end)
|
||||
end
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
},
|
||||
config = function()
|
||||
-- Fold options
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
require("ufo").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue