espanso
Created: 2020-04-26 21:54:09 -0700 Modified: 2023-07-03 20:16:58 -0700
- This is for text expansions à la AutoHotkey’s hotstrings, e.g. turning “`evs” into “environment variables”.
wordmatches the entire word when separators are considered.left_wordmatches the beginning andright_wordmatches the end. For example, suppose you have an expansion where'12becomes½, and you type2'12.- With
wordandleft_word, this doesn’t expand to anything (unless'is a word separator for you). Withright_wordthough, it would expand to2½.
- With
Quick-start guide:
Section titled “Quick-start guide:”- Install (Windows)
- Set an environment variable for “EDITOR” so that it doesn’t launch with Notepad
- Open Explorer to Control PanelSystem and SecuritySystem
- Change Settings
- Advanced → environment variables
- Add an “EDITOR” variable with something like C:Program FilesMicrosoft VS CodeCode.exe
- Editing the configuration:
- espanso edit
- Closing the editor should get the changes to “take”, but if you don’t want to close it, just run “espanso restart”.
Features I want
Section titled “Features I want”- Running matches using keyboard shortcuts
- This isn’t super important since I can just use Raycast to do what I was trying to do, which is hotkey applications to ⌥1, ⌥2, etc.
- Running scripts, e.g. typing “‘ref” to write the text “(reference)” and link it to the URL on the clipboard. You can write a shell trigger that runs osascript, but espanso waits for it to finish before deleting the trigger.
Plurals
Section titled “Plurals”I frequently want matches like this:
- trigger: "'perm" replace: "permission" word: true propagate_case: true- trigger: "'perms" replace: "permissions" word: true propagate_case: trueOn Fri 06/30/2023, I looked into whether I could accomplish this with regex triggers, but it doesn’t seem to be possible, or at least it’s unwieldy. The closest I got was this:
- regex: "'perm(?P\<plural\>[s ])" replace: "permission{{plural}}" word: true propagate_case: true- Typing
'permand a space would work (but you would have to capture all of your delimiters in the regex) - Typing
'permswould immediately trigger the completion rather than waiting for a space - Even if this worked, it’s barely readable to have all of the regex gunk in each trigger. I opted to just have explicit entries for singulars/plurals.