Monday, February 28, 2005

NSTextField Shortcuts

News Item

After having hit a few keys I expected to work and, to my surprise, they did, here’s a list of what shortcuts you get in Mac OS X’s standard NSTextField object (which is to say, Mac OS 9 shortcuts combined with a subset of emacs shortcuts):

CTL-OMove to the previous line
CTL-NMove to the next line
CTL-BMove to the previous character
CTL-FMove to the next character
OPT-←Move to the start of the current or previous1 word
OPT-→Move to the end of the current or next1 word
OPT-↑CTL-AMove to the start of the current or previous1 paragraph
OPT-↓Move to the end of the current or next1 paragraph
CMD-←CTL-←Move to the start of the line
CMD-→CTL-→Move to the end of the line
CMD-↑Move to the start of the document
CMD-↓CTL-VMove to the end of the document
SHIFT + anythingSelect while moving
DeleteCTL-H2Delete the previous character
Forward delete3CTL-DDelete the next character
OPT-DeleteDelete previous word
OPT-Forward DeleteDelete next word
CTL-KCut from insertion point to the end of the line
CTL-TTranspose the characters around the insertion point
ReturnCTL-ONew paragraph

If you never use the Option key for writing international text, you can also drop a file in your Library to add meta-key shortcuts to mimic emacs more fully. You can, of course, hack the file to add your own shortcuts to all programs that use this kind of text field (most of them).

1 Control-key shortcuts do not operate on next/previous items, only command/option shortcuts do.

2 Technically, these are the same thing to the computer.

3 On portables, fn+Delete is forward delete.

codepoet's blog 2/18/05 6:00 PM