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:

Moving Backgrounds With Mouse Position

Let's say you wanted to move the background-position on an element as you mouse over it to give the design a little pizzazz. You have ...