Vim slow with ruby syntax highlighting
The solution to this problem turned out to be the regex engine that vim uses.The speculation on #vim on freenode is that the ruby syntax files use something that is slower on the new regex engine.
Any version older than and including Vim 7.3.969 has the old regex engine.Add in set re=1
to your vimrc
to force the old regex engine on any version newer (and don't forget to reload the file you're currently editing with :e
).
Thanks to Houl, Dolio and dmedvinsky from #vim for help figuring it out.
I haven't had a chance to try the absolute latest version, there was a commit last night that may help with this issue. I will update this if I get the chance to try the bleeding edge version again.
Two things that will drastically help speed up Ruby syntax highlighting are disabling cursor line and relative number for Ruby (if you use those).
I have the following in my .vimrc:
" Ruby is an oddball in the family, use special spacing/rulesif v:version >= 703 " Note: Relative number is quite slow with Ruby, so is cursorline autocmd FileType ruby setlocal ts=2 sts=2 sw=2 norelativenumber nocursorlineelse autocmd FileType ruby setlocal ts=2 sts=2 sw=2endif