16

I am looking for a keyboard shortcut that selects the full line (i.e., the text of the line) of the blinking caret cursor in any editable, multi-line text field. Nothing more than just this one line should be selected.


I understand that one can use the following two keyboard shortcuts in succession to accomplish this:

shift +

shift +

However, this does not work in all applications. That is, sometimes this combo highlights the current line plus the previous line, minus the first character of the previous line.

2
  • Command–Left Arrow, Command–Shift–Right Arrow May 29, 2017 at 4:31
  • Great. Do you want to post that as an answer? May 29, 2017 at 6:21

4 Answers 4

19

To select an entire line of editable text, assuming a left justified language...

If the insertion point cursor is at the beginning of the line, press:

  • Command–Shift–Right Arrow ⌘⇧➡

If the insertion point cursor is at the end of the line, press:

  • Command–Shift–Left Arrow ⌘⇧⬅

If the insertion point cursor is at any other part of the line, press:

  • Command–Left Arrow, Command–Shift–Right Arrow ⌘⬅ ⌘⇧➡

    Note that in this previous key sequence set, that you can keep the ⌘ key pressed while pressing/releasing ⬅ then press ⇧➡ so as to eliminate pressing/releasing the ⌘ key twice.

See the Document shortcuts section in Mac keyboard shortcuts.

1
  • 3
    You can actually hold both ⌘ and ⇧ keys from the beginning and press ← then → no matter where the cursor is. You might think you will only select part of the line this way, but you will actually select it all since macOS does not replace the selection but extends it. Just try it.
    – zh.
    Dec 10, 2021 at 11:06
3

To move the cursor to the start/end of the line, you can use ⌘← and ⌘→.

To select whilst moving the cursor, add ⇧. You need to move the cursor to one end of the line first using ⌘← or ⌘→, then hold ⇧ and use the opposite ⌘→ or ⌘←.

2

It depends what you mean by a "line".

In TextEdit for example, long lines are automatically soft-wrapped inside the window.

To select the part of a long line where it's wrapped to a single row:

Hold Shift + Command, press then .

To select an entire line, between line breaks (aka a paragraph):

  • If the cursor is at the end of the line:
    1. Optionally, to include the newline at the end of the line, press right-arrow.
    2. Press Shift + Option + .
  • Otherwise:
    1. If the cursor is in the middle of the line, press Shift + Option + .
    2. Press Shift + Option + .
    3. Optionally, press Shift + Option + again to include the newline, if the following line is blank. If not (or even if so), release option and press right-arrow.
2
  • Not sure if something changed on macOS but the instructions for "cursor at middle of line" don't quite work for me (Ventura): pressing ⇧ +⌥ + ↑ will select everything from cursor to start of line. Fine. But ⇧ +⌥ + ↓ will then select everything from cursor to end of line instead of the original selection. It works if you don't use shift in the first shortcut. So: ⌥ + ↑ and then ⇧ +⌥ + ↓
    – Christoph
    Oct 24 at 9:09
  • @Christoph I just tested it in TextEdit in Sonoma 14.1.1, and my instructions work as stated. I can't reproduce the failure you describe. Your suggestion also works though. Nov 20 at 17:59
0

From any position of current line:
hold Shift+Command, hit→ then←, or hit← then →

4
  • How does this differ or improve on from the other answers
    – mmmmmm
    Jul 28, 2021 at 10:27
  • 1
    Key is "any": no need for the thought process of determining cursor position, a split second saved.
    – user36083
    Jul 29, 2021 at 16:13
  • 1
    Just noted that the accepted answer did converge to the same way. But still, there is absolutely NO need to think about the cursor at all.
    – user36083
    Jul 29, 2021 at 16:16
  • This solution is better (more concise) than apple.stackexchange.com/a/285129/403240 but it also only selects the line as it currently is soft-wrapped in the editor. If you want the entire line until a real line break (newline character) do ⌥ + ↑ and then ⇧ +⌥ + ↓ unless you are already at the beginning of the line, in which case you skip the first shortcut.
    – Christoph
    Oct 24 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .