Vim's cursor keys work in Mac OS X again

export TERM=linux

Ever since my Macbook died and was fixed again Vim hasn’t worked properly in iTerm.

I’m a big fan of SSH and Screen. SSH to connect to a remote server, and Screen is like a workspace organiser for your SSH session.

First of all the backspace key worked in Vim even when not in insert mode, but worst of all, the cursor keys refused to work and only succeeded in ringing bells in the terminal. Previous attempts at fixing the problem failed but I must have searched for the right terms this time. This review of Mac OS X led me part of the way. Sébastien recommended setting the TERM to “dtterm” but Screen didn’t recognise that. Setting it to “linux” fixes my SSH sessions, and also fixes Vim locally as well!

I added the snippet of code above to my ~/.bash_profile to make the change permanent and everything is back to normal now! I have a vague memory of fixing this before but I wish now I had blogged it then!

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close