6

Looking for a keyboard shortcut to select text in a browser (Chrome) till the end (or beginning) of a line.

According to Apple Support the keyboard shortcut

SHIFT-CMD-RIGHTARROW is meant to

Select the text between the insertion point and the end of the current line.

This works well in MS Word and text editors, but fails in web browsers. I am aware of the Emacs shortcut CMD-E (see this answer) - but this behaves differently: it will select the text till the next "line break character", not till the end of a visible line. I.e., if there is an "automatic" line break in the browser which is not because of a corresponding line break in the HTML source code, the Emacs-like command will select the whole block, typically until the end of the current paragraph, not only the text till the "visible line break".

In contrast, in-text editors or MS Word, SHIFT-CMD-RIGHTARROW will select text only till the end of the "visible line". It also works in text boxes in the browser (like the one you use to create a question or answer here), but unfortunately not in "normal web pages".

5
  • 2
    It does state "The behavior of these shortcuts may vary with the app you're using." in the section the shortcut is shown. Also, in general, the shortcuts shown in the Document shortcuts section of Mac keyboard shortcuts are meant for editable fields in apps that support the creation and editing of text documents, not HTML documents displayed in Browsers. Commented Feb 5, 2020 at 12:16
  • 1
    Thx. I still wonder whether there is a similar shortcut which would work in Chrome.
    – alex
    Commented Feb 5, 2020 at 12:31
  • 1
    There isn't, as that is not how Browsers work for the rendered HTML code. Commented Feb 5, 2020 at 12:32
  • 4
    You can select a word and then hold shift-option while pressing right arrow to continue selecting additional words. Commented Feb 5, 2020 at 12:46
  • 1
    Thx, I know this, but it is rather lengthy for long lines :-), still +1 ;)
    – alex
    Commented Feb 5, 2020 at 19:39

2 Answers 2

0

Some clarification according to AppKit's StandardKeyBinding.dict:

moveToBeginningOfParagraphAndModifySelection: is bound to Ctrl+Shift+A. (remember that move to beginning of paragraph is bound to ctrl+A?)

moveToEndOfParagraphAndModifySelection: is bound to Ctrl+Shift+E. (remember that move to end of paragraph is bound to ctrl+E?)

The only keyboard shortcuts that are bound to moveToLeft/RightEndOfLineAndModifySelection: are Ctrl+shift+left/right and Cmd+Shift+Left/Right. If they both don't work it may mean that the html/js editor is intercepting(and discarding) them, so you will not be able to perform that without monkeypatching the editor. You can try binding this method to other key combos using DefaultKeyBinding.dict so that it is less likely to clash with the customized web editor. You can also use NSRepeatCountBinding to multiply (cumulative x4 on every keystroke) your repetitive keystrokes if Opt+Shift+left/right becomes your only choice.

Also note that in NS text systems, paragraphs are different from lines. Paragraphs are typically separated by NEWLINE, lines are typically seperated by LINE SEPARATER or soft line breaks caused by reflow. Cmd+left/right move to borders of lines, while ctrl+a/e move to borders of paragraphs.

-1

Actually you can. The shortcut that works is SHIFT + CTRL + or .

In other words, CTRL instead of CMD, and it works exactly as expected.

But this drives me CRAZY, because I don't want to use different shortcuts across different apps on my mac... I'm desperately looking for a solution to make the original CMD+SHIFT+ARROW work on Chrome as well, if you have any idea how, please help!

5
  • Shift+Ctrl+←/→ makes no difference on my computer (Chrome v106.0 / Monterey v12.6) when trying to expand the selected text on a webpage. The only thing that helps, after selecting a few characters in the targeted text on a webpage with a mouse, is Shift+Alt++←/→ which expands selected text only one word at a time. This shortcut is also mentioned in one of the comments to the question.
    – Alper
    Commented Oct 13, 2022 at 10:12
  • This is weird... I have the same chrome and Mac OS version. Do you have the expected behavior of + + ←/→ on TextEdit? The ⇧⌥ word selection has always worked but its not what we want : (
    – lapin
    Commented Oct 15, 2022 at 2:05
  • Doesn't work on my Mac (12.6/Monterey) either... in my case, this shortcut is not doing anything. Sure, you are selecting web text? Not the address line or so...
    – alex
    Commented Oct 19, 2022 at 9:53
  • I would assume we have different keyboards, not being in the same part of the globe. Have you tried other unexpected combination of keys along with arrows to see if one of them matches the behavior? It's how I found ⌃⇧←/→ worked for my keyboard, only on webkit browsers and electron apps. Try alt control, command alt, command alt control, IDK, anything you can think of. If you find one that works, then you can solve the issue like I did with a third party software.
    – lapin
    Commented Oct 25, 2022 at 2:17
  • They are bound to moveToLeft/RightEndOfLineAndModifySelection: just like cmd+left/right. Also note that Apple internally has a distinction between lines and paragraphs , this binding will select to end of line rather than paragraph.
    – hym3242
    Commented Jul 4 at 16:27

You must log in to answer this question.

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