Thursday, February 13, 2014

Vim syntax highlighting is too slow?

In some cases, yes vim syntax highlighting is slow, especially with ruby file with inline javascript, css, erb and html in the same file. When Vim starts fresh it is not that slow but after some time you will feel it a bit sluggish while you navigate the file. For a quick solution, I used to close all buffers and start a new vim session.

Vim used a slow regexp parser to parse the code to provide language specific syntax highlighting. Starting from vim version 7.4 vim uses a new faster regular expression engine.

If you complain, like me, about vim sluggish syntax highlighting, go upgrade your vim to 7.4 or newer version and put the following line on your .vimrc, and you will notice the improvement in speed.

:set regexpengine=1

No comments:

The Y Combinator (Slight Return)

Tiger got to hunt, Bird got to fly; Lisper got to sit and wonder, (Y (Y Y))? Tiger got to sleep, Bird got to land; Lisper got to tell hims...