How to get Ctrl-Arrow to work in Bash on Mac OS X
5388 days ago
I am used to using Ctrl-Left Arrow/Ctrl-Right Arrow to move quickly word-by-word on the Bash command line. I kept having an issue with it not working in Mac OS X, however.
Finally I dug in and found out the problem: you need to map the key sequence Terminal.App sends for Ctrl-Left/Right Arrow to forward-word and backward-word. Here’s how to do it; add these lines to your ~/.inputrc file (create the file if it doesn’t already exist):
”\e[5C”: forward-word
”\e[5D”: backward-word
”\e[1;5C”: forward-word
”\e[1;5D”: backward-word
and that should do it.