Sometimes the small things make a big difference. I noticed that the control-left and control-right keys weren’t working in bash or Emacs on my FreeBSD box accessed over X11.app on OS X. Easily fixed.
.inputrc
"\e[1;5C": forward-word # Ctrl+right => forward word "\e[1;5D": backward-word # Ctrl+left => backward word
.emacs
(global-set-key "\M-[1;5C" 'forward-word) ; Ctrl+right => forward word (global-set-key "\M-[1;5D" 'backward-word) ; Ctrl+left => backward word
wow. is that standard on most shells?
Thanks, this helped me a lot.
Words cannot explain how useful this is for someone struggling to get gnome-terminal behave nicely with emacs!
Also, typing Ctrl-V followed by the key combination (say Ctrl-up arrow) at the shell prompt (in bash) reveals the code.
for my mac, if fixed the arrow right left problem by
“\e[5C”: forward-word # Ctrl+right => forward word
“\e[5D”: backward-word # Ctrl+left => backward word
Things are alright now 🙂
Thanks for your help
Thank you soo much. Spent like half an hour trying to get this to work in emacs.
Thank you!
Thanks! This probably saved me an hour today.
Pingback: C- in MacOSX’s Terminal.app :: nklein software
On OSX 10.6 the Spaces feature can claim the control-arrow keys.
That can be changed in the Expose and spaces settings.
Also make sure in OSX that System Preferences>Keyboard>Shortcuts does not have a binding for Ctl-left / Ctl-right arrow (which appears to capture the keystrokes even Expose/Mission control have been turned off).
Thank you! This was driving me bonkers.
You rock. This has been driving me nuts for months.
Thanks! Thanks! Thanks!
Thank you very much.