Skip to content

Instantly share code, notes, and snippets.

View smeech's full-sized avatar

Stephen Meech smeech

View GitHub Profile
@smeech
smeech / choices.yml
Last active April 27, 2025 21:52
[Second choice conditional on first choice] The trigger, `:test` invokes the first "select" choice box which supplies the options for the second "output" choice variable. Rewritten from the previous version which relied on writing files. The technique is not possible using verbose syntax, so cannot be combined with a "layout:" field. #espanso
matches:
- trigger: :test
replace: "{{output}}"
vars:
- name: select
type: choice
params:
values:
- label: One
id: |
@smeech
smeech / brackets.yml
Last active January 31, 2025 15:53
[Autocomplete brackets] Espanso trigger to autocomplete brackets etc. at the end of a string, on typing double-space. It will fall over if there's a single-quote within the string, however. #espanso #python #regex
# Espanso trigger to autocomplete brackets etc. at the end of a string, on typing double-space.
# It will fall over if there's a single-quote within the string, however.
matches:
- regex: '(?P<delim>[\[\(\{<"])(?P<string>.+) '
replace: "{{output}}"
vars:
- name: output
type: script
params:
args:
@smeech
smeech / temp.yml
Last active February 18, 2025 15:07
[Temperature C/°F conversion] Espanso temperature C/°F conversion. From conversation at: https://discord.com/channels/884163483409731584/1013914627886817372/1253000300730515508. Usage: ::10C → 10C / 50.00°F or ::10F → 10°F / -12.22C #espanso #python #regex
# Espanso temperature C/°F conversion
# From conversation at: https://discord.com/channels/884163483409731584/1013914627886817372/1253000300730515508
# Usage: ::10C → 10C / 50.00°F, or ::10F → 10°F / -12.22C
matches:
- regex: ::(?P<value>\d+(?:\.\d+)?)(?P<unit>[CF])
replace: "{{output}}"
vars:
- name: output
type: script
params: