X

Text handling tips in OS X

You can greatly enhance the way you handle text in OS X with the use of a couple of extra modifier keys.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
4 min read

When typing up documents or entering data into forms or other text fields on your Mac, being able to navigate through the entered text can be exceptionally useful.

You might need to copy a section of text, delete it, rearrange words, or enter a new idea within a paragraph. While you can use basic arrow keys or the mouse to target your desired text, some options exist in OS X to make this easier.

By default, a basic text object is a single character in the horizontal direction, and a single line in the vertical direction. When you invoke an action using the cursor, it will target these objects. For example, when you press the arrow keys, you move the cursor over one character, or up one line in a text document.

In addition to merely moving the cursor, you can select and delete text as well. Hold the Shift key and press the arrow buttons, and you will be able to select text in the direction that the cursor travels, either one character at a time or one line at a time. The same action goes for deleting text, with the exception being that deletion only works in the horizontal direction (you cannot delete upwards).

The options in OS X that make text handling easier adjust this default behavior by redefining to the text cursor what it should identify as a basic text object. This can be done with both the Option and Command keys on the keyboard.

By pressing the Option key you change the definition from a single character in the horizontal direction to an entire word in the horizontal direction, and from a single line in the vertical direction to a whole paragraph. As a result, if you press the Option key and then tap the arrows, you will see the cursor jump to the beginning or end of whole words, or up and down to the beginning and end of paragraphs.

This is a great option to have for navigating around a paragraph, as it will place your cursor in convenient locations for editing. Furthermore, in addition to using the Option key for moving, you can also combine it with actions for selecting and deleting text. As you would hold the Shift key to select individual characters with the arrow keys, if you hold the Option key as well as the Shift key, then you will select whole characters or whole paragraphs in the direction designated by the arrow key. Likewise, by using the delete functions when holding the Option key, you can delete whole words either in the forward or reverse direction (keep in mind again that deleting does not work vertically).

Text scope diagram
By default a text object is one character, so the text cursor will move, delete, or select one character of text (red); however, by pressing the Option key you can expand this to a full word (green), or to a full line (blue). In this example the cursor is right before the 'T' in the word 'text.' Screenshot by Topher Kessler

In addition to using the Option key, you can also use the Command key in OS X for further modifying the definition of the object the text cursor acts upon. While the Option key acts on words and paragraphs, the Command key acts on entire lines of text in the horizontal direction, or the entire document in the vertical direction.

If you place your cursor in the middle of a paragraph, by holding the Command key and pressing the right arrow you will move the cursor to the end of the line, and if you press Command-down, then the cursor will move to the end of the document (the reverse happens if you use the other arrow keys). As with the other options, you can combine this with the Shift key to turn the area traveled by the cursor into a selection that you can then cut, copy, or delete; however, you can also quickly delete portions of lines by using the Delete key directly.

If you hold Command and then press Delete, the text from the point of the cursor to the beginning of the line will be deleted. However, unlike the option for removing individual words this will not work in the forward direction (pressing Fn-Command-Delete will issue a warning beep instead of deleting the entire line in the forward direction). Nevertheless, this one limitation can be overcome by first just selecting the text in the forward direction (Shift-Command-Arrow), and then pressing the Delete key on the selection.

These enhanced options are defined in Apple's Cocoa text-handling libraries in OS X, and are readily available to OS X programmers. As a result, most OS X programs make use of these libraries so these text-handling options should work and behave the same in most OS X applications.

Do you have any text-handling tips in OS X? If so, then let us know below in the comments.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.