echo "set lazyredraw" > vimrc-example
gvim -u vimrc-example -U NONE --noplugin
Notice that the intro message doesn't get displayed until a key is
pressed. If you provide a filename on the command line the buffer
doesn't get displayed initially either.
Forcing a redraw on the VimEnter event helps, but the cursor is still
displayed in the wrong location until a key is pressed:
echo "autocmd VimEnter * redraw" >> vimrc-example
gvim -u vimrc-example -U NONE --noplugin
- Christian
--
Unnamed Law: If it happens, it must be possible.
Christian J. Robinson <infy...@onewest.net> http://infynity.spodzone.com/
PGP keys: 0x893B0EAF / 0xFB698360 http://infynity.spodzone.com/pgp
I have noticed the same problem. Patch 95 is the culprit.
Ajit
When starting vim using the restore-cursor autocommand tip, about 75% of the time the cursor is displayed on the last column of the statusline, or the statusline isn't drawn and instead the cursor is displayed on the last column of the last displayed line. When I press any key, the cursor is redisplayed at the proper position and the status line gets redrawn, if it wasn't originally drawn. The following is the minimal vimrc that is needed for me to reproduce this.
set nocompatible
set lazyredraw
" :help restore-cursor
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\""
\ endif
If I add a call to `redraw!` after the execute, the problem resolves for this example, but for a more complicated vimrc using a lot of plugins, figuring out where to add the redraw can be very challenging.
Unsetting lazyredraw is my only guaranteed solution now.
Tested with both iterm2 and Apple's Terminal.
vim --version:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 14 2012 08:16:31)
MacOS X (unix) version
Included patches: 1-244, 246-661
Compiled by buil...@gamma.local
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm -mouse_urxvt -mouse_sgr +multi_byte +multi_lang -mzscheme
+netbeans_intg +path_extra -perl +persistent_undo +postscript +printer -profile
-python -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs
+smartindent -sniff +startuptime +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
-xterm_clipboard -xterm_save
system vimrc file: "/opt/local/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp -pipe -O2 -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L/opt/local/lib -arch x86_64 -L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework Cocoa
As I mentioned earlier, I only experienced this with the console version of Vim on iterm2 and Apple's default Terminal. I was not able to reproduce with the gui MacVim. I have just checked xterm and rxvt running under X11.app (Apple's X11 server) and there is no issue with them.
So this only seems to affect the two most popular terminal programs on OS X.
Ben, using your example of calling Vim without a file argument, I still observed the redraw issue. The cursor mostly displays for me initially in the lower right corner of the the intro text, instead of at (1,1).