Arrow keys in iTerm not working in vi/vim

I found myself pretty darned frustrated when my arrow keys didn't work in iTerm in vi/vim or other ncurses-based applications. However, give this a shot in an iTerm if you find yourself in the same predicament:

export TERM=linux

Then open something in vi/vim or run an ncurses application. It should let your arrow keys work normally now. To make the setting stick, just do this:

echo "TERM=linux" >> ~/.profile

Printed from: http://rackerhacker.com/2007/05/31/arrow-keys-in-iterm-not-working-in-vivim/ .
© Major Hayden 2012.

1 Comment   »

  • Lee says:

    You can also do set term=linux in your .vimrc I found export TERM=linux changed the default syntax highlighting in vi to something I didn't like

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this