Re: Speeding up syntax highlighting
- On Thu, Oct 13, 2005 at 03:18:14PM -0700, Keith W. Roberts wrote:
> ----Original Message----Well, I dont' know if it's a good idea to ignore closed folds entirely.
> From: GI [mailto:gautam@...]
> Sent: Thursday, October 13, 2005 2:41 PM
> To: vim-dev@...
> Subject: Speeding up syntax highlighting
> > I've noticed the following: Suppose you're editing a *large* file,
> > (with lots of syntax highlighting) and you have a *large* fold AFTER
> > the cursor, then inserting text is extreemly slow.
> > For example, if you have a 500 odd line fold right after the cursor,
> > and you insert a "$" or something that normally causes lots of
> > syntax to change, then vim takes a while to update this. Sometimes
> > in this situation when I enter text which shouldn't affect syntax
> > highlighting, then vim takes a while to do it (I'm not sure if this
> > is a bug or not).
> > I was wondering if there is any way for Vim to ignore parts of
> > syntax in closed folds. For instance, if Vim were to consider syntax
> > items in folds *only* if there is unfolded text currently visible
> > *after* the fold, then that would speed things up greatly.
> Yeah, I'd agree that syntax hilighting should probably not be
> operative inside a closed fold unless the fold is small, and anything
> that *opens* a fold should cause syntax to be reevaluated from
> (start_of_fold - syn-sync-minlines) ... or some such. OTOH, that
> might have to depend on the type of fold.
Sometimes regions can begin / end in a closed fold, which would cause
the file to look funny.
However, in this case, closed folds apearing at the bottom of the screen
can safely be ignored!
Also, as you suggested, paying a heavy price (even sync from_start) for
anything that *opens* a fold is perfectly acceptable. We open folds far
less frequently than we type :).
A boiled egg in the morning is hard to beat.