# Emacs-like command trees / multi-key hotkeys / user-defined sub-command menus

**URL:** <https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084>\
**Category:** Feature requests\
**Tags:** hotkeys\
**Created:** [April 1, 2022, 3:54pm UTC](https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084 "2022-04-01T15:54:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oblio](https://forum.obsidian.md/user_avatar/forum.obsidian.md/oblio/32/27150_2.png) [@Oblio](https://forum.obsidian.md/u/Oblio)\
**Post date:** [April 1, 2022, 3:54pm UTC](https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084/1 "2022-04-01T15:54:31Z")

</div>

### Use case or problem

Multi-plugin power users must remember and quickly access 100+ hotkeys. This quickly devolves into a “was that control-command W” or “shift-alt W”??

### Proposed solution

Emacs manages key bindings for many many dozens of plugins by using Muti-key command trees. Where hot keys can be bound to a SEQUENCE of keystrokes. As long as no sequence is a prefix of any other sequence they can be distinguished at execution time.

How this is used:  
The use GROUPS commands and binds all of them to sequences with the same first key stroke. Common commands are still assigned a single stroke hotkey, while complex commands are assigned two (or sometimes more key strokes).

This is far easier to remember since one can arrange to use a pneumonic letter like “T” for table related commands, then a pneumonic letter like “I” for insert, and “R” for row. So the command would be ^T-I-R for table-insert-row.

OPTIONAL SUB-MENUS ADDITIONAL FEATURE:  
A valuable addition would be the ability to bind a special “sub-menu” indicator, to a keystroke prefix. This tells Obsidian to present the user with a dynamically constructed submenu of all possible next key strokes, this can greatly aid the user’s memory of all key strokes under the “Table commands” “^T” prefix. This submenu would popup after the user paused some number of milliseconds or perhaps when they typed a special “help key”

Using these submenus the user would only need to remember the keystroke that brings up the submenu of many related commands.

### Current workaround (optional)

Some plugin already create a submenu (e.g. menu of all possible template). Judicious prefix naming of those menu items can approximate a command tree like experience. BUT:

one can only have the specific sub-menus that the plugin creator provided. Power users will want to fashion their own submenus. Also those menus have ALL templates, while the user will only want a related subset along with non-template commands in their submenu, but that is impossible. Finally these menus require hitting return at the end. this is a 50% increase in keystrokes required for two-keystroke commands.

### Related feature requests (optional)

I could not find any related requests.

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [April 1, 2022, 4:13pm UTC](https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084/2 "2022-04-01T16:13:36Z")

</div>

It seems better suited for plugin idea.

---

<div class="post-metadata">

**Author:** ![Oblio](https://forum.obsidian.md/user_avatar/forum.obsidian.md/oblio/32/27150_2.png) [@Oblio](https://forum.obsidian.md/u/Oblio)\
**Post date:** [April 5, 2022, 6:07pm UTC](https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084/3 "2022-04-05T18:07:29Z")

</div>

Thanks. I have not yet explored the APIs for plugins, so don’t really understand what aspects of obsidian can be changed using a plugin. If users have plug-in ideas, is it appropriate to post them to the forum? (if so, then where?)

Thanks much for the guidance!

---

<div class="post-metadata">

**Author:** ![snr](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/3be4f8/32.png) [@snr](https://forum.obsidian.md/u/snr)\
**Post date:** [October 25, 2023, 7:43am UTC](https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084/4 "2023-10-25T07:43:45Z")

</div>

here’s a more active related thread [Multi-key or chorded key hotkeys](https://forum.obsidian.md/t/multi-key-or-chorded-key-hotkeys/13221)

---

<div class="post-metadata">

**Author:** ![jaredl](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/j/ac8455/32.png) [@jaredl](https://forum.obsidian.md/u/jaredl)\
**Post date:** [January 13, 2025, 1:09am UTC](https://forum.obsidian.md/t/emacs-like-command-trees-multi-key-hotkeys-user-defined-sub-command-menus/35084/5 "2025-01-13T01:09:46Z")

</div>

I created [my own plugin](https://forum.obsidian.md/t/spacekeys-execute-commands-based-on-sequences-of-key-presses/94736) that I think provides most of this functionality.
