0

I'm trying to learn multi line highlighting and have managed to get the following working

syntax region myMinusStart start=/^\s\+zzzz / end=/^\s\+qqqq / concealends

But the concealends is not hiding the line with zzzz $ or the line with qqqq $

Reading `:h :syn-concealends' it seemed to say that to conceal the ends they need a match group so I tried

syntax match myMinusBegin /^\s\+zzzz / contained conceal
syntax match myMinusEnd  /^\s\+qqqq /  contained conceal

example

But the start line still didn't conceal. Any suggestions?

Update: For some reason the zzzz is reporting as MyMinusStart which would suggest why it's not concealing.

I also tried the following thinking the pattern had to differ but with no luck

syntax match myMinusBegin /^\s\+zzzz / contained conceal
syntax match myMinusEnd  /^\s\+qqqq /  contained conceal

Update I tried Karl's suggestion, below, and that hid the start and end markers but after removing transparent, as it hid the color highlighting , there's a termination problem in the pattern I can't work out

Karl's suggestion syntax region myMinusStart start=/^\s+zzzz / end=/^\s+qqqq / \ transparent \ contains=myMinusBegin,myMinusEnd

syntax match myMinusBegin /^\s\+zzzz / contained conceal
syntax match myMinusEnd  /^\s\+qqqq /  contained conceal

Example 1

For some reason once I enter zzzz $ and qqqq $ once it color hilights to the end of the file. There are three blocks that match the region but I can't see why the coloring continues until file end.

1

Try the following:

syntax region myMinusStart start=/^\s\+zzzz / end=/^\s\+qqqq /
    \ transparent keepends
    \ contains=myMinusBegin,myMinusEnd

syntax match myMinusBegin /^\s\+zzzz / contained conceal
syntax match myMinusEnd  /^\s\+qqqq /  contained conceal

Note that you need to set conceallevel e.g. to 2, see :h conceallevel.

  • Karl thanks. That almost worked , removing the transparent as that removed the coloring, but there's a pattern end problem. See update – Steve Mar 9 '18 at 0:25
  • try to add the option keepends to the syntax region command. – Karl Yngve Lervåg Mar 10 '18 at 8:56

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.