Selecting text with the keyboard

Update 2021-01-26: This has been solved with a plug-in (see below):

There are a few missing keyboard shortcuts (on Apple devices, at least) for navigating and selecting text without having to use the mouse/trackpad. Specifically, what is missing are two of the ⌥⇧–Arrow commands.

  • Option–Shift–Up Arrow: Extend text selection to the beginning of the current paragraph, then to the beginning of the following paragraph if pressed again.
  • Option–Shift–Down Arrow: Extend text selection to the end of the current paragraph, then to the end of the following paragraph if pressed again.
    Option–Shift–Left Arrow: Extend text selection to the beginning of the current word, then to the beginning of the following word if pressed again.
    Option–Shift–Right Arrow: Extend text selection to the end of the current word, then to the end of the following word if pressed again.

These are taken from Apple’s list of Mac keyboard shortcuts.
⇒ there are really only two text-selection functions that are missing. So maybe this is not a feature request, but a minor bug?**

5 Likes

Yes please… … keyboard operation for most if not all functions in Mac/Win environments plus other OS.

1 Like

What you can do now:

ALT + left/right arrow jumps to the beginning / end of the paragraph, hold SHIFT if you want to select.
CTRL + left/right arrow jumps to the beginning / end of a word (and keep jumping word by word), hold SHIFT to select.

I thought I was going crazy today trying to use these shortcuts and they weren’t working. :slight_smile:

Is it possible to select current word under cursor via keyboards shortcut?
Or delete word under cursor via shortcut.

Recently, @ryanjamurphy has added a third-party plugin that takes care of this! (Thank you, thank you, Ryan!)

macOS Keyboard Navigation

This plugin restores default macOS keyboard navigation—specifically alt+↑ and alt+↓, and alt+shift+↑and alt+shift+↓—in Obsidian.

Get it in the Obsidian settings or from Github:

1 Like

There are also the (not well-known) standard macOS keyboard navigation shortcuts:

^a: moveToBeginningOfParagraph:,
^A: moveToBeginningOfParagraphAndModifySelection:,
^f: moveForward:,
^e: moveToEndOfParagraph:,
^E: moveToEndOfParagraphAndModifySelection:,
^k: deleteToEndOfParagraph:,
^F: moveForwardAndModifySelection:,
~^f: moveWordForward:, **
~^F: moveWordForwardAndModifySelection:, **
^d: deleteForward:,
^b: moveBackward:,
^B: moveBackwardAndModifySelection:,
~^b: moveWordBackward:, **
~^B: moveWordBackwardAndModifySelection:, **
^h: deleteBackward:,
^p: moveUp:,
^P: moveUpAndModifySelection:,
^n: moveDown:,
^N: moveDownAndModifySelection:,
^t: transpose:,
^v: pageDown:,
^V: pageDownAndModifySelection:,
^o: [insertNewlineIgnoringFieldEditor:, moveBackward:]

** For some reason, Obsidian uses ~f and ~b instead of ~^f and ~^b which is a bit of a pain.

You can also make your own in ~/Library/KeyBindings/DefaultKeyBinding.dicthere’s a reference
Obsidian (and other Electron apps) don’t respect any of the cursor movement keybinding commands so far as I can tell. They do respect things like insert_text:, "blah" and cut:, copy:, paste: though.

I appreciate coming across this, but it’s just opposite to how other iOS apps work. That is, alt → moves the insertion point forward by a word, alt ← sends it back a word. Using Control → and Control ← just for Obsidian is rough! Is there a way to reverse this behavior?

In Windows, it works with CTRL in any software, but it should have a way to modify every hotkey in the settings.

Did you find out how to make the Obsidian’s cursor move word-by-word? I really use this, much more than jumping to the top of the whole document.