OS X Terminal: "backward delete word" works only with C-M-h Followup on Mac OS X Terminal: Map option+delete to “backward delete word”.

The Use option key as meta key option is checked, but the deleting word backwards works only with ^-⌥-H (i.e. one has to also hold the ^ or Control key)! How can you backward delete a word with ⌥-H only? This annoyance happens only in Terminal.app ... and interestingly also in iTerm.app!

I also have this in ~/Library/KeyBindings/DefaultKeyBinding.dict, so that I can enjoy Emacs throughout:

{"~h" = "deleteWordBackward:";}




Environment: OS X 10.8.2 (12C54), Terminal 2.3 (309), iTerm
Settings in DefaultKeyBinding.dict don't apply to the shell views in Terminal or iTerm 2.

You can make M-h delete a word backward by adding this to ~/.inputrc

"\eh": backward-kill-word


M-h is bound to mark-paragraph by default in Emacs though.

If others search for how to make ⌥⌫ delete a word backward, just enable using option as a meta key:


In Terminal, check Settings > (your profile) > Keyboard > Use option as meta key
In iTerm 2, set the option keys to act as "+ Esc" in Profiles > (your profile) > Keys


If others search for how to make ⌥⌦ delete a word forward, you can make it insert \ed:




⌥⌦ inserts \e( by default in Terminal and \e[3~ in iTerm 2, so you could also add "\e(": kill-word or "\e[3~": kill-word to ~/.inputrc.