indentLine
indentLine copied to clipboard
Conceal characters are overwritten by indent line character
My conceal characters are changed to the indent line character.
Whereas the real characters should be:
I can confirm that. At first I thought it is only about situations where a concealed char appears right after an indentation like
...
get foo() {
| | 'bar';
}
...
here the second |
should actually be a concealed return
. My conceal rule is defined as a syn match
which per documentation should be overruled by a matchadd
which is used when the "new version" is activated (apparently the default). So it is clear why my conceal rule gets overruled but actually the matchadd
for the indent line should not match add all on the return
. But I also found other situations like that from @chinleung.
I can solve my specific case from my example above by reapplying the conceal rule using matchadd
myself, but I'd like to avoid that because first, stuff like return
is hard to exclude for appearences in strings or comments vs. excluding them by syn match .... contained containedin=...
plus many syntax highlighting plugins specify their concealsettings using syn match
and I would need to add custom matchadd
s for all of those.
TL;DR A quickfix for this issue is to reapply the broken cchar
s using matchadd
which is undesirable for users of a lot of plugins so we'd need to fix the regex but I cannot tell whats wrong with it yet.
@chinleung here is a matchadd
for your not
which I have added just yesterday to my vim config (as I said: this will conceal also !
which appear in strings and comments since I cannot restrict the match to nextgroup=fooExpression
which is what my plugin is doing to conceal only the right !
):
call matchadd('Conceal, '!', 10, -1, { 'conceal': '¬'})
The 10
is the priority of the match. Higher priority overrules lower ones. See :h matchadd
. I choose ten because as far as I understood it is the base for custom matchadd
s. The highlighting for hlsearch
is also added using matchadd
and has a priority of 0
for example.
-1
is the ID which is automatically created by vim if -1
is passed.
The dictionary at the last param is obvious I guess. You specify the cchar
here.
Note that although it may be obvious for some you have to use the Conceal
highlighting group, otherwise the last parameter will do nothing (when conceal
is used for different highlighting groups with syn match
the conceal char will be applied other than with matchadd
but the highlighting group will be hardly set to Conceal
as well).
I am having similar problems as in some cases it is fine while in some case it does not.
Here is snapshot
It is happening when I am using this plugin which also uses the conceal feature.
The problem is in line28
@ohcibi Your matchadd worked for me too. Thanks! Very minor: the statement is missing a quote after
Conceal
😄