Friday, January 8, 2010

Re: cursorline performance problem

Thanks for your responses. I feel that :h cursorline 'Will make screen
redrawing slower' is misleading. It doesn't feel like screen redrawing
that's causing the cursor scroll behaviour (it probably as, as syntax
is calculated and re-calculated for every movement, but it doesn't
feel like it). I believe it should say 'Will make screen updates
slower and can affect cursor movement responsiveness.'

To get my editor back to usable, I've removed cursorline and I've also
stopped matchparen loading - another killer. There's no health warning
in the help for matchparen.

See :h matchparen, this is a standard plugin and is prevented from
loading with a hack:
let loaded_matchparen = 1

matchparen was making some of my most-used mappings crawl.
Specifically, I have a little 'add comment containing block control
line to end of block' that I use all the time.

With matchparen and cursorline, particularly if the block extends more
than a screen-height, this can take whole seconds to complete.
Without, it's instant.

nmap <F4> a <ESC>D%ky$j%A // END <ESC>p^

Which results in this with <F4> on the closing brace:

for( i=0; i<10; i++ )
{
} // END for( i=0; i<10; i++ )

It's a shame, I like having both cursorline and matchparen but I'm
much happier in my workflow without them. Problem not so much solved
as avoided!

Cheers, al.


2010/1/8 Bee <200309@calcentral.com>:
> Allan K wrote:
>> Hi, I added cursorline to my .vimrc a while ago, I find it very
>> helpful.
>>
>> However I also have a jerky scrolling problem, and after debugging
>> my .vimrc today I found it's cursorline causing the problem.
>>
>> Is this a known issue? I can't find anything on the web, other than 1
>> discussion at Experts Exchange which is subscription-only.
>
> Yes, a known issue.
>
> I toggle cursorline when needed.
>
>  " toggle cursorline or center line
>  if version >= 700 " NONE turns off underlining
>   highlight CursorLine   NONE ctermbg=Yellow
>   highlight CursorColumn NONE ctermbg=Yellow
>   nmap <silent> <F7> :set cursorline!<cr>
>  else " center line
>   nmap <F7> zz
>  endif
>  imap <F7> <c-o><F7>
>  vmap <F7> <esc><F7>gv
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php
>

No comments: