Vim 根据命令从文件开头同步语法
当使用嵌入了 Javascript 的 HTML 时,语法突出显示经常会不同步。如果我告诉 vim 始终从文件开头同步,导航速度太慢。我想知道是否有一种方法可以告诉 vim on command 从文件的开头同步。就像“好吧,这是我正在编写的代码,让它看起来正确”。
谢谢
When working with HTML with embedded Javascript, the syntax highlighting often gets out of sync. If I tell vim to always sync from the beginning of the file, navigation is too slow. I was wondering if there is a way to tell vim on command to sync from the beginning of the file. As in, "ok this is the code I'm working on, make it look right".
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这会起作用:
但也许您从问题中省略了一些条件/标准,为什么这不符合条件?
或者,我想
对大多数源文件应该有类似的效果(希望对你来说!)。
I reckon this would work:
but maybe you omitted some conditions/criteria from the question, why this is not eligible?
Alternatively, I suppose
should have a similar effect on most source files (hopefully for you!).
在我看来,突出显示不应该经常不同步。我想知道在同一文档中为“html-regions”和“javascript-regions”指定不同的语法规则是否有帮助。检查
:h syn-region
和:h syn-include
以及此问题的答案:在 VIM 中,如何混合语法/标识规则神贾和javascript 在同一个文件中?It seems to me the highlighting shouldn't get out of sync that often. I wonder whether it might help to specify different syntax rules for "html-regions" and "javascript-regions" in the same document. Check
:h syn-region
and:h syn-include
as well as the answer to this SO question: In VIM, how can I mix syntax/ident rules of both jinja and javascript in the same file?