Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Add custom keyboard shortcuts in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add custom keyboard shortcuts in Terminal
Authored by: feold3 on Oct 23, '10 07:36:06AM

I came looking for this hint after it appeared in the November 2010 Macworld. It works as described, but not for the reasons described. For starters, \033 is not the control code for Option (as you stated), it is the control code for Escape.

When you create a keystroke shortcut in Terminal you select the primary key that will trigger the shortcut (an arrow key in this case) from the top drop-down, a modifier key (Option in this case) from the second drop-down, the desired action (Send to shell in this case) from the third drop-down, then you enter what it is you want to send to the shell in the text box. In most cases the "what to send" will be a control code. The control code for Escape-b (one word back) is \033b, and for Escape-f (one word forward) it is \033f.

What you are creating is a shortcut that says "When I press Option-left arrow, send Escape-b to the shell" and "When I press Option-right arrow, send Escape-f to the shell".

It isn't necessary to do the "backslash-left arrow-forward delete" shuffle in order to enter the control code for Escape in the text box, although that method is often described. Just press the Escape key. That isn't true for most other control codes, which do require the "backslash-left arrow-forward delete" shuffle.



[ Reply to This | # ]
Add custom keyboard shortcuts in Terminal
Authored by: asmeurer on Oct 23, '10 11:43:49AM

I think when I originally submitted this hint, I didn't notice that the escape key for option is exactly the same as for escape. Anyway, I think the method I describe will still be necessary if you want to enter some other special character (like a Null character or something, or, obviously, the forward delete character).

And I guess I will have to go buy a copy of the November 2010 MacWorld if my hint is appearing in there :)



[ Reply to This | # ]