Home > Uncategorized > Ctrl-left in bash on OS X

Ctrl-left in bash on OS X

October 26th, 2011

I finally got my MacBook Pro for work a couple weeks ago and found out how much I actually depend on using ctrl-left and ctrl-right while in bash to move back and forth between words. Yes, I should probably set bash to be in vi mode, but emacs mode is how I learned so why change?

On my MBP that combination does not work. I have no idea what combination it defaults to, but since I constantly bounce between linux machines and this laptop it should be exactly what I’m used to. Thanks to Labrat’s blog post Making BASH’s ctrl-left arrow work on OSX I know now to go to Terminals’s preferences to change this. Once in Settings go to the Settings panel (yes, you read that right) and select the Keyboard tab. The first two entries for Key/Action mappings are for “control cursor left” and “control cursor right”. Double click on each and change the entries to \033b and \033f respectively (hold Esc down for \033).

Edit: I forgot about Spaces which likes “^ Arrow Keys” for switching between spaces. I had to remember to change this to avoid conflicts.

Tags: ,
Comments are closed.