Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically, vim behaves strange under iTerm2 (it works normally in Terminal). It sets the cursor in a non existing lines, it displays garbage (content from other lines) when I try to edit a line in a file etc. It is completely useless :(

I changed "reported terminal type" to "linux" as suggested in some post, but it didn't help


  • iTerm2 version: Build (very latest)
  • running with env TERM=xterm vim and env TERM=xterm-256color vim does not help
share|improve this question
Did you try to run vim with TERM=xterm vim? – patrix Aug 20 '12 at 11:00
can you tell us which version of iTerm2 are your using? I am on Build (without TMux btw), and using vim VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02), and all works fine on iTerm2 – user1256923 Aug 20 '12 at 11:30
btw, I have report terminal type as xterm-256color, which is also specified in my bashrc as export TERM=xterm-256color – user1256923 Aug 20 '12 at 11:33
Can you upgrade iTerm2 to the latest version? – patrix Aug 20 '12 at 11:47
Had this problem with iTerm 2 + screen over RS232 – Max Ried Aug 20 '12 at 13:19
up vote 1 down vote accepted

Apparently, removing set lines=40 does the trick. The manual says:

    Number of lines of the Vim window.
    Normally you don't need to set this.  It is done automatically by the
    terminal initialization code

so be careful when you copy-paste ready configs, as I did :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.