1

In my vimrc I have this line :

call matchadd('ColorColumn', '\%81v', 100)

It colors the 81th column in a subtle grey background so I can track my line length :

enter image description here

(see the l and the f)

I found out that when editing a large file, this function causes Vim to be very slow.

One of the file I am currently working on is a jsp file with a lot of mistakes in the indentation/syntax.

I also tried with a custom vimrc :

.vimrc-test

call matchadd('ColorColumn', '\%81v', 100)

And launching vim with vim -u .vimrc-test -N my-file.jsp it reproduce the same.

I am on MacVim 7.4.383 on Yosemity.

Do you know anything related to this issue ?

nobe4
  • 16,033
  • 4
  • 48
  • 81
  • I can't really answer that, but check :h colorcolumn, this is a standard option for vim. The help states "Will make screen redrawing slower.", so you won't probably get around that, but maybe the internal implementation is atleast faster then your version. – PhilippFrank Aug 04 '15 at 09:32
  • with a set cc=+1 and a set textwidth=80 I get the 81th column colored with no performance issue, so I'll stick to that for the moment, thanks for the advice – nobe4 Aug 04 '15 at 09:45

1 Answers1

1

Try appending the \%#=1 to the pattern so the old regexp engine is used. If I remember correctly, there was a bug in the newer engine that makes matching column positions slower, which was fixed later in the 7.4. development.

Christian Brabandt
  • 25,820
  • 1
  • 52
  • 77