Tuesday, June 5, 2012

Cursor Movement in Mac Terminal (Home and End Key in Linux)

In Mac Terminal, there is no default keyboard shortcut to move your cursor  back to the start of the line or forward to the end of the line. Let's customize our own keyboard shortcuts.

In this example, we will setup two new shortcuts.

  • "shift + cursor left" to back to the start of the line
  • "shift + cursor right" to forward to the end of the line

First go to Terminal => Preference
and choose the Keyboard Tab.

Hit the + button, set followings:

  • Key: cursor left
  • Modifier: shift
  • Action: send string to shell:
  • \001

Note that we should hold ctrl button and press a to produce \001 .
press OK.

Again, hit the + button, set followings:

  • Key: cursor right
  • Modifier: shift
  • Action: send string to shell:
  • \005

This time, hold ctrl button and press e to produce \005 .
Press OK.

Now, return to your terminal, and enjoy your new keyboard shortcuts.

No comments:

Post a Comment