2

I am developing a syntax file and I am struggling with a concealends property :

syntax region Reference start="{reference}" end="{/reference}" conceal
syntax region Name start="{name}" end="{/name}" concealends

{name}name1{/name}
{reference}ref{/reference}{name}name2{/name}

Then I source the file and the syntax is applied. I run set conceallevel=2 and I have the following display :

syntax region Reference start="" conceal
syntax region Name start="{name}" end="{/name}" concealends

{name}name1{/name}
{name}name2{/name}

So the conceal property is applied to the reference block but the concealends is not.

I tried this with and without my vimrc and the results doesn't change.

Do you have an idea of what I am doing wrong ?

1

The help (:syn-concealends) states:

The ends of a region can only be concealed separately in this way when they have their own highlighting via "matchgroup"

So I did a little test by using an existing highlight group:

syntax region Reference start="{reference}" end="{/reference}" conceal
syntax region Name matchgroup=texStatement start="{name}" end="{/name}" concealends

This hides the {reference}ref{/reference} completely, and hides the {name} and {/name} region markers/ends, leaving name1 and name2 only - I suppose this is what you aim.

This isn't a complete answer. Hope the above are a good pointer to further reading - I am an absolute beginner in the syntax area.

  • oooh, dumb me, I though that the ends of a region meant the "closing pattern" only. I didn't try this. Thanks a lot :) – nobe4 Sep 25 '15 at 9:59
  • You're welcome :) When you feel like knowing all this syntax stuff, perhaps write a blog post ;) – VanLaser Sep 25 '15 at 10:02
  • 1
    Definitely! At the first time I tried reading the :h syntax, but it got me confused pretty quickly, I also read LVTHW syntax's section but it doesn't cover all there is to do. – nobe4 Sep 25 '15 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.