Gvim redraw failure


I have a problem with gvim where the screen redraw partially fails.
It's hard to explain but when I open a text file and page down or up
the entire text file is not redraw properly. I have to move the cursor
first before it redraws. I've got a screencapture here of it since it
demonstrates the problem:

It seems as if the issue is limited to gvim because every other application I run is fine and redraws properly. It's quite easy for me to reproduce in gvim. The console vim is fine. It makes me think the issue is limited to gvim.

OS is Arch linux 3.0 running the nvidia drivers running Gnome3 (no compiz).

Output from uname

Linux cyclops 3.0-ARCH #1 SMP PREEMPT Tue Aug 30 07:32:23 UTC 2011
i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux


lsmod | grep nvidia
nvidia              10225284  40 
agpgart                22096  1 nvidia
i2c_core               16625  2 nvidia,i2c_nforce2

gvim –version

gvim –version VIM – Vi IMproved 7.3
(2010 Aug 15, compiled Sep 30 2011 05:51:10) Included patches: 1-322
Compiled by ArchLinux Big version with GTK2 GUI. Features included
(+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search
+file_in_path +find_in_path +float +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap
+linebreak +lispindent +listcmds +localmap -lua +menu +mksession
+mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm

-mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme
+path_extra +perl +persistent_undo +postscript +printer -profile
+python3/dyn +quickfix +reltime +rightleft +ruby +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax
+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
+xsmp_interact +xterm_clipboard -xterm_save system vimrc file:
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc" system gvimrc file:
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 -pthread -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/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng14 -I/usr/local/include -march=i686
-mtune=generic -O2 -pipe -fstack-protector –param=ssp-buffer-size=4
-D_FORTIFY_SOURCE=1 Linking: gcc -L. -Wl,–hash-style=gnu
-Wl,–as-needed -rdynamic -Wl,-export-dynamic -Wl,-E
-L/usr/local/lib -Wl,–as-needed -o vim -pthread -lgtk-x11-2.0
-lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0
-lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lSM -lICE
-lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lelf -lnsl -lacl
-lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE
-fstack-protector -L/usr/local/lib -L/usr/lib/perl5/core_perl/CORE
-lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -lruby -lpthread
-lrt -ldl -lcrypt -lm -L/usr/lib

Best Answer

I had this problem and was able to get around the issue by starting gvim with the --sync option. This makes X calls asynchronous.

(Thanks to the link in Christian Brabandt's comment for pointing me in the right direction.)

Related Question