Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eruby html syntax highlighting #363

Open
amerov opened this issue Mar 23, 2018 · 4 comments
Open

eruby html syntax highlighting #363

amerov opened this issue Mar 23, 2018 · 4 comments
Labels

Comments

@amerov
Copy link

amerov commented Mar 23, 2018

I use https://github.com/othree/html5.vim for html.
.erb highlighting is strange
screenshot from 2018-03-24 00-25-00

@AndrewRadev
Copy link
Member

Oddly enough, for me it's the other way around, sort of. With the plugin you link to, the "data-user" renders correctly, both in erb and html, as htmlArg. Without it, the -user part highlights as htmlTag instead.

One thing to check is your iskeyword and syn iskeyword settings. Try these commands in an eruby and html buffer:

:set iskeyword
:syn iskeyword

You could also try installing this plugin: https://github.com/vim-scripts/SyntaxAttr.vim. With it, calling :call SyntaxAttr() will give you information about the syntax group under the cursor.

Even with that, I'm not sure if we'll be able to fix the issue, but it's a start to at least maybe figure out what might be wrong.

@amerov
Copy link
Author

amerov commented Mar 24, 2018

fixed it by adding autocmd BufRead,BufNewFile *.html.erb set filetype=eruby.html

@AndrewRadev
Copy link
Member

Hm, that's interesting. I wonder if that doesn't override eruby syntax somehow. Well, either way, does that mean this issue can be closed?

@tpope
Copy link
Member

tpope commented Mar 24, 2018

First things first, one problem is that https://github.com/othree/html5.vim adds hyphen to 'iskeyword'. This is fundamentally incompatible with not just Ruby (and thus ERB) but also embedded JavaScript, and possibly CSS too. Thus, I'd argue that this HTML syntax file has a fundamental design flaw.

But I'm not even sure that's the actual problem. While I can reproduce your ERB example, I can't reproduce your success with the plain HTML filetype. I can also produce a match with datafoo-bar=, which is invalid as I understand the HTML spec. Clearly, this particular HTML syntax file has issues.

@dkearns dkearns added the syntax label Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants