binnyva71 downloadsCreate custom slash commands that insert custom text based on templates. Insert dates, shell command output, processed clipboard content, and more.
Slasher lets you create custom editor commands that appear in Obsidian's command system, which also makes them available from Slash commands. Each command has a name and a template. Template string decides what actually shows up in the editor.
If you want to use this with the slash command, than the Slash Command core plugin needs to be turned ON. You can find that at Obsidian > Settings > Core Plugins > Slash Commands - turn this ON.
You can also set custom keyboard shortcuts for your custom commands.

Templates are freeform text. Mix plain text with dynamic tokens:
[[{{ tomorrow | format: "yyyy-MM-dd" }}]][[{{ date_picker | format: "yyyy-MM-dd" }}]]Document Last Updated on {{ file_modification_date | format: "MMM do, yyyy" }}{% command %}find {{ vault_path }} -type f -name "*.md" | wc -l{% endcommand %}{% command %}wc -w < {{file_path}}{% endcommand %}{{ clipboard | replace_regex: "^\s+", "" | replace_regex: "\s+$", "" }}{% command %}find {{ vault_path }} -type f -name "*.md" | wc -l{% endcommand %}{{ today }}{{ tomorrow }}{{ yesterday }}{{ file_creation_date }}{{ file_modification_date }}Date values must use the format filter before insertion:
{{ today | format: "yyyy-MM-dd" }}
{{ tomorrow | format: "EEE" }}
{{ file_modification_date | format: "PPP" }}
Important: use MM for months. mm means minutes in date-fns.
For more options, check the date-fns format documentation.
{{ clipboard }}Example:
{{ clipboard | replace_first: "replace", "this" }}
{{ clipboard | replace: "foo", "bar" | replace: "baz", "qux" }}
{{ clipboard | replace_regex: "\d+", "#" }}
{{ clipboard | replace_first_regex: "foo\s+bar", "baz", "i" }}
{{ file_path }}{{ file_name }}{{ file_stem }}{{ folder_path }}{{ vault_path }}{{ vault_name }}{{ file_path }} resolves to the note's absolute filesystem path. File-scoped variables require an active file. If no file is active, the command shows a Notice and inserts nothing.
{% command %}...{% endcommand %}Example:
{% command %}ls -1 {{ vault_path }}{% endcommand %}
{% command %}wc -w {{ file_path }}{% endcommand %}
Nested Liquid output tags inside the command body are resolved before the shell command runs. Inserted values are shell-escaped.
Shell commands are executed with:
process.env.SHELL, or /bin/bash as a fallback-lcIf the command exits with a non-zero status, the plugin shows a notice and inserts nothing.
{{ date_picker | format: "yyyy-MM-dd" }}Example:
{{ date_picker | format: "yyyy-MM-dd" }}
When the command runs, the plugin opens a small date picker modal and inserts the chosen date using the provided format.
The legacy {% date_picker format: "..." %} tag is still accepted for existing templates, but new templates should use the output syntax above.
formatUsed with date-like values only:
{{ today | format: "yyyy-MM-dd" }}
{{ file_creation_date | format: "PPP" }}
{{ date_picker | format: "EEE, MMM d" }}
replaceReplaces all literal matches in string values:
{{ clipboard | replace: "from", "to" }}
replace_firstReplaces only the first literal match in string values:
{{ clipboard | replace_first: "from", "to" }}
replace_regexReplaces all regex matches in string values. The third argument is optional regex flags; g is applied automatically:
{{ clipboard | replace_regex: "\d+", "#" }}
{{ clipboard | replace_regex: "foo\s+bar", "baz", "i" }}
replace_first_regexReplaces only the first regex match in string values. The third argument is optional regex flags; any g flag is ignored:
{{ clipboard | replace_first_regex: "\d+", "#" }}
{{ clipboard | replace_first_regex: "foo\s+bar", "baz", "i" }}

All commands you have added are listed in the Settings page.
Each row also keeps an enabled toggle beside the command name, and the template cell includes an ⚙︎ button.
The ⚙︎ is just a template builder - you can use it to build the template you want without knowing the template format.
{{ clipboard }}.{{ vault_path }} and {{ file_path }}.