2

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.

2
  • 1
    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
    Commented Jul 28, 2010 at 16:24
  • 1
    Add your own fix as an answer and accept it so others will know how to get it working as well.
    – Wuffers
    Commented Oct 27, 2010 at 23:49

2 Answers 2

0

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

0

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.

You must log in to answer this question.

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