views:

579

answers:

2

I love cocoa style keyboard shortcuts and am constantly frustrated that Terminal doesn't behave in the same way. Does anyone know how to set common cocoa-style keyboard shortcuts in Terminal.app?

I found a blog post that describes how to do this in iTerm: http://blog.jcoffin.com/2008/12/06/mac-keyboard-shortcuts-iterm/. However, I like Terminal.app better for a number of reasons.

Terminal.app allows you to define custom keyboard shortcuts, but it doesn't let you use the command key. It also doesn't let you define a key for "delete", but for some reason allows "forward delete" (?).

The main ones I want are:

  • Option + left/right arrow for moving the cursor a full word
  • Command + left/right arrow for moving to the start/end of a line
  • Option + delete for deleting a full word
  • Command + delete for deleting a line

If I could just have these I would be happy :)

+1  A: 

You could use the ones from Unix terminal (shell), I think they work the same in Terminal app:

  • full word forward: Esc-f
  • full word backward: Esc-b
  • end of the line: Ctrl-e
  • beginning of the line: Ctrl-a
  • delete full word (cursor at the end of the word): Esc-Backspace (Mac Delete?)
  • delete the whole command line: Ctrl-c
stefanB
+3  A: 

I followed the instructions in this blog post from Allan Odgaard (of TextMate fame) to set up:

  • opt-arrow for word-movement
  • ctrl-arrow for moving to start/end of the line (though, to be honest, I end up using ctrl-a and ctrl-e much more often)
  • forward-delete (based on this comment which says to map it to ctrl-opt-d)

You can also check the "Use option as meta key" item to get opt-delete to perform word-deletion.

Unfortunately, as Allan says, you cannot bind to the normal delete key, nor can you use the Command key as a modifier.

Kelan