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

Using vim through terminal in OS X, I don't seem to be able to bind meta-backspace to delete a word.

I'm using xterm-color, delete sends ctrl-h, and I have 'Use option as meta-key' checked. This works well for everything else.

^w does the same thing in vim, but my fingers are trained to use option-backspace (delete key on mac keyboards).

In vim through the terminal, if I type i then ^v then meta-backspace I get nothing. In MacVim, I get , which is correct. So it seems to be a terminal encoding problem. Any help is appreciated, I can't imagine I'm the first to try to do this, although there are enough issues with backspace in terminal that it makes googling difficult.

share|improve this question
OK, here's what I did: In Terminal's preferences, under keyboard, check "Use option as meta." Then under Advanced, check "Delete sends Ctrl-H." In your .vimrc, add the following: imap ^[^? ^W – Bingaman Jul 28 '10 at 16:24
Add your own fix as an answer and accept it so others will know how to get it working as well. – Wuffers Oct 27 '10 at 23:49

I had a similar problem with lynx. I don't have Delete sends Ctrl-H activated and I can get the option-backspace working fine. You might try switching that first. Otherwise, you might look at what I did to get lynx working the way I wanted it to:

Configuring lynx

share|improve this answer

Since using Option as Alt key keeps you from using all the funky special characters which are available through Option key combos, I have got used to using Esc as my Alt key.

Internally, one of the ways for example Alt-X is presented to applications running in the terminal is Esc (ASCII 27) followed by X. On machines having no Alt key, you can therefore send an Alt combination by typing (not holding) Esc, followed by the other key.

See :h timeout if your Vim still does not recognize your command.

share|improve this answer

You must log in to answer this question.

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