Super User is a question and answer site for computer enthusiasts and power users. 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

I'm having trouble trying to map the alt-key bindings on vim in iTerm2. I want to map shortcuts for switching between buffers like this:

map <A-Right> <C-w>l
map <A-Left> <C-w>h
map <A-Down> <C-w>j
map <A-Up> <C-w>k

But I can't get it to work. I've tried everything, setting the option key as "Normal", "Meta" and "+Esc" in the profile settings. I've tried <M-Right> and <T-Right> but those don't work either. There are posts on superuser and stackoverflow but they use the old version of iTerm2 (v0.x).

The only things I've managed to get working are <T-up> and <T-down>, or when I just use Macvim.

I'm using iTerm2 v1.0.0.20120203, and Mac OS X 10.7.5 on a Macbook Pro.

share|improve this question

See this answer of mine on a similar question. My advice is to use :h mapleader.

share|improve this answer

Since Mac OS X uses the option key to insert characters, regular <A-[key]> mappings won't work. Thus :h i_CTRL-V becomes your friend. Your right arrow mapping, for example, can be typed like this:

mapcontrolVoption<C-w>l

This will result in what looks like:

map ^[f <C-w>l

Note, however, that you can't copy and paste the above, as ^[ is one character in vim, but is here represented with two characters. Most vim users would suggest, however, that you not use the arrow keys for this (or anything). I use map <C-l> <C-w>l (and likewise for h, j, k) instead, as it keeps my hands on the keyboard.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .