-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Neovim version (nvim -v | head -n1)
v0.11.3
Operating system/version
windows
How to reproduce the issue
This problem occurred after I upgraded it.
It returned to normal after I was downgraded to commit 5b75cf5.
my config:
-- 代码折叠配置
vim.opt.foldcolumn = '0'
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldenable = true
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (' … %d lines'):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, {chunkText, hlGroup})
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, {suffix, 'MoreMsg'})
return newVirtText
end
return {
'kevinhwang91/nvim-ufo',
dependencies = { "kevinhwang91/promise-async" },
commit = "5b75cf5fdb74054fc8badb2e7ca9911dc0470d94",
config = function()
local ufo = require("ufo")
vim.keymap.set("n", "zR", ufo.openAllFolds)
vim.keymap.set("n", "zM", ufo.closeAllFolds)
vim.keymap.set("n", "zr", ufo.openFoldsExceptKinds)
vim.keymap.set("n", "zm", ufo.closeFoldsWith)
-- Option 2: nvim lsp as LSP client
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
vim.lsp.config("*", {
capabilities = capabilities
})
ufo.setup {
open_fold_hl_timeout = 100,
fold_virt_text_handler = handler,
}
end,
}Expected behavior
Actual behavior
x1unix, bedlamzd, schemar, suasuasuasuasua, joeyagreco and 2 moretornoda
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working