Weird rendering artefact in vim (terminal, not MacVim)

7

Running Mac OS X, using either Terminal.app or iTerm2, there is a strange artefact with the character rendering that I have a hard time explaining and an even harder time understanding. I'll start with a video of my screen so that you can see and example of it in action:

Strange terminal vim rendering

From the video you can see a few ways it is weird, for example, sometimes when I hit a letter in insert mode, the character is double printed. When I go into normal mode, the artefact remains. When I re-enter insert mode, hitting backspace copies the characters on the left to the position under the cursor.

This has happened in OS X Lion, and Mountain Lion, under both Terminal.app and iTerm 2. This never happens under MacVim.

Also, I use GNU/Linux on my other machine, and have never had this happen, I am pretty sure it is strictly a Mac OS X issue, but I do not know how to fix it. For a while, I've been working around it by using MacVim most of the time, but I prefer working in a terminal.

Does anyone know what is happening here, and if so, how can I fix it?

EDIT: I tried using the macvim Vim executable, and I still get strange artefacts, but they are localized to the left side of the screen, here is an example:

enter image description here

tlehman

Posted 2012-10-28T19:57:07.783

Reputation: 253

What encoding do you use? In Vim and in the terminal? What is your $TERM? What font do you use? Does it happen when you use nano or some other CLI text editor? What is the version of Vim? Did you compile it? And your animated GIF doesn't seem to work embedded. – romainl – 2012-10-28T20:33:39.790

Encoding: UTF-8, $TERM=xterm-256color (in terminal) and dumb (in MacVim). Font is Inconsolata, size 18. About nano, I have not been able to reproduce the same problem in nano. Both versions of vim are 7.3. And I compiled MacVim using the homebrew package manager, but console vim is system default, I didn't compile that. – tlehman – 2012-10-29T02:33:48.063

I think that Homebrew overwrites the system Vim. Are you sure that you are using the default Vim and not MacVim's CLI executable? – romainl – 2012-10-29T06:39:31.090

I am sure I am using the default vim, and not homebrew's vim. For one, which vim gives /usr/bin/vim. Also, ls -l /usr/bin/vim shows that it is not an alias to something in /usr/local/bin which is what Homebrew uses. And finally, the modified date on the /usr/bin/vim file is before I installed homebrew, so it is definitely the system default. – tlehman – 2012-10-29T19:32:59.517

Ok, do you see the same behaviour when you use the Macvim executable in the terminal? – romainl – 2012-10-29T20:10:34.200

How do I use the macvim executable? – tlehman – 2012-10-29T20:11:52.687

From the path you gave in your previous comment I'd try $ /usr/local/bin/MacVim.app/Contents/MacOS/Vim. – romainl – 2012-10-29T20:15:58.440

I found it in /usr/local/Cellar/macvim/7.3-65/MacVim.app/Contents/MacOS/Vim, I'll use that, and I'll update this in a little bit. – tlehman – 2012-10-29T21:39:15.487

Answers

0

Total shot in the dark: do you have the following line in your ~/.vimrc?

set list listchars=tab:\ \ ,trail:

Try commenting it out with a " at the beginning of the line and restarting vim.

I picked it up from somebody's dotfiles repo and haven't had a chance to track down why it's causing problems.

I'm running iTerm2. My $TERM is xterm. Hope that helps.

drhayes

Posted 2012-10-28T19:57:07.783

Reputation: 101

0

This may be related to getting the Git branch to put in status line using the following function in ~/.vimrc:

system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'")`

jimmay5469

Posted 2012-10-28T19:57:07.783

Reputation: 101