-
Notifications
You must be signed in to change notification settings - Fork 56
/
nvim-ufo.lua
37 lines (34 loc) · 1.14 KB
/
nvim-ufo.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
return {
'kevinhwang91/nvim-ufo',
dependencies = {
'kevinhwang91/promise-async'
},
event = "BufRead",
keys = {
{ "zR", function() require('ufo').openAllFolds() end, desc = "Open all folds" },
{ "zM", function() require('ufo').closeAllFolds() end, desc = "Close all folds" },
{ "zZ", function() require('ufo').peekFoldedLinesUnderCursor() end, desc = "Peed folded lines under cursor" },
},
opts = {
open_fold_hl_timeout = 0,
fold_virt_text_handler = function(text, lnum, endLnum, width)
local suffix = " "
local lines = ('[%d lines] '):format(endLnum - lnum)
local cur_width = 0
for _, section in ipairs(text) do
cur_width = cur_width + vim.fn.strdisplaywidth(section[1])
end
suffix = suffix .. (' '):rep(width - cur_width - vim.fn.strdisplaywidth(lines) - 3)
table.insert(text, { suffix, 'Comment' })
table.insert(text, { lines, 'Todo' })
return text
end,
preview = {
win_config = {
border = {"┏", "━", "┓", "┃", "┛", "━", "┗", "┃"},
winblend = 0,
winhighlight = "Normal:LazyNormal",
}
}
},
}