Skip to content

Instantly share code, notes, and snippets.

View smeech's full-sized avatar

Stephen Meech smeech

View GitHub Profile
@smeech
smeech / clipman.yml
Last active November 23, 2025 05:17
[Clipboard manipulation] Espanso clipboard manipulation, to select relevant script line using the choice extension id: parameters. #espanso #bash
# Espanso clipboard manipulation, new version to select relevant script
# line using the choice extension id: parameters.
# To use, copy the text in question and type ":case".
- trigger: :case
label: Modify and paste copied text
replace: '{{Output}}'
vars:
- name: Clipb
@smeech
smeech / chk.yml
Last active January 31, 2025 16:04
[Check-boxes] Using characters #espanso
# Espanso check-boxes
matches:
- trigger: :test
replace: "{{form1.flag}}"
vars:
- name: form1
type: form
params:
layout: "Option A: [[flag]]"
fields:
@smeech
smeech / rti.yml
Last active January 31, 2025 16:57
[Rich text images] HTML and Markdown examples, including the injection of images +/- text #espanso #html #markdown
# Espanso Html and Markdown examples, including the injection of images:
# Define a variable containing the location of the home directory
global_vars:
- name: home
type: script
params:
args:
- python
- -c
- print(__import__('os').path.expanduser('~'))
@smeech
smeech / capital.yml
Last active October 27, 2025 13:57
[Sentence capitalise] Capitalise new sentence after period, question or exclamation mark. #espanso #regex #bash #python
# Capitalises first letter after sentence-ending punctuation, skipping exceptions
- regex: (?P<before>\b[\w.]+[.?!])\s(?P<firstchar>[a-z])(?P<therest>\w*\W)
replace: "{{before}} {{capital}}{{therest}}"
vars:
- name: capital
type: script
params:
args:
- python
- -c
@smeech
smeech / ord.yml
Last active January 31, 2025 16:01
[Ordinal suffixes] Superscript suffixes of ordinal numbers with some checking for validity. #espanso #regex
# Espanso superscript suffixes of ordinal numbers with some checking for validity
matches:
- regex: (?P<number>\s[1]|[0,2-9]1)st
replace: "{{number}}ˢᵗ"
- regex: (?P<number>\s[2]|[0,2-9]2)nd
replace: "{{number}}ⁿᵈ"
- regex: (?P<number>\s[3]|[0,2-9]3)rd
replace: "{{number}}ʳᵈ"
- regex: (?P<number>\s[0,4-9]|[1][\d]|[0,2-9][0,4-9])th
replace: "{{number}}ᵗʰ"
@smeech
smeech / caps.yml
Last active November 23, 2025 05:17
[Double capitals] Corrects double-capitals typoed at beginnings of words (Linux & ?WSL) #espanso #regex #sed #python #powershell #bash
# corrects double-capitals typoed at beginnings of words
- regex: (?P<chars>\b[[:upper:]]{2,}[[:lower:]]{2,})(?P<end>\W)
replace: "{{output}}{{end}}"
vars:
- name: output
type: script
params:
args:
- python
- -c
@smeech
smeech / help.txt
Last active January 31, 2025 16:12
[Entirety of Espanso help text] #espanso
espanso 2.2.1
Federico Terzi
A Privacy-first, Cross-platform Text Expander
USAGE:
espanso [FLAGS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-v Sets the level of verbosity
@smeech
smeech / parse_help.py
Last active January 31, 2025 16:13
[Parse Help] Espanso: Parse entirety of `espanso --help` recursively #espanso #python
#!/usr/bin/env python3
# A script to parse `espanso --help` recursively throughout all its levels.
import subprocess
import sys
def parse_help(command):
try:
help_text = subprocess.check_output(command + ['--help'], stderr=subprocess.STDOUT, text=True)
except subprocess.CalledProcessError as e:
@smeech
smeech / ascii.yml
Last active January 31, 2025 17:36
[ASCII character triggers] #espanso
# ASCII character triggers
# https://donsnotes.com/tech/charsets/ascii.html
matches:
- trigger: "\x05" # <ctrl-e>
replace: testing
@smeech
smeech / file.yml
Last active March 5, 2025 23:08
[Input from file] Trigger to read input from a file. #espanso #bash
# Trigger to read input from a file
matches:
- trigger: :test
replace: "{{output}}"
vars:
- name: output
type: shell
params:
# cmd: echo $(</home/$USER/temp/br.txt) # Strips out newlines
cmd: cat /home/$USER/temp/br.txt