cursorline performance problem

14 views
Skip to first unread message

Allan K

unread,
Jan 7, 2010, 6:53:25 AM1/7/10
to vim_use
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.

:ver below.

Thanks in advance, al.

VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 8 2009 02:18:41)
Included patches: 1-138
Compiled by bui...@rothera.buildd
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset
+cindent +clientserver +clipboard +cmdline_compl +cmdline_hist
+cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui
+diff +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra
+extra_search +farsi +file_in_path +find_in_path +folding -footer +fork
() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap
+langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm -
mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang
-mzscheme +netbeans_intg -osfiletype +path_extra +perl +postscript
+printer +profile +python +quickfix +reltime +rightleft +ruby
+scrollbind +signs +smartindent -sniff +statusline -sun_workshop
+syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo
+termresponse +textobjects +title +toolbar +user_commands +vertsplit
+virtualedit +visual +visualextra +viminfo +vreplace +wildignore
+wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact
+xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/
include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/
usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gl
ib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/
include/libpng12 -I/usr/include/pixman-1 -DORBIT2=1 -pthread -I/usr/
include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include
/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/
usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/
include/gtk-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnom
e-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 -I/
usr/lib/glib-2.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/
bonobo-activation-2.0 -I/usr/include/libxml2 -I/usr/include/p
ango-1.0 -I/usr/include/gail-1.0 -I/usr/include/freetype2 -I/usr/
include/atk-1.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/
include/libpng12 -I/usr/include/pixman-1 -g -O2 -O2 -g -Wall
-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -I/usr/
local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/
perl/5.8/CORE -I/usr/include/python2.5 -pthread -I/usr/lib/ru
by/1.8/i486-linux
Linking: gcc -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-
dynamic -Wl,-E -Wl,-Bsymbolic-functions -L/usr/local/lib -o vim -
lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocair
o-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -
lgnomeui-2 -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt -
lbonobo-2 -lbonobo-activation -lORBit-2 -lart_lgpl_2 -lgtk-
x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -
lpango-1.0 -lcairo -lgconf-2 -lgthread-2.0 -lrt -lgmodule-2.0 -
lgobject-2.0 -lglib-2.0 -lXt -lncurses -lgpm -Wl,-E -L/usr/local/
lib /usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl/5.8/
CORE -lperl -L/usr/lib/python2.5/config -lpython2.5 -lutil -Xlinker -
export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lruby1.8 -
lm

Ben Fritz

unread,
Jan 8, 2010, 9:21:08 AM1/8/10
to vim_use

On Jan 7, 5:53 am, Allan K <allanke...@gmail.com> 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, it's a known issue. It's even mentioned in :help 'cursorline'
which says "Will make screen redrawing slower".

Bee

unread,
Jan 8, 2010, 11:30:36 AM1/8/10
to vim_use
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

Allan Kelly

unread,
Jan 8, 2010, 6:15:09 PM1/8/10
to vim...@googlegroups.com
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 <200...@calcentral.com>:

> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php
>

Stroller

unread,
Jan 9, 2010, 12:29:09 PM1/9/10
to vim...@googlegroups.com

On 7 Jan 2010, at 11:53, Allan K wrote:
> ...

> Is this a known issue? I can't find anything on the web, other than 1
> discussion at Experts Exchange which is subscription-only.

If you found the discussion at Experts Exchange through Google, then
your browser's referrer should be set so that by scrolling down past
the advertisements & the wossisnames to subscribe you can actually
see the discussion. I think that Experts Exchange *used* to show the
results to Google, then demanded a subscription to view, but I believe
that Google threatened to delist them from search results.

Stroller

Reply all
Reply to author
Forward
0 new messages