Syntax concealing does not render on visible (unfolded) lines when foldmethod=diff is active and some folds are closed. The conceal rules are correctly defined and conceallevel is set, but the concealed text is displayed literally.
Opening all folds (zR), forcing a redraw, then re-closing them (zM) causes concealing to render correctly.
set nocompatible syntax on enew setlocal buftype=nofile bufhidden=wipe call setline(1, [ \ 'Same 1', 'Same 2', 'Same 3', \ 'Left only [visible](http://hidden-url)', \ 'Same 5', 'Same 6', \ ]) setlocal syntax=markdown conceallevel=2 diffthis vnew setlocal buftype=nofile bufhidden=wipe call setline(1, [ \ 'Same 1', 'Same 2', 'Same 3', \ 'Right only [visible](http://hidden-url)', \ 'Same 5', 'Same 6', \ ]) setlocal syntax=markdown conceallevel=2 diffthis
Line 4 in both buffers should show the markdown link with the URL concealed (i.e., just “visible” instead of “visible”).
Line 4 shows the raw markdown [visible](http://hidden-url) with no concealing applied, even though conceallevel=2 and the syntax conceal rules are active.
After diffthis, running zR (open all folds), redraw, then zM (close all folds) causes concealing to render correctly. This can be automated with a deferred callback:
timer_start(50, (_) => { normal! zR redraw normal! zM })
The redraw between zR and zM is essential — without it, the workaround has no effect.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The conceal rules are correctly defined
Where do the conceal rules come from? The builtin markdown syntax file doesn't conceal URLs.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The conceal rules come from preservim/vim-markdown, which provides a syntax/markdown.vim that includes conceal on inline link URLs and other elements. The built-in syntax file doesn't conceal, correct.
But the bug isn't specific to any particular conceal rules — it's that foldmethod=diff with closed folds prevents any syntax concealing from rendering on visible (unfolded) lines. Here's a self-contained reproduction using a custom syntax rule with no plugins:
set nocompatible syntax on " Left buffer enew setlocal buftype=nofile bufhidden=wipe call setline(1, ['Same 1', 'Same 2', 'Same 3', 'Left SECRET here', 'Same 5', 'Same 6']) syntax match MySecret /SECRET/ conceal setlocal conceallevel=2 diffthis " Right buffer vnew setlocal buftype=nofile bufhidden=wipe call setline(1, ['Same 1', 'Same 2', 'Same 3', 'Right SECRET here', 'Same 5', 'Same 6']) syntax match MySecret /SECRET/ conceal setlocal conceallevel=2 diffthis
Expected: SECRET is concealed on line 4 in both buffers.
Actual: SECRET is shown literally. Running zR then zM makes concealing appear.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Cannot reproduce. The script doesn't lead to any closed folds.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Updated the reproduction script — the previous one had too few lines to form closed folds. Here's an updated version with enough unchanged lines:
set nocompatible syntax on let shared_before = map(range(1, 20), '"Same " .. v:val') let shared_after = map(range(1, 20), '"After " .. v:val') " Left buffer enew setlocal buftype=nofile bufhidden=wipe call setline(1, shared_before + ['Left SECRET here'] + shared_after)
syntax match MySecret /SECRET/ conceal setlocal conceallevel=2 diffthis " Right buffer
vnew setlocal buftype=nofile bufhidden=wipe call setline(1, shared_before + ['Right SECRET here'] + shared_after)
syntax match MySecret /SECRET/ conceal setlocal conceallevel=2 diffthis
With 20 unchanged lines on each side, foldmethod=diff creates closed folds. Line 21 (the changed line) is visible but SECRET is not concealed. Running zR then zM makes concealing appear.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Works as expected, using vim --clean -u script.vim
image.png (view on web)—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Works as expected, using vim --clean -u script.vim
OK, yeah, I can’t reproduce it with --clean, either.
So I guess there’s something else going on in my environment — and given that, I’m gonna close this and regroup and try to further isolate the problem.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
And now I realize I should have rightly closed this as “not planned / can’t repro”. But it seems the repo perms don’t allow me to reopen it. So please re-open and re-close it as such — if the normal project policy/convention is to do that.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()