Cannot override ctrl + O keybinding

Steps to reproduce

  • from Preferences > Hotkeys, remap Navigate Back to ctrl + o
  • In an existing note, press ctrl + o

Expected result

Navigates to the previous note.

Actual result

It appears to insert a newline after the current line (the built-in functionality of ctrl+o) AND navigates back.

(Less reproduce-able but I’ve also notices that sometimes the hotkey doesn’t register at all and I have to press it multiple times)

Environment

  • Operating system:
  • Obsidian version:
  • Using custom CSS:

Additional information

It works fine for me. Do you still have this issue?

Yes, I tried to record a small gif of the bug. NOTE: the issue isn’t that I can’t assign to control+o, but rather that Obsidian is performing 2 actions when I press the hotkey.

I would expect that assigning a hotkey overrides the existing behavior.

ezgif.com-video-to-gif
I click into Test Note 1, but when I press ctrl+o, you see that it navigates back + inserts a newline

Let me know if you need any further repro instructions!

Another thing that puzzles me is that you say that ctrl-o is the built in behaviour of newline.
In Obsidian, ctrl-o is mapped to the quick switcher by default and there is no built in shourtcut for new line.

I’m on MacOS. The default hotkey for quick switcher is Command + O. Not sure if the ctrl+O has an equivalent on windows. The ctrl+o behavior is built-in to vanilla CodeMirror it seems. I can reproduce it in the demo here: https://codemirror.net/.

I would expect that Obsidian hotkeys take priority over the built-in codemirror keymappings and that they swallow the events, to avoid this issue.

Actually the ctrl-o hotkey is system-wide on macs; it’s one of several hotkeys left over from emacs navigation that are baked into the OS. It does not seem to be possible to reliably override these hotkeys, in my experimentation even overriding them at the System Preferences level is unreliable. I’m afraid that this is a hotkey that it’s unlikely is going to be consistently usable in any application that has a text entry field. It is possible that you could override it by manually editing your system-wide default keymap file, but I doubt this is worth that, and I’m not convinced it would work anyway.

So, I suspect this hotkey is not going to work. Sorry!

Also to note for anyone coming in to this conversation late: there is some confusion in this thread because the key called Command on Mac is often called Control on Windows. The terminology is very confusing, that’s some of the reason this was difficult.

Hi @mediapathic, thanks for clarifying! I hadn’t realized it was OS-level. And sorry to @WhiteNoise for not mentioning my OS originally.

My personal solution has just been to keep the ctrl+O and ctrl+I (navigate forward/back) keybindings but to enable VIM mode. It’s the behavior I was after anyway (since it matches the jumplist). This works since the OS doesn’t intercept the keybinding while in normal mode.

Feel free to mark this Bug as resolved. Thanks both of you!

1 Like