简体   繁体   English

如何使用 ES6/ES2015 字符串插值修复语法高亮?

[英]How to fix syntax highlighting with ES6/ES2015 string interpolation?

My vim screws up the highlighting with string interpolation:我的 vim 用字符串插值搞砸了突出显示:

高亮错误

How do I update the JS grammar to fix it?如何更新 JS 语法来修复它? Does it have to do with my color theme or with vim/macvim itself?它与我的颜色主题有关还是与 vim/macvim 本身有关?

You can install this package: http://www.vim.org/scripts/script.php?script_id=5230你可以安装这个包: http : //www.vim.org/scripts/script.php?script_id=5230

There is a description on the page to help you install it.页面上有说明可以帮助您安装它。

This is their github repo: https://github.com/garbas/vim-snipmate这是他们的 github 仓库: https : //github.com/garbas/vim-snipmate

This worked for me.这对我有用。

Install Plugin 'mxw/vim-jsx'安装Plugin 'mxw/vim-jsx'

Then put this in your .vimrc然后把它放在你的.vimrc

" This allows jsx syntax highlighting in js files
let g:jsx_ext_required = 0

If you use vundle, just put this Plugin 'mxw/vim-jsx' and the above lines in your .vimrc and run :PluginInstall如果您使用 vundle,只需将此Plugin 'mxw/vim-jsx'和上述行放在您的.vimrc并运行:PluginInstall

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM