Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
A Fix An existing pattern needs to be cleared to allow the new rule to match on any 2 trailing spaces: syntax clear markdownLineBreak syntax match markdownLineBreak '\s\{2}$' conceal cchar=⏎ ...
Answer
#1: Initial revision
### A Fix An existing pattern needs to be cleared to allow the new rule to match on any 2 trailing spaces: ```vim syntax clear markdownLineBreak syntax match markdownLineBreak '\s\{2}$' conceal cchar=⏎ ``` ### Why it's not working The syntax pattern only matches on exactly 2 trailing spaces because there is a standard pattern matching on 2 or more spaces for markdown. See /usr/share/vim/vim90/syntax/markdown.vim ```vim syn match markdownLineBreak " \{2,\}$" ``` ### Troubleshooting I was able to determine the name of the problem match by using the `synIDattr()` function on trailing spaces where my match wasn't applied. The following will get the syntax group-name applied to the current position. ```vim synIDattr(synID(line("."),col("."),1),"name") ``` ### Utilizing the Existing Pattern You could also take advantage of the current pattern with something like ```vim hi markdownLineBreak gui=underline cterm=underline ``` From my understanding you can't add conceal to an existing pattern, but can replace it with `matchadd()`. [vi.stackexhange answer](https://vi.stackexchange.com/questions/5696/adding-conceal-to-already-existing-syntax-highlighting)