On older versions of Anki with the Mini Format Pack add-on, shortcut keys were available for initiating bulleted or numbered lists, as well as increasing or decreasing indent.
I have updated to Anki ver. 2.1.49. The included formatting options are a welcome addition. However, I do not see a keyboard shortcut for the bullet list, numbered list, increase indent, decrease indent functions. Most of the other buttons show their shortcuts when you hover over them.
Is there a way to create shortcuts for the aforementioned buttons?
Is there a way to add shortcuts to creating indents and outdents in anki’s inbuilt formatting options? I used to use the mini format pack which did indeed let you create your own shortcuts for every tool/function.
If I could I’d enable the mini format pack and disable the inbuilt Anki formatting options just to get those shortcuts, is that possible?
Edit I’m dumb, just misread your request @MedBooster and thought it was about lists. Well, one could probably apply the same strategy for the indent/outdent buttons.
I’m all for natively integrating shortcuts for lists etc…
In the meantime, you can just simulate clicking these buttons via JS.
Method 1 (with your own add-on)
You could use the hook editor_will_load_note to append a little script.
Script
if (!globalThis.listShortcuts) {
document.addEventListener("keydown", (e) => {
if (e.altKey) {
switch (e.key) {
case "o": {
e.preventDefault()
document.querySelector("[title='Ordered list']").click()
} break
case "u": {
e.preventDefault()
document.querySelector("[title='Unordered list']").click()
}
}
}
}
globalThis.listShortcuts = true
}
Method 2 (with keymap addon)
As @TRIAEIOU explains in this post, there are several add-ons that allow you to execute JS snippets with keyboard commands.
With an add-on like Custom editor keymap - AnkiWeb you wouldn’t need to insert that eventListener into the webview. Just bind the commands
I noticed you can’t even indent or outdent with the button if you don’t have an numbered/bullet point list, I wish it wouldn’t be implemented so soon when there’s obviously a lot the mini format pack does better. For once it let’s you indent without making a list. And the shortcuts worked well too… I guess I’ll just have the mini format pack activated, though it’s a bit confusing when you can’t disable the new inbuilt anki formatting buttons
Mini Format Pack is an add-on after all. While it’s quite common for Anki users to install add-ons, I believe the majority will still benefit from this new implementation - even if there is no feature parity to Mini Format Pack yet.
The recent changes to the editor aren’t trivial and it’s a step-by-step process. I for one would not want that process to be slowed down because it doesn’t fit well with an add-on.
You could ask the add-on author to implement a hiding mechanism for the vanilla buttons.That wouldn’t be difficult. Just did that for you:
Perhaps hiding individual buttons will even be natively integrated:
Hey kleinerpirat,
I tried your addon you linked in your post and added the command to a shortcut, but it didn’t accept it. May you have a look at the picture I added for your and thank you very much !
(I also tried it with Alt instead of Strg, but I’m pretty sure it’s a different point)