1

I want to create syntax highlighting for indentation sensitive language that I'm designing, my question is how to highlight multiline comment that begins with #!
something like this

#! xxxxxxxxxxx
 xxxxxxxxx
    xxxxxxxxx
 xxxxxx
    xxxxxx

or

func arg1 arg2 #! xxxxxxxxxxx
                 xxxxxxxxx
                xxxxxxxxx
                xxxxxx
                  xxxxxx
  arg3
  arg4

Edit
I found a solution for the first example

syn match CommentBlock /\( *\)#!.*\n\(\1 .*\n\)*/
12
  • 4
    What identifies the end of the comment?
    – Steve
    Commented Aug 17, 2016 at 7:41
  • if the next line after #! have a shorter indentation from where #! is located it then identified as the end of the comment
    – raoof
    Commented Aug 17, 2016 at 9:48
  • Your example would then make identifying the comment difficult as #! has no indentation. Does the comment end at arg3 or the second lot of xxxxxx?\
    – Steve
    Commented Aug 17, 2016 at 13:30
  • it ends at arg3, matching the first example ( with indentation for #! ) would be fine
    – raoof
    Commented Aug 17, 2016 at 14:04
  • See :h syn-region
    – Tumbler41
    Commented Aug 17, 2016 at 14:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.