evidens/vim-twig

Broken syntax highlighting when .html.twig

Closed this issue · 6 comments

I noticed one problem today, didn't happen before. When i load file which has .html.twig, syntax highlighting doesnt work properly:

screen shot 2014-03-06 at 10 23 52 am

when it's only .twig, it works fine.

screen shot 2014-03-06 at 10 25 41 am

Biggest problem in this is that i can't use my html snippets because the filetype doesn't contain html. Do you know what could be the issue here? Thanks.

I noticed if i do set ft=twig.html everything works fine, but with set ft=html.twig its broken like on first image. Really strange behavior. Is anyone else maybe have this issue?

which VIm version are you using? I've fixed it for me by removing/uncommenting the lines from #20 untill #24. Now I'm using VIm 7.4, dunno whether it works for 7.3 or older versions of VIm, I'll create a PR if that solved your issue too.

Using 7.4. Tested on both Mac OS and Xubuntu, same issue. Your fix is also working for me. Basically its enough to add on https://github.com/evidens/vim-twig/blob/master/syntax/twig.vim#L22 additional check && b:current_syntax == 'twig', so we don't break the initial idea. Will you do the pull request or i do it?

yeah, an additional check is better than removing, so no breaking changes with the older versions 👍

As you've suggested the right fix, you might send the PR :-)

ok, will do soon :)

Since both of the "broken highlighting" tickets are still open, I'll comment here..

A fresh install of latest vim + this plugin results in HTML not being highlighted.. It appears that b:main_syntax is set and is equal to htmldjango, not sure why that happens