tpope / vim-markdown

Vim Markdown runtime files
1.22k stars 191 forks source link

markdownLineBreak unused #214

Closed rcmosher closed 3 months ago

rcmosher commented 3 months ago

I noticed markdownLineBreak is unused other than being in a contains. I suspect this is intentional given the discussion on #181. Adding a background color or underline is more likely to make it look like an error IMO. I'm personally overriding it with a conceal using ⏎ (vim/vim#14819), but that seems like a strong choice for a default syntax file.

The group-name does allow adding a custom highlight:
highlight markdownLineBreak gui=underline cterm=underline
As far as I know you can't add a conceal to the group-name and have to override it. I also found it can conflict with custom patterns. For instance the following matches on exactly 2 trailing spaces, but will not match 2 trailing spaces if proceeded by spaces due to markdownLineBreak:
syntax match customLineBreak '\s\{2}$' conceal cchar=⏎

I suspect the group being unused is intentional given the above. I'm posting this in case it isn't. And it may help others who bump into issues trying to make a custom highlight.

tpope commented 3 months ago

Posted a comment to the Vim issue before noticing this. But yes, you are correct in your deduction that it's deliberately unused by default.

You can solve the conflict by using an outer group to match all the whitespace and an inner group to apply the conceal:

syntax match customTrail '\s\{2,}$'
syntax match customLineBreak '\s\{2}$' conceal cchar=⏎ contained containedin=customTrail