Slash command shortcut documentation

pull/951/head
Zef Hemel 2024-07-15 20:31:37 +02:00
parent e050c7a4cf
commit 43d7003290
3 changed files with 32 additions and 2 deletions

View File

@ -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._ _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) * [[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:** 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) * **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)

25
website/Shortcuts.md Normal file
View File

@ -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
```

View File

@ -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]]. 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]].