Refresh fold symbol earlier
petobens opened this issue · 2 comments
Hi! I was wondering whether fold signs should refresh earlier. Consider the following gif where I add a new line in a markdown file and the fold sign of the ## A
header is not updated unless I write the file and press zx
. Dunno if this is something the plugin should do automatically or if I need to add an autocommand as
vim.api.nvim_create_autocmd(
---- Refresh folds
{ 'BufEnter', 'BufWritePost', 'TextChanged', 'InsertLeave' },
{
group = vim.api.nvim_create_augroup('md_folds', { clear = true }),
pattern = { '*.md' },
callback = function()
vim.cmd('normal! zx')
end,
}
)
Don't think it's an issue with this plugin, you can see the same problem with :set stc=
and the default foldcolumn.
Are you using vim.treesitter.foldexpr()
? I don't, so I couldn't reproduce at first. But I see the same problem in markdown files with vim.treesitter.foldexpr()
. Perhaps the issue is with vim.treesitter.foldexpr()
or the markdown parser? Not familiar with the internals of that system so IDK.
I'm indeed using vim.treesiter.foldexpr()
. Will look into that then. Thanks (and sorry for the noise)