Tuesday, 21 August 2012

OSX Terminal: alt-left jump word ctrl-left go to start and more

By default OSX Terminal doesn't let you use many standard OSX text-editing shortcuts. For example, CMD or Control Left normally jumps to the start of the line. Alt-left jumps left one word. Also forward delete doesn't work.

Happily it's possible, though slightly confusing, to add these shortcuts back.

Here's how:
  • Open Terminal Preferences
  • In the Settings Pane, select Keyboard


  • Click the + button



  • Now let's add those shortcuts back.
For jump-to-start-of-line:
  • Key: Cursor Left
  • Modifier: Control
  • Action: send string to shell: (the default)
  • Click in the empty white box and press CTRL-A. \001 will appear
For jump-to-end-of-line:
  • Key: Cursor Right
  • Modifier: Control
  • Action: send string to shell: (the default)
  • Click in the empty white box and press CTRL-E. \005 will appear
To re-activate forward delete
  • Key: forward delete
  • Modifier: none
  • Action: send string to shell: (the default)
  • Click in the empty white box and press CTRL-D. \004 will appear
To move forwards one word at a time
  • Key: cursor left
  • Modifier: option
  • Action: send string to shell: (the default)
  • Click in the empty white box and press Escape+b. \033b will appear
To move backwards one word at a time
  • Key: cursor right
  • Modifier: option
  • Action: send string to shell: (the default)
  • Click in the empty white box and press Escape+f. \033f  will appear.


I find adding these shortcuts in makes terminal much more usable. 


1 comment: