When working on a remote server with rather large ping times, the syntax highlighting suddenly and seeming randomly breaks. When that happens, it looks like this:
The syntax highlighting is fine til line 24, after that everything is grey. I can fix it by randomly scrolling around or close open vim. But I can neither reproduce the problem, nor reproduce the fix.
This does not happen when I work with exactly the same version of vim and exactly the same .vimrc. Therefore I suspect there's something wrong on the server. Especially I suspect the problem might arise due to the long ping times (~ 170 ms).
Did anyone see a similar behaviour?
I have had this behaviour occasionally, but I've always just let it be, as its only affected me while editing very large files.
However, now you've brought it up I went looking for a solution. I found this page: http://vim.wikia.com/wiki/Fix_syntax_highlighting, which has the following command:
:syntax sync fromstart
Running that solves it for me, although it does take a while to complete.
Edit: Following that page's suggestion to use minlines
argument, I've found that I get instantaneous and usually-correct highlighting by running this command instead:
:syntax sync minlines=20
But obviously you can play with the value to trade-off speed and accuracy to your own taste.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With