4

I've been trying to write a swig syntax highlight file for vim and I've run into a bit of an issue.

Everything is working okay so far but it's not highlighting inside of html strings. I've looked around and I'm using containedin=htmlString but it's still not highlighting. Also htmlLink is showing the strange grayish color.

I am using this to see what syntax applies and it's saying htmlString and htmlLink as I expected.

Here is a gist of my .vim syntax file

here is a screenshot of what I'm seeing:

I expect <a href="{{ config.root}}... etc to have the curly braces highlighted

I also read this question and it didn't help me or I didn't understand it

6
  • I'm not clear on the connection between swig and html. I use swig quite a bit, but html hasn't come into it for me. What language are you generating code for? Commented Jul 8, 2013 at 4:00
  • You might be thinking of the wrong swig. This is an html template engine named swig, not "Simplified Wrapper Interface Generator". Check the link in the OP. Commented Jul 8, 2013 at 4:44
  • aha! Hard to imagine someone would name another package swig, but there ya go. Commented Jul 8, 2013 at 8:44
  • Yeah imagine the stuff I've one through trying to Google lol. Commented Jul 8, 2013 at 13:14
  • 1
    I'm going to call my next project Java.... ;-) Commented Jul 8, 2013 at 16:23

1 Answer 1

2

From what I see in your definition you have:

syn region swgInside start=/{(%|{)/ end=/(%|})}/ keepend transparent containedin=@htmlSwgContainer

syn match swgBrackets "{%\|%}\|{{\|}}" containedin=swgInside

However on the screenshot you've posted I don't see swgBrackets contained in the swgInside blocks (which I see two: {% if ... %} and {% endif %}).

I would propose revising swgBrackets constraints (maybe removing containedin?). This might help: Vim syntax files ... trying to undestand "contains"

Sign up to request clarification or add additional context in comments.

1 Comment

That was it. This was my first vim syntax implementation and I wasn't thinking clearly I guess. I have since changed it and I'm working past this now. Thanks for the answer.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.