Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would never have thought that vim would be so slow. All I have is the following long line:

very long line in vim

I run vim (MacVim) under Mac OSX with the terminal app. Here is my vimrc. Hope that it has nothing to do with some of my plugins. If I break up the big line in the image, everything is working fast again. Thanks for your hints and advices.

Matthias

share|improve this question

migrated from stackoverflow.com Jun 25 '11 at 19:02

This question came from our site for professional and enthusiast programmers.

    
+1. Thanks for the picture! That one line itself is extremely long. Remember that CLI text editors used to limit lines to 255 characters back in the days of DOS. Syntax highlighting requires that each HTML tag open and close be monitored, and each double quote as well, and then each variable. And I'm sure that each time you nest another tag inside the HREF tag, the editor has to figure out just what that means. I've seen emacs have issues highlighting text that VI has no problems with: You too can choose editors on-demand like we do with chrome, FF and the infamous IE browser. –  Vlueboy Jun 26 '11 at 8:37
add comment

2 Answers

up vote 13 down vote accepted

This is a known problem with Vim and very long lines. I see three solutions:

  1. Turn off syntax highlighting with :syntax off.
  2. Limit syntax highlighting with :set synmaxcol=200 or some other value.
  3. Break down your long line in smaller chunks with :s/\s<a/<C-v><Enter><a.

In this particular case I'd recommend solution 3.

share|improve this answer
add comment

try following:

" Syntax coloring lines that are too long just slows down the world
set synmaxcol=128

else i recommend speeding up vim by:

set ttyfast " u got a fast terminal
set ttyscroll=3
set lazyredraw " to avoid scrolling problems
share|improve this answer
1  
+1. This will be useful, even if it wasn't picked by the asker as "best" answer. –  Vlueboy Jun 26 '11 at 8:28
1  
Wow synmaxcol made such a difference when writing blog posts in markdown. –  Keith Smiley Aug 9 '13 at 18:00
    
lazyredraw did the trick for me. Even without any plugins scrolling through certain files was excruciatingly slow. This was the case in both vim and gvim. Profiling did not show anything. –  Confusion Jun 14 at 14:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.