Reference: Control-arrow keys in screen, SSH, etc.

I’ve often had trouble with the keybindings Control-Leftarrow and Control- Rightarrow not doing what I want on “nonstandard” terminals: SSHing into Macs, some GNU screen instances, etc. I think the basic issue is that there are several ways to bind these keys, and some systems don’t have systems set up to cover all of the cases. Here’s the ~/.inputrc file that does the trick for me:

"\e[5C": forward-word
"\e[5D": backward-word
"\e[;5C": forward-word
"\e[;5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
Meta-.: yank-last-arg
Meta-_: yank-last-arg

With a bonus explicit binding of Alt-period, which is also sometimes missing. In my explorations I discovered that for SSHing into OS X / Darwin computers, the third pair is the one that’s relevant.

Questions or comments? For better or worse this website isn’t interactive, so send me an email or, uh, Toot me.

To get notified of new posts, try subscribing to my lightweight newsletter or my RSS/Atom feed. No thirsty influencering — you get alerts about what I’m writing; I get warm fuzzies from knowing that someone’s reading!

Later: Reference: How To Root an HTC Nexus One Running Android 2.3.6 on Linux

Earlier: Reference: Converting bitmaps to EPS efficiently

See a list of all posts.

View the revision history of this page.