0

I am just starting with VIM and trying to use syntax highlighting. When start and end of fold is commented, whole block inside is highlighted as comment. Is it possible to highlight it normally?

I included following in my snytax file:

                syn region vimFoldAnfang
                  \ start="\<sta\%[rt]\>"
                  \ end="\<end\%[e]\>"
                  \ transparent fold
                  \ extend
                 \ containedin=ALLBUT,@vimNoFold
                  \ skip=+"\%(\\"\|[^"]\)\{-}\%("\|$\)\|'[^']\{-}'+ 

(http://vim.wikia.com/wiki/Syntax_folding_of_Vim_scripts)

smhrjn
  • 506
  • 3
  • 9
  • Yes, mostly: you need to add a `contains`. – lcd047 May 16 '15 at 15:47
  • Thanks for the good pointer. I tried a bit with 'contains', but then I cannot include comments. If I include it, VIM does not find the end of the folding block (as it is commented too). – smhrjn May 16 '15 at 16:26
  • you use transparent, which means `this item will not be highlighted itself, but will take the highlighting of the item it is contained in` – SolaWing May 17 '15 at 05:15
  • Thank you both for the help. Proper use of contains, containedin and without transparent seems to solve the problem. – smhrjn May 19 '15 at 22:30

0 Answers0