chrisjones
chrisjones

Reputation: 33

Terminal Vim redraw issues in OS X Lion

Recently switched from MacVim to standard vim so I can force myself to move around in vim without the help of the MacVim wrapper. Since doing so, I'm having some weird redraw issues. I've tested this in both iTerm2 and standard Terminal in Lion.

When I'm editing files, opening NERDTree etc, fragments of the last window appear in my current buffer. Sometimes the ".. (up a dir)" gets left in the new buffer. The bottom status bar duplicates itself. The only thing that seems to get rid of this is manually calling ":redraw!".

I put together a quick video to show what I'm talking about since my Google-fu has yielded no results. Video Demo

This is really bugging the hell out of me. Anyone have any ideas on what might be causing this?

Updates

I double checked and both Vim and iTerm2/Terminal are set to UTF-8 for character encoding. I even enabled this setting in iTerm2: Double-Width Characters: Treat ambiguous-width characters as double width.

ECHO $TERM output (same for both iTerm2 and standard Terminal) xterm-256color

:version output

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug  5 2011 10:58:31)
MacOS X (unix) version
Included patches: 1-260
Compiled by chris@nix
Huge version with MacVim 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_gui +diff +digraphs
+dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +fullscreen -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 +multi_byte +multi_lang -mzscheme +netbeans_intg +odbeditor +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 +transparency +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset +xim -xsmp -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: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch x86_64 -D_FORTIFY_SOURCE=1
     -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1
Linking: gcc   -L.  -L.       -Wl,-syslibroot,/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch x86_64 -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon      -lncurses -liconv -framework Cocoa    -fstack-protector -L
/usr/local/lib  -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -lruby.1.9.1 -lobjc -L/Users/chris/.rvm/rubies/ruby
-1.9.2-p290/lib

More Updates Updating the status line seems to change nothing. Still freaks out and has the same issue. Any other ideas?

Upvotes: 2

Views: 2851

Answers (2)

chrisjones
chrisjones

Reputation: 33

Looks like I finally got it figured out. Appears to have been a hardware/driver issue with Lion and my MBP. Lion 10.7.1 came out and since the update the issues have disappeared. I had a little weirdness with background colors, but as soon as I matched my terminal bg color to my vim color scheme, all has been peachy. Thanks to everyone for the suggestions.

Upvotes: 1

Greg Hewgill
Greg Hewgill

Reputation: 993163

This sometimes happens if vim and your terminal don't agree on the character encoding used. For example, if vim wants to draw a character using a multibyte UTF-8 sequence, and your terminal doesn't quite understand that and draws two characters, then vim and your terminal disagree about the resulting position of the cursor. This can lead to all manner of misdrawn screen elements.

Use the :set encoding command in vim to set an encoding that agrees with whatever your terminal is set up to use.

Upvotes: 2

Related Questions