Command Palette Aliases

I’d love to have the ability to create aliases for certain commands. Just like with note names, when you ctrl + O and type something with a certain note in mind, and it doesn’t come up, it’s a fantastic cue that you should add that to the aliases for that note. It works extremely well for me.

The Problem

I am finding that I have the same event occur when I want to run certain commands with ctrl + P. Particularly, I always get hung up on the “Periodic Notes: Open daily note” command, and I often try typing “today” instead.

Aliases are really great in many contexts. Another example is bookmark nicknames in a browser. Typing a specific, short phrase, can quickly get you to a specific bookmark.

Yes, I could bind a hotkey, and a hotkey would be slightly faster. But conceptually, aliases cement in my mind and my memory so much easier, especially when there are too many options to be bound to a limited amount of keys and abstract key combinations. Aliases are also just more flexible, and take a lot less commitment when you want to make part of your workflow a tad faster.

The current behavior and UI appearance with aliases in the file open dialog is perfect right now, and I think it should look exactly the same in the command palette.


:white_check_mark: :fire: :white_check_mark:


:frowning:
As you can see, the command still comes up as the second result, only by chance thanks to fuzzy searching. I want to be able to type “today” and hit enter, and always know that it does the command I want it to do.

The solution

Adding this feature would also mean needing a menu to view and set aliases. I think this would naturally belong quite well in the “Command palette” section in the settings dialog.

The bare minimum features:

  • See a list of currently set aliases
  • Change an alias name or command
  • Delete an alias
  • Add new aliases

When adding a new alias, I’d like to be able to select a command with the same fuzzy search selection style of the command palette. I don’t really think there’s need for anything more fancy than that to create a really useful new feature.

4 Likes

This would be a nice feature to have! I rather liked RemNote’s approach to it.

[deleted part of post, ignore]

A hacky workaround could be achieved with the Better Command Pallette plugin.
Create a macro with the name that you want the alias to have → Add the command that you want the alias to lead to, set delay to zero.
(It’s hacky because it’ll lead to cluttering of the command palette, and because the name will be on a equal level in search priority as the other command names, but should function well enough otherwise.)

1 Like

Woah, that plugin (you deleted??) is actually something else I was thinking about separately! There’s a very similar plugin in Neovim called whichkey for keychord bindings (press one key followed by another key). When you press the “leader” key for a keychord, if you don’t press a follow up key within say 200ms, a little window will pop up showing you all the sub bindings for that leader key, with the key and a comment. It even works for nested “menus” as far as you want, and you can go back with backspace. But, if you have the chord memorized and you type it fast enough, the menu never shows up at all! But still SO useful for the stuff you don’t have memorized yet.

Many actions are bound under the space key, which is handy for vim users.

After pressing space


Then g

I’ve been thinking about replicating this behavior in Obsidian, and the plugin you linked seems to be quite close to that, so thanks for sharing!

I still want my aliases though. :stuck_out_tongue:

The Better Command Palette solution would definitely work! But not ideal for sure. And it doesn’t have the really nice combined entry for aliases like in the file switcher.

(sorry for getting slightly off-topic)

1 Like

I deleted it because I realised it wasn’t quite about aliases. But I’m glad you found it useful. :slight_smile:

A small delay between pressing the “leader key” (which is a key combination in this case) and the window popping up, would definitely be an improvement. Or even an option to make the window not show up at all.

Do let me know if you modify it to make that happen!

Workaround:
use GitHub - AlexBieg/obsidian-better-command-palette: A better command palette for obsidian
and create a macro with the alias you want

1 Like

I was looking around for something similar and found multiple plugins. I provide the list from here:

My problem with using either one of these is that they interfere with normal typing.
So if I set in e.g. Sequence Hotkeys ‘ctb’ for ‘command: toggle blockquotes’, I cannot write “can”, or “cusp” in normal typing mode because only “an” and “usp” will be entered as text.