Mr. Panini's solution for expansion snippets is great. But sometimes you want to share snippets between macOS and Windows: enter Espanso.
There was a previous mention here, that listed the advantages. One disadvantage mentioned was the fact that you have to edit a configuration file.
As a nice learning project and for possible replacement of TextExpander 5.1.4 I'd like to investigate if I can replace TE with a combination of Espanso for the snippets and Keyboard Maestro for the nice menu item structure (to insert log in combination, boiler plate texts for correspondence etc.)
Let's begin.
Espanso's snippets are stored here:
~/Library/Application Support/espanso/match/base.yml
A short test learns that snippets are recognized when added to the end of this file:
# espanso match file
# For a complete introduction, visit the official docs at: https://espanso.org/docs/
# You can use this file to define the base matches (aka snippets)
# that will be available in every application when using espanso.
# Matches are substitution rules: when you type the "trigger" string
# it gets replaced by the "replace" string.
matches:
# Simple text replacement
- trigger: ":espanso"
replace: "Hi there!"
# NOTE: espanso uses YAML to define matches, so pay attention to the indentation!
# But matches can also be dynamic:
# Print the current date
- trigger: ":date"
replace: "{{mydate}}"
vars:
- name: mydate
type: date
params:
format: "%m/%d/%Y"
# Print the output of a shell command
- trigger: ":shell"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo 'Hello from your shell'"
# And much more! For more information, visit the docs: https://espanso.org/docs/
- trigger: "xtst"
replace: "Hi there, this is a test!"
So it will be easy to add new snippets via a simple Keyboard Maestro dialogue box with two input boxes and two buttons. I'll work on that later:
Add snippet to Espanso.kmmacros (2.0 KB)
For the management feature I was thinking about a Prompt with List. But how to get the existing snippets out of the base.yml file? I'll probably need your help there :).