How to make command+delete delete a word backwards instead of to beginning of the line

dictionarykeybindingskeyboardpreferencessettings

I tried putting this in my ~/Library/KeyBindings/DefaultKeyBinding.dict:

"@\U0008"  = "deleteWordBackward:"; /* Cmd  + Backspace */

When I log out and log back in, but it still doesn't work. command+delete (as labeled on my Macbook keyboard) still deletes to the beginning of the line. I also tried

"@\UF728"  = "deleteWordForward:"; /* Cmd  + Delete */

and in that case command+delete still deletes to the beginning of the line. If I'm not mistaken, the "delete" key on my Macbook Pro Retina is what the comment in the example refers to as "Backspace", and there is no actual "Delete" key on the keyboard.

I was able to successfully change command+arrows to move word by word instead of to the beginning and end of the document by doing

"@\UF703"  = "moveWordForward:"; /* Cmd  + RightArrow */
"@\UF702"  = "moveWordBackward:"; /* Cmd  + LeftArrow */

so I know that at least some bindings are working, among others. I just can't get command+delete to delete back a word.

Best Answer

This works for me on an iMac:

"@\U007f" = ( deleteWordBackward:);