Sub topic 6
Moving and selecting text faster
This chapter covers how to move the cursor and select text on macOS by character, word, line, paragraph, and document. It assumes you can already press modifier shortcuts such as ⌘C and ⌘V, and that you know the symbols ⌘ (Command), ⌥ (Option), ⌃ (Control), and ⇧ (Shift). The editing shortcuts from the earlier chapters are the foundation here.
The working model: unit, direction, and selection
Every cursor movement shortcut on the Mac combines three choices.
- Direction: left, right, up, or down, set by an arrow key.
- Unit: how far one press travels. The arrow key alone moves one character or one line. Adding ⌥ moves by a larger text unit, such as a word. Adding ⌘ moves to the edge of the whole container, such as a line or a document.
- Selection: adding ⇧ turns the same movement into a selection. The text between where the cursor started and where it ends up becomes highlighted.
Once you know this pattern, you do not need to memorize a long list. You pick a direction, widen the unit, and add Shift if you want to select.
The table below shows the pattern for the horizontal directions.
| Unit | Move left | Move right | Select left | Select right |
|---|---|---|---|---|
| Character | ← | → | ⇧← | ⇧→ |
| Word | ⌥← | ⌥→ | ⇧⌥← | ⇧⌥→ |
| Line | ⌘← | ⌘→ | ⇧⌘← | ⇧⌘→ |
The vertical directions follow the same idea.
| Unit | Move up | Move down | Select up | Select down |
|---|---|---|---|---|
| Line | ↑ | ↓ | ⇧↑ | ⇧↓ |
| Paragraph | ⌥↑ | ⌥↓ | ⇧⌥↑ | ⇧⌥↓ |
| Document | ⌘↑ | ⌘↓ | ⇧⌘↑ | ⇧⌘↓ |
The complete shortcut sheet from this tutorial looks like this:
⌥← Move one word left
⌥→ Move one word right
⌘← Move to start of line
⌘→ Move to end of line
⌘↑ Move to start of document
⌘↓ Move to end of document
⇧⌥→ Select to end of word
⇧⌘← Select to start of line
⌥⌫ Delete previous word
⌘⌫ Delete to start of lineMoving by word
Moving by word is the shortcut you will use most. Pressing ⌥→ jumps the cursor to the end of the current or next word. Pressing ⌥← jumps to the start of the current or previous word.
Suppose you typed this line and the cursor is at the end:
The quarterly report is due on Thursday.Pressing ⌥← three times moves the cursor back past "Thursday", "on", and "due". Holding ⌥ and tapping the arrow repeats the jump. This is much faster than holding ← and waiting.
What counts as a word
Apps decide for themselves where a word ends, so results differ slightly.
- Punctuation usually stops the cursor. In
file-name.txt, a text editor might stop at the hyphen and the period, while a word processor might not. - Code editors often treat
camelCaseorsnake_casepieces as separate stops. Plain text fields in Safari or Notes usually treat them as one word. - Trailing punctuation such as a period at the end of a sentence can count as its own stop in some apps.
If a word jump lands somewhere unexpected, the app's word rule is the cause. The shortcut itself is the same.
Moving to the start or end of a line
⌘← moves to the start of the line and ⌘→ moves to the end. In most apps, a "line" means the visual line on the screen after wrapping. In a long wrapped paragraph, ⌘→ goes to the end of the displayed line you are on, not the end of the whole paragraph. To reach the true paragraph edges, use the paragraph shortcuts ⌥↑ and ⌥↓.
Some text editors and code editors, such as Visual Studio Code, do something extra. The first ⌘← press goes to the first non-blank character on the line, and a second press goes to column one. If your cursor seems to stop short of the left edge, this is why.
Moving to the start or end of a document
⌘↑ jumps to the very start of the document and ⌘↓ jumps to the very end. This works in Pages, Notes, TextEdit, Mail, and most text fields. In a text field that holds only one line, such as a browser address bar, ⌘↑ and ⌘↓ behave like ⌘← and ⌘→.
Outside of text editing, the same keys have other meanings. In Finder, ⌘↑ opens the enclosing folder and ⌘↓ opens the selected item. On a web page where the focus is not in a text field, Space scrolls down and ⇧Space scrolls up. In a browser page, ⌘↑ and ⌘↓ jump to the top and bottom of the page.
Selecting text
Adding ⇧ to any movement shortcut selects the text it passes over. The selection has an anchor, which is where the cursor was when you started, and a moving edge, which is where the cursor is now. Each extra press moves only the moving edge.
This has a useful consequence. If you select too far, press the opposite direction with Shift still held to shrink the selection. Pressing ⇧⌥→ twice and then ⇧⌥← once leaves one word selected, not zero.
Common selection recipes:
- Select the word to the right of the cursor: ⇧⌥→
- Select from the cursor to the start of the line: ⇧⌘←
- Select from the cursor to the end of the line: ⇧⌘→
- Select the whole line when the cursor is in the middle: ⌘← followed by ⇧⌘→
- Select from the cursor to the end of the document: ⇧⌘↓
- Select everything: ⌘A
Selecting with the mouse as a supplement
The mouse also has quick selections that pair well with the keyboard.
- Double-click selects a word.
- Triple-click selects a paragraph in most apps, and a line in some.
- Click at one position, then hold ⇧ and click at another, to select everything between them.
After a double-click, you can extend by whole words with ⇧⌥→ or ⇧⌥←. This is often faster than dragging.
Deleting by unit
Deletion follows the same unit model, and it often replaces selecting first.
| Shortcut | Effect |
|---|---|
| ⌫ | Delete previous character |
| ⌥⌫ | Delete previous word |
| ⌘⌫ | Delete to start of line |
| fn⌫ | Forward delete (delete next character) |
| fn⌥⌫ | Delete next word |
| fn⌘⌫ | Not defined in most apps |
On a MacBook, the key labeled "delete" is the backspace key. Forward delete requires holding fn with it. Full-size Apple keyboards have a separate forward delete key (⌦) that does the same thing.
A typical fix of a mistyped word: press ⌥⌫ to remove it, then type the correction. This is two actions instead of a double-click and a retype.
A worked example: rewriting a sentence
Suppose a paragraph contains this sentence, and the cursor is at the end of it:
We will send the invoice on Monday, but payment is not expected until the following week.You want to change it to "We will send the invoice on Monday."
- Press ⌥← five times to move back to the start of "but". Count the words: "week", "following", "the", "until", "expected", "not", "is", "payment", "but". You can also press ⇧⌥← repeatedly while watching the highlight and stop when it covers ", but payment ... week." instead of counting.
- A faster way: use the selection form from the start. Press ⇧⌥← until the highlight begins at the comma after "Monday". Because the anchor stays at the end, you can see the selection grow.
- Press ⌫ to delete the selection.
- Type the period.
The idea is to hold Shift and tap the arrow, watching the highlight. You do not need to count words in advance.
Control-key shortcuts that work in many text fields
macOS text fields inherit some shortcuts from the Emacs editor. They use ⌃ and work in most native Mac text fields, including Notes, Mail, Messages, and Safari. They are useful because you do not have to move your hand to the arrow keys.
| Shortcut | Effect |
|---|---|
| ⌃A | Move to the start of the paragraph |
| ⌃E | Move to the end of the paragraph |
| ⌃F | Move forward one character |
| ⌃B | Move back one character |
| ⌃N | Move to the next line |
| ⌃P | Move to the previous line |
| ⌃D | Delete the next character |
| ⌃H | Delete the previous character |
| ⌃K | Delete from the cursor to the end of the paragraph |
| ⌃T | Swap the characters on either side of the cursor |
| ⌃O | Insert a new line after the cursor without moving it |
⌃K is useful for clearing the rest of a line without selecting it. ⌃T fixes a common typing slip such as "teh" in one press.
Two cautions apply.
- In some apps, ⌃A and ⌃E go to the start and end of the visual line, not the paragraph. In a wrapped paragraph, the result differs from ⌘← and ⌘→ only in some apps.
- Terminal and some code editors assign these keys to their own commands. In Terminal, for example, ⌃A and ⌃E move within the command line, and ⌃K deletes to the end of the command line, but ⌃T behaves differently.
Common errors and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| ⌘→ does nothing in a web page | Focus is not in a text field | Click inside the text first |
| The cursor does not stop where you expect on a word jump | The app has its own word rule | Use ⌥ with Shift to watch where the edge lands |
| ⌘← stops short of the left edge | The editor jumps to the first non-blank character first | Press ⌘← a second time |
| Arrow keys change the selection unexpectedly | A selection is active, and a plain arrow collapses it | Press ← to collapse to the start or → to collapse to the end |
| ⌥⌫ deletes a whole path segment or too much | The app counts punctuation as part of a word | Use ⌫ for single characters, or select first |
| Shortcuts do nothing in a custom app | The app handles keys itself | Check the app's menus and Help for its own bindings |
Note the fourth row. With text selected, pressing plain ← places the cursor at the start of the selection, and → places it at the end. This is a quick way to drop the selection without losing your position.
Practice routine
Use a text document of a few paragraphs and work through these steps.
- Press ⌘↑ to go to the top, then ⌘↓ to go to the bottom.
- Press ⌥→ ten times and watch where the cursor stops.
- Press ⌘← and ⇧⌘→ to select a full line, then press → to collapse the selection.
- Press ⌥⌫ three times to delete three words, then ⌘Z three times to bring them back.
- Press ⌃T on two letters to swap them, and ⌃K to remove the rest of a line.
Exercise
The cursor is in the middle of a long line. You want to replace everything from the cursor to the end of the line with new text, and you want to do it without using the mouse. Give two different key sequences that remove that text.
Show answer
Option 1: press ⇧⌘→ to select from the cursor to the end of the line, then press ⌫ (or just start typing, which replaces the selection). Option 2: press ⌃K to delete from the cursor to the end of the paragraph. Note that ⌃K works on the paragraph, so in a wrapped paragraph it can remove more than the visible line, and it does not work the same way in every app.
Exercise
You pressed ⇧⌥→ four times to select words, but the selection now includes one word too many at the right edge. Which key press fixes it without starting over, and why does it work?
Show answer
Press ⇧⌥← once. The selection has a fixed anchor where you started and a moving edge. Pressing the opposite direction with Shift held moves only the edge back by one word, so the selection shrinks by one word.
Exercise
With a word selected, you press ←. Where does the cursor end up, and is the selected text changed?
Show answer
The cursor moves to the start of the former selection. The selection is dropped, and the text is not changed or deleted.