Espanso – Cross-Platform Text Expander Written in Rust
131 points
17 days ago
| 20 comments
| github.com
| HN
n8henrie
13 days ago
[-]
I love espanso! The cross-platform support is huge (I use it on macOS, windows, and X11 and Wayland-based Linux systems).

Moreover, the original creator (Federico) and the current head maintainer to whom he has handed most of the day-to-day (AucaCoyan) are two of the kindest people I have ever come across in open source. All issues and contributors are treated with respect, it really is refreshing to feel so welcome when trying to contribute.

reply
rendaw
12 days ago
[-]
Being willing to listen and engage with people on a project goes so far!
reply
majkinetor
13 days ago
[-]
Autohotkey is go to on Windows for stuff like this, and its called hotstrings [1]. Hotstrings are much more powerfull. Trigger can for example run arbitrary function. AFAIK on linux, you can run it using wine.

[1] https://www.autohotkey.com/docs/v2/Hotstrings.htm

reply
nixpulvis
13 days ago
[-]
IIUC they can also run arbitrary scripts with Espanso.
reply
majkinetor
13 days ago
[-]
Arbitrary scripts, yes. AHK has a dedicated language which has a lot of hotkey stuff in it (hence the name). Other types of scripts are incomparable.
reply
behnamoh
14 days ago
[-]
I found Espanso very useful, but some bugs made me move on to Raycast, BetterTouchTool, etc. for similar functionality. For example, if Espanso config file is on a cloud drive, it doesn't automatically sync or read the file upon reboot.

I'm planning to move back to Espanso though, as Raycast is moving in the wrong direction with all the AI non-features.

reply
KetoManx64
14 days ago
[-]
Can't you just write a startup script that waits 1 minutes after a reboot and then restarts the Espanso service to apply the freshly downloaded config?
reply
bryanrasmussen
13 days ago
[-]
that seems less than optimal, the whole service needs to restart 1 minute after a reboot?

on edit: changed system to service

reply
henriquemaia
14 days ago
[-]
Have been using it for some years now. On Linux at least, it's easy to install and maintain.

The size of my snippets list is now a testament of its usefulness. On the appropriate context (an online meeting, for instance), it feels like a superpower.

reply
lamg
13 days ago
[-]
I think the problem Espanso is trying to solve should be addressed by GUI toolkits, like GTK, QT, etc. Otherwise, living with an authorized keylogger in our system in order to introduce unicode characters seems overkill.
reply
ndegruchy
12 days ago
[-]
Yeah, I don't have my KDE setup in front of me right now, but I feel like there is something in the keyboard settings that could emulate at least a subset of Epsanso's features. I know on macOS/iOS there is text replacements which are a simple replacement mechanism, without the ability to insert variables.

I agree, though, seems like a ripe piece of low-hanging fruit that could be better integrated and safer. Even if the lower level stuff just hands it off to a dedicated tool that handles the replacement text, at least the OS/WM should be the one watching the keys.

reply
Wolfbeta
14 days ago
[-]
reply
tathagatadg
13 days ago
[-]
Just installed it and started using. It is timely as I have to fill a number of forms today on government sites so looking forward to using it. What are some best practices you have come up with for reducing the cognitive load for the trigger lifecycle - that is detect the need, come up with one that fits an easy to retrieve mental model? Namespacing obviously comes to mind, and some trigger design should be as conflict free as possible, yet brief:

  :i.a - address
  :i.n - name
  :i.p - phone
Debating if I should feed my zsh history to chatgpt and as it to come up with some. Any other advice from the power users?
reply
mk4p
13 days ago
[-]
I was using `,.` as the trigger, as I don't think there are any real-life uses of that simple combo.

  - ,.a.macro
  - ,.b.macro
etc.
reply
bayindirh
14 days ago
[-]
I’m using it on KDE for quite some time now. It’s very useful, but sometimes types too fast and eats keystrokes. Other than that it’s flawless. Can recommend to anyone.
reply
stavros
14 days ago
[-]
Can you not configure the text speed?
reply
bayindirh
11 days ago
[-]
Looks like it can add some delays. Currently testing the new configuration.
reply
hypertexthero
14 days ago
[-]
Anyone know how to change the default :date output to YYYY-MM-DD instead of MM/DD/YYYY on macOS?

I’ve tried the following in default.yml and reloading the config, but it’s not working and Claude, Gemini, and myself are stumped :)

  matches:  
    - trigger: ":date"  
      replace: "{{mydate}}"  
      vars:  
        - name: mydate  
          type: date  
          params:  
            format: "%Y-%m-%d"
