Hello! One of the standard keyboard shortcuts that work across all text fields in MacOS is option (or “alt”) + up/down arrow. It moves the caret to the beginning or end of the current line. It can also be used together with shift to select all the text from the current position to the beginning/end of the line.
For some reason these standard commands don’t work in the Obsidian editor. Normally these commands just work everywhere where there is keyboard input in the OS, so I’m guessing there is some unused command that Obsidian picks up but that isn’t used, which prevents the default behavior? All other standard text editing commands that I’ve tried, such as ctrl+T, work as they should.
As often is the case with keyboard commands, you don’t really notice how much you use them until they stop working - they become a completely instinctive part of inputting text. So it is very disruptive when they’re not supported.
I am on MacOs 10.14 and was not aware of Alt+up/down arrow to go to the beginning/end of the line. It works in some situations, like on this forum, but not on Discord.
The one that always works is Cmd+left/right arrow.
It’s standard behavior, so it works by default “everywhere”. Of course various software may have overridden the behavior on purpose or by mistake, so I wouldn’t read too much into what Discord in particular does. As far as I can tell Obsidian doesn’t do anything useful in reaction to the command, so it just feels like a bug.
For what it’s worth, cmd+left/right arrow and option+up/down don’t do the same thing. They behave differently with line wrapping, and when invoked repeatedly.
I’m on MacOS 10.15.5 at the moment, and in response to your comment about Discord I got curious how widely supported it is - so here’s a quick survey of a few places in the system and whether it works:
- Text Edit - works
- Editing a filename in Finder - works
- Help menu search field - works
- Notes - works
- Spotlight search - works
- Composing in Mail - works
- Typing commands in Terminal - doesn’t work, up/down is mapped to command history
- Safari search/URL field - works
- Stickies - works
- Dictionary search - works
- System preferences search - works
And a few 3rd party apps I happen to have open:
- Slack - works
- Chrome search/URL field - works
- Firefox search/URL field - works
- Figma text objects - works
- Fork - works
- Obsidian - doesn’t work
I think it’s safe to say that it’s the expected and standard behavior, and unless there’s a good reason to do otherwise, an app where typing is at all important shouldn’t mess with the defaults.
I did not refer to MacOS apps, it’s clear that a Mac keyboard shortcut works on all its apps. I agree that my statement was not clear enough.
In any case, in all the situations I use Cmd+left/right arrow I only ever see the cursor jump to the beginning/end of line. I have not noticed any line wrapping action, but maybe I misunderstand you.
In any case, what’s wrong with using Cmd+left/right arrow on Obs?
Alt+down jumps to right before the next newline, and alt+up jumps to after the previous newline, even if the line is wrapping.
There’s certainly nothing wrong with using cmd+left/right, if that’s what you’re used to! But that’s not really relevant to a different standard system-wide shortcut with decades of habitual use built up, being missing without clear reason.
I believe this is the same issue that caused this problem: macOS Text Replacement doesn't work
Electron and native OS features rarely play well together, unfortunately.
Maybe, but both Figma and Slack are based on Electron as far as I understand, and they both seem to support it. But perhaps they do something special. I now tried in Teams, which is also Electron, but they have these two shortcuts mapped to quickly switching between things in the sidebar, so it doesn’t say that much about Electron.
As with @tor, I expect the option-up and option-down combinations to move the text cursor to the beginning or end of the current line. I also find it jarring when this behavior isn’t supported, especially because Obsidian is Markdown-based and thus I am writing in paragraphs.
It would be really great if this was a way for this to work with Obsidian, I also just checked with Slack (also electron), and it works there.
@apgold: I have a MacBook Air, and instead of Cmd+arrow up/down I do fn+arrow up/down and it scrolls in both Edit and Preview.
Cmd+arrow up/down in both Edit and Preview takes me to the top/bottom of the note.
Unfortunately, on an iMac (with magic keyboard), both cmd and fn+arrow up/down do partial page scroll in Edit mode and nothing whatsoever in Preview.
I have figured out how to provide these keyboard shortcuts with a new third-party plugin.