Easily configure custom snippets without manually editing the Espanso configs directory.
clipboard
utility
Paste this command in a terminal to install the package
espanso install snipbank
Description
Source
SnipBank
Easily collect snippets and recall them later with Espanso.
Requirements
Espanso 2.x or higher
Python 3.x or higher with Pip
PyYAML 5.x or higher
Installation
pip install pyyaml
espanso install snipbank
Keyboard Shortcuts
Use
,,..
(two commas, two dots) to add a snippet.
Use
..,,
(two dots, two commas) to remove a snippet.
Pressing Tab and Enter in a Snippet
Use
^TAB^
in a snippet for pressing the Tab key.
Use
^ENTER^
in a snippet for pressing the Enter key.
Use
$|$
in a snippet to bring the cursor there upon inserting it.
Specifying a Form
You may optionally specify a popup form to go with a snippet in order to make
parts of the snippet editable before its insertion.
Under "Form", enter the text to show in the popup. Use these to indicate fields:
Text field:
[[variable_name]]
Text area:
[![variable_name]!]
Dropdown:
[^[variable_name:opt1|opt2|...]^]
List:
[>[variable_name:opt1|opt2|...]<]
You may specify a default value after a field name using
=
. Example:
[[name=Anonymous]]
,
[^[greeting=Hello:Hello|Goodbye]^]
Use
{{variable_name}}
in the snippet to reference a form field.
Rich Text Snippets
You may use Markdown or HTML to include rich text in your snippets.
replace
: (Default) Use plain text replacements.
markdown
: Markdown can be used in snippets.
html
: HTML can be used in snippets.
Notice that if you choose
markdown
or
html
and your snippet contains form input, the values from your form will also be interpreted as Markdown or HTML respectively.
Paste/Silent Mode
When using
paste
mode (default), the snippet's replacement is printed. This
allows you to use
,,..
to add a new trigger and type at the same time, or
..,,
as the "paste" step of a disposable clipboard. If a form is specified,
nothing is printed as the output relies on user input.
When using
silent
mode, nothing is printed. This is useful when you just want
to manage your snippets without writing them out.
package.yml
global_vars:-name:snipbank_pythontype:echoparams:echo:"python"# Replace this with the path to your Python instance if automatic detection is failingmatches:-trigger:",,.."replace:"{{stdout}}"vars:-name:"last_choice"type:scriptparams:args:-"{{snipbank_python}}"-"%CONFIG%/match/packages/snipbank/lastused.py"-get-mode-paste-name:"f"type:formparams:layout:"SnipBank: Add Trigger\n\nTrigger:[[trigger]]\nSnippet:[[snippet]]\nType:[[replacetype]]\nMode:[[mode]]\nForm:[[form]]"fields:snippet:multiline:trueform:multiline:truemode:type:choicedefault:"{{last_choice}}"values:-paste-silentreplacetype:type:choicedefault:replacevalues:-replace-markdown-html-name:stdouttype:scriptparams:trim:falseargs:-"{{snipbank_python}}"-"%CONFIG%/match/packages/snipbank/addtrigger.py"-"{{f.trigger}}"-"{{f.snippet}}"-"{{f.form}}"-"{{f.replacetype}}"-"{{f.mode}}"-name:set_last_choicetype:scriptparams:args:-"{{snipbank_python}}"-"%CONFIG%/match/packages/snipbank/lastused.py"-set-mode-"{{f.mode}}"-trigger:"..,,"replace:"{{stdout}}"vars:-name:list_triggerstype:scriptparams:trim:trueargs:-"{{snipbank_python}}"-"%CONFIG%/match/packages/snipbank/listtriggers.py"-name:"last_choice"type:scriptparams:args:-"{{snipbank_python}}"-"%CONFIG%/match/packages/snipbank/lastused.py"-get-mode-paste-name:"f"type:formparams:layout:"SnipBank: Remove Trigger\n\nTrigger:\n[[trigger]]\nMode:\n[[mode]]"fields:trigger:type:listvalues:"{{list_triggers}}"mode:type:choicedefault:"{{last_choice}}"values:-paste-silent-name:stdouttype:scriptparams:trim:falseargs: