Mac OS X Terminal: Map option+delete to "backward delete word"
Enable option key as meta key
- Go to
Terminal
>Preferences
>Profiles
>Keyboard
- Check
Use option key as meta key
.
Image
On macOS High Sierra 10.13.6, captured on October 23, 2018.
Notes
Many applications (including bash and tcsh) treat Meta-Delete as "backward delete word."
OS X's terminal runs bash, which includes readline support. Follow Glomek's advice and tell terminal to use option as meta key (or else use Esc) and then you've got a bunch of handy options: Ctrl+w deletes prev word (as does Meta+delete as mentioned), but you can also use Meta+f and Meta+b to walk forward and backwards thru words, Ctrl+a and Ctrl+e to beginning and end of line, Ctrl+k delete (kill) from cursor to end of line, and a bunch more.
See http://www.bigsmoke.us/readline/shortcuts for a nice little reference table.
Delete a word going back:
Ctr-w.