reply
hypertexthero
14 days ago
[-]
Solution: Edit the # Print the current date section in…

  /Users/$USER/Library/Application Support/espanso/match/base.yml
…to read:

  # Print the current date
  - trigger: ":date"
    replace: "{{mydate}}"
    vars:
      - name: mydate
        type: date
        params:
          format: "%Y-%m-%d"
reply
kemitchell
14 days ago
[-]
I shell out to POSIX `date` on Linux and I believe also on Windows:

    - trigger: ";tod"
      replace: "{{mydate}}"
      vars:
      - name: mydate
        type: shell
        params:
          cmd: date --iso-8601
reply
dorian-graph
13 days ago
[-]
I know it's not perhaps helpful, but I have the _exact_ same code, and it's worked for ages on macOS. Do other matches work correctly?

I have it in `~/.config/espanso/match/base.yml`.

reply
Wolfbeta
14 days ago
[-]
Put it in match/base.yml
reply
thangalin
14 days ago
[-]
My cross-platform, FOSS text editor, KeenWrite[1], does something similar[2]. Pressing Ctrl+Space inserts the nearest matching variable into the text.

[1]: https://keenwrite.com/

[2]: https://youtu.be/CFCqe3A5dFg?list=PLB-WIt1cZYLm1MMx2FBG9KWzP...

reply
frellus
14 days ago
[-]
I love espanso. I use it daily. Simplicity is perfect, it does one thing and does it well.
reply
kamranjon
14 days ago
[-]
This is how you do a Readme / went in having no clue what a text expander was and within 5 seconds understood what it was from a small gif.
reply
bsnnkv
14 days ago
[-]
The single best way to insert emojis into text, I cannot function without this tool
reply
BarryGuff
13 days ago
[-]
I still prefer AlomWare Toolbox, because it can autotype things from different triggers other than just hotkeys or hotstrings, such as the text in PC notifications when they appear.
reply
0xPIT
13 days ago
[-]
This is basically what Data Detectors natively does in macOS, is it?
reply
ndegruchy
12 days ago
[-]
No, not especially. What Espanso does is watch keystrokes, looking for the specific combinations in the config to then expand the shortcut to whatever it's defined to do. There is similar functionality built into macOS/iOS but it's _far_ less featured.

In System Settings > Keyboard > Text Input > Text Replacements

Basically, it's a simple replacement tool, which works for some repetitive stuff (i.e. my name, my email address, my phone number, or a short string for closing out emails). Epsanso, and tools like it, do so much more.

Edit to add: Data detectors on macOS/iOS look for existing strings of text that you can then get more contextual options for. Things like dates and times might open up a calendar view, phone numbers might offer a menu to dial it, or addresses might offer the ability to open a map for it. Absolutely useful, but not the same thing.

reply
treetalker
15 days ago
[-]
Can anyone recommend a good TextExpander to Espanso snippet converter?
reply
mariocesar
14 days ago
[-]
I used ChatGPT for that and it worked fine, you can even take screenshots and tell it to create the YAML config file for you
reply
millzlane
13 days ago
[-]
Espanso looks promising but Atext (paid) fits niche very nicely for me.

With atexts gui it makes building new entries easy. I even have a keyboard shortcut to use highlighted text to quickly make a new entry.

I have used it to write emails, make automation's for certain websites that take keyboard shortcuts. I use it to build query searches for certain websites I use frequent (kinda like firefox back in the day).

https://www.trankynam.com/atext/

reply
_HMCB_
14 days ago
[-]
I’ve been using this for about 6 months. Love it.
reply
ipsum2
13 days ago
[-]
What are some interesting use cases people are using Espanso for?
reply
VPenkov
13 days ago
[-]
I use it to shorten common requests I have for my colleagues, e.g. to not forget their code reviews, or alias phrases I commonly use to a :command. It's handy as a form filler too.

I've seen people using it to insert emojis, lorem ipsum text, or fixing common typos. It's quite powerful because you can even do HTTP requests and mash them with your text.

There is Expanso Hub here, it contains numerous other examples: https://hub.espanso.org/

I'm now thinking about writing an expansion to help me reference tickets, e.g. expand :searchticket <string> to a list of up to 5 URLs. Since it happens inline, I don't have to "submit" the list to anything/anyone until I've cleaned up the message.

reply
jatins
14 days ago
[-]
I found it really buggy when I used it to the point in was unusable
reply
sunaookami
13 days ago
[-]
On macOS it often doesn't paste text and will just delete everything while getting stuck which is very annoying :/
reply