From 43d700329051dda28a82e29efd14e07ac71ebb6c Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 15 Jul 2024 20:31:37 +0200 Subject: [PATCH] Slash command shortcut documentation --- website/CHANGELOG.md | 1 + website/Shortcuts.md | 25 +++++++++++++++++++++++++ website/Slash Commands.md | 8 ++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 website/Shortcuts.md diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index e35a9f86..43383464 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -7,6 +7,7 @@ release. _These features are not yet properly released, you need to use [the edge builds](https://community.silverbullet.md/t/living-on-the-edge-builds/27) to try them._ * [[Page Decorations]] are here (initial implementation by [Deepak Narayan](https://github.com/silverbulletmd/silverbullet/pull/940), later refined by Zef) +* New type of [[Shortcuts|shortcut]]: `slashCommand` * **Fix:** very large spaces would let the server blow up when saving snapshots. This is now fixed. * **Fix:** Conflict copies could no longer be edited, whoops (initial fix by [Semyon Novikov](https://github.com/silverbulletmd/silverbullet/pull/939), later refined by Zef) diff --git a/website/Shortcuts.md b/website/Shortcuts.md new file mode 100644 index 00000000..1c576ceb --- /dev/null +++ b/website/Shortcuts.md @@ -0,0 +1,25 @@ +SilverBullet enables you to configure some custom shortcuts in [[SETTINGS]] via the `shortcuts` attribute that trigger [[Commands]] in various ways. + +Supported types of shortcuts: +* [[Keyboard Shortcuts]] that create keyboard bindings for a given command +* [[Slash Commands]] shortcuts that enable triggering a command via a slash command +* Priority shortcuts to tweak the ordering of commands in the [[Command Palette]] + +# Configuration +In [[SETTINGS]]: + +```yaml +shortcuts: +# Keyboard shortcuts: +- command: "{[Navigate: Center Cursor]}" + key: "Alt-x" # for Linux/Windows + mac: "Alt-x" # for macOS (and other Apple devices with keyboards) +# Slash command shortcuts: +- command: "{[Outline: Move Right]}" + slashCommand: "indent" +- command: "{[Outline: Move Left]}" + slashCommand: "outdent" +# Priority shortcut +- command: "{[Upload: File]}" + priority: 1 +``` diff --git a/website/Slash Commands.md b/website/Slash Commands.md index 6031fd29..6758f1c9 100644 --- a/website/Slash Commands.md +++ b/website/Slash Commands.md @@ -1,5 +1,9 @@ -Slash commands are quick ways to perform repetitive tasks. 99% of the time this will mean inserting a [[Snippets|snippet]]. +Slash commands are quick ways to perform repetitive tasks. 99% of the time this will mean inserting a [[Snippets|snippet]], but they can also be configured to trigger commands (see [[Shortcuts]]). -You can trigger a slash command by typing a `/` in your text (after some white space). +# Invoking a slash command +You can trigger a slash command by typing a `/` in your text (after some white space) followed by its name (this will auto complete). Technically, no slash commands ship with SilverBullet directly. However, you can easily add useful ones via [[Libraries]]. + +# Triggering commands with slash commands +To trigger any existing [[Commands]] via a slash command, you can configure them as shortcuts, see: [[Shortcuts]].