Files
dotfiles/nvim/lua/plugins/ufo.lua
2023-10-31 13:02:50 +01:00

45 lines
938 B
Lua

-- Not UFO in the sky, but an ultra fold in Neovim.
-- https://github.com/kevinhwang91/nvim-ufo
return {
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
config = function()
vim.o.foldcolumn = "1"
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
require("ufo").setup({
provider_selector = function(bufnr, filetype, bufftype)
return { "lsp", "indent" }
end,
})
end,
keys = {
{
"zR",
function()
require("ufo").openAllFolds()
end,
desc = "Open all folds",
},
{
"zM",
function()
require("ufo").closeAllFolds()
end,
desc = "Close all folds",
},
{
"zK",
function()
local winid = require("ufo").peekFoldedLinesUnderCursor()
if not winid then
vim.lsp.buf.hover()
end
end,
desc = "Peek fold",
},
},
}