Vim 7 slows down when highlighting cursor line

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Vim 7 slows down when highlighting cursor line

player12
Hi,

When I enable cursor line highlighting with ":set cul" and
I have syntax enabled, scrolling (j,k,l,h) becomes very slow,
especially for some file types (xml, ruby, ...)  Is it expected.

Thanks,
--
James Player


Reply | Threaded
Open this post in threaded view
|

Re: Vim 7 slows down when highlighting cursor line

Bram Moolenaar

James Player wrote:

> When I enable cursor line highlighting with ":set cul" and
> I have syntax enabled, scrolling (j,k,l,h) becomes very slow,
> especially for some file types (xml, ruby, ...)  Is it expected.

Yes, that is expected.  Vim needs to redraw the whole window every time
you move the cursor.  Otherwise scrolling only redraws the text that
appears.

--
There's no place like $(HOME)!

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: Vim 7 slows down when highlighting cursor line

Benji Fisher
In reply to this post by player12
On Sat, Apr 15, 2006 at 08:26:07PM +0000, [hidden email] wrote:
> Hi,
>
> When I enable cursor line highlighting with ":set cul" and
> I have syntax enabled, scrolling (j,k,l,h) becomes very slow,
> especially for some file types (xml, ruby, ...)  Is it expected.

     Yes.  Under

:help 'cursorline'

it says, in part, "Will make screen redrawing slower."  If it bothers
you, turn it off ... or get yourself a faster computer.  (I figure most
people on this list are looking for excuses to do just that. ;)

HTH --Benji Fisher
Reply | Threaded
Open this post in threaded view
|

Re: Vim 7 slows down when highlighting cursor line

player12
In reply to this post by Bram Moolenaar
>From: Bram Moolenaar <[hidden email]>
>Date: Sat, 15 Apr 2006 22:48:29 +0200
>
>James Player wrote:
>
> > When I enable cursor line highlighting with ":set cul" and
> > I have syntax enabled, scrolling (j,k,l,h) becomes very slow,
> > especially for some file types (xml, ruby, ...)  Is it expected.
>
>Yes, that is expected.  Vim needs to redraw the whole window every time
>you move the cursor.  Otherwise scrolling only redraws the text that
>appears.

But it also happens when the cursor is moved without actually scrolling
the information on the screen.  Can it be optimized not to redraw the
whole screen when only cursor position changes?

Thanks,
--
James Player


Reply | Threaded
Open this post in threaded view
|

Re: Vim 7 slows down when highlighting cursor line

Bram Moolenaar

James Player wrote:

> >From: Bram Moolenaar <[hidden email]>
> >Date: Sat, 15 Apr 2006 22:48:29 +0200
> >
> >James Player wrote:
> >
> > > When I enable cursor line highlighting with ":set cul" and
> > > I have syntax enabled, scrolling (j,k,l,h) becomes very slow,
> > > especially for some file types (xml, ruby, ...)  Is it expected.
> >
> >Yes, that is expected.  Vim needs to redraw the whole window every time
> >you move the cursor.  Otherwise scrolling only redraws the text that
> >appears.
>
> But it also happens when the cursor is moved without actually scrolling
> the information on the screen.  Can it be optimized not to redraw the
> whole screen when only cursor position changes?

That is very complicated.  'cursorline' and 'cursorcolumn' were added
mainly because it was a small change.  Optimizing the redrawing is very
complex and interferes with other things, e.g., Visual highlighting.  It
would also require caching the highlighting from before the line/column
highlighting was applied.  So the code is simplistic and if it's too
slow for you then don't use it.

--
I AM THANKFUL...
...for a lawn that needs mowing, windows that need cleaning
and gutters that need fixing because it means I have a home.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///