Get control-left and control-right to move between words on Mac OS X

The default key bindings on OS X really annoy me to no end.  The strange behaviour of home/end continue to confound me, but I finally figured out how to get Terminal, iTerm and iTerm2 to allow me to go between words using control-left and control-right. There are ways to do this by mucking around in various menus, but if you use bash, the simplest way is to add this to you ~/.inputrc file. It adds a bunch of different possible codes that various mac terminals might try to send instead of what bash normally expects for control-left and control-right.

I still haven’t been able to fix this in non-terminal things (e.g. in Chrome control-left sends me to the beginning of the line), but I suppose this is a start!


chef:~ vijayp$ cat ~/.inputrc
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *