Vim sync syntax from beginning of file on command
When 开发者_StackOverflow社区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
I reckon this would work:
:syn sync fromstart
but maybe you omitted some conditions/criteria from the question, why this is not eligible?
Alternatively, I suppose
:syn sync minlines=99999
should have a similar effect on most source files (hopefully for you!).
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?
精彩评论