I just installed Leopard and after setting up option left / right arrow in iTerm, I realized that option+delete did not kill the word to the left of my cursor. I think this somehow worked in my old pre-leopard setup, although I had done nothing to set it up.

After lots of searching, I could find no easy way to map iTerm keys to backwards-delete-word because iTerm doesn’t seem to support multiple key sequence bindings. There are two ways you can backwards delete a word out of the box with iterm:


Esc, Ctrl+h or Esc, Delete

Finally, using some unix trickery, I got option+delete working. First, I used the bind command to map Esc, d to backwards delete word. Edit ~/.bash_profile in your favorite text editor and add the line:

bind ‘“\M-d”: backward-kill-word’

(Make sure you have all those quotes, otherwise it doesn’t work.)

Now that you have an escape sequence that doesn’t require the Ctrl key, you can map option+delete to it in iTerm.

In iTerm, go to Bookmarks > Manage Profiles. Choose Keyboard Profiles > Global and click the + button to add a key binding. Choose delete from the dropdown, check the option checkbox, and then in the Action: dropdown choose escape sequence. In the text field that appears, type d. I also checked the High interception priority checkbox for good measure.

Hit OK and you’ll notice option+delete now deletes the word to the left of your cursor. Sweet!