Use case or problem
The lack of emacs bindings has always been a pain point, but I opted to try and ride it out. Unfortunately, nearly a year of daily use later, it’s still a source of friction in my workflow.
I decided to be proactive and build a plugin to address this, with some success. Unfortunately, I ultimately found that even by setting Prec.highest()
on my CM6 extension, my chorded keymapping plugin still comes in second place after the built-in global hotkey handling on obsidian.
This means that certain critical bindings like Control a
, Control y
, and the arrow keys are unavailable. I completely understand not wanting to add the complexity of chorded key management as a built-in feature, but without providing a way for plugins to (opt into) a first pass at the key events, obsidian currently makes it impossible to add this feature as a plugin.
Besides this handful of (unfortunately impossible to ignore) unavailable hotkeys, the solution I’ve built around @replit/codemirror-emacs is doing a great job.
Proposed solution
Use Prec.high
instead of Prec.highest
for the builtin hotkey handler, or otherwise provide an alternate API method for registering extensions to appear at Prec.highest
along with the builtin extensions but listed before them.
Current workaround (optional)
I’ve been unable to find one short of decompiling obsidian and making the above changes, or perhaps trying to subvert Obsidian’s editor management by triggering a reconfiguration transaction from another editor extension.
I briefly tried to explore this idea via API.registerCodeMirror
but found that it seems to be completely nonfunctional.
Related feature requests (optional)
First party key chord support could theoretically help. There’s an existing plugin for this that I’m already using, but it’s forced to install a global listener on the window, which is inappropriate for running editor-specific commands within pages.
I think I can still hack something together by creating wrapper Commands in obsidian that issue CM commands so that obsidian can manage the editor mapping, but it’d still require me to fork and substantially alter replit’s otherwise suitable codemirror-emacs CM6 plugin.