Espanso is an open source text expander for Windows, Mac and Linux

Ashwin
Jan 29, 2020
Updated • Feb 3, 2020
Software, Windows software
|
14

Snippet tools are incredibly useful. The idea is to save time that would have otherwise been wasted typing phrases, sentences or entire paragraphs.

Espanso default

Espanso is an open source text template program for Windows, Mac and Linux that helps users save time.

During the installation, you have the choice to add Espanso to "PATH" (Windows System Variable) and to enable it to auto-start with Windows. You will also need to restart the computer to get the program working. properly; I think it requires the restart to enable the "PATH" correctly. Start the program and you should see an icon on the system tray. Right-clicking on it allows you to disable it or exit the program.

Espanso icon

Espanso works in all applications that I tried it in including Notepad, Word, Firefox, Thunderbird, and more.

Matches

Espanso uses the concept of Matches (keyword recognition) i.e., when you type a word that's present in the program's settings, it triggers the application to substitute the keyword with its configured replacement. The official wiki explains the technical details rather well, but I'll demonstrate how it works below for your convenience.

Fire up a text editor or browser, or any other program that accepts text input. Type the word :espanso and it will magically be replaced with the phrase "Hi there!". In this case ":espanso" is the keyword and "Hi There" is the replaced text.

espanso demo

If you haven't guessed it already, Espanso is the Italian word for Expanded.

So, how do we customize Espanso?

Go to the application's "Roaming" folder in your User directory. For e.g. C:\Users\Ashwin\AppData\Roaming\espanso

This folder contains a "default.yml" file. Open it using a text editor, e.g. Notepad works just fine. Espanso uses YAML syntax, which is very user-friendly. Look at the highlighted section in the screenshot below. That's the match trigger and replacement which I mentioned in my example.

espanso highlighted

Rules

The indentation is necessary for the syntax to work. So if your match isn't being triggered correctly, check the spacing in the syntax. The other rule is to remember to use the : symbol. For e.g. :espanso vs espanso. The first one is correct, the latter won't trigger the program.

How to add new words to Espanso?

Let's try adding a new one. Write a new trigger word and choose a replacement phrase. To make it easy, you can just copy the "espanso" trigger, paste it in a new line and edit it.

- trigger: ":ghx"
replace: "gHacks.net"

Save the document, exit Espanso and start it again. Now type :ghx and it should be replaced with gHacks.net. That's incredibly easy, isn't it? You can use it to add email signatures, URLs, HTML Tags, commonly used phrases, responses, etc, and save some time.

Espanso is an open source text expander for Windows, Mac and Linux

- trigger: ":emailid"
replace: "email@example.com"

- trigger: ":ggl"
replace: "https://www.google.com/"

- trigger: ":myadd"
replace: "Apt 123, 5th Avenue"

- trigger: ":tvm"
replace: "Thank you very much"

espanso examples

You can even replace a text with an image, the syntax is slightly different.

- trigger: ":word"

image_path: "/path/image.ext"

Replace word with the keyword you want and the /path/image.ext with the full path of the image's location, followed by the name of the picture and its extension. This may not be practical in day-to-day usage, but the option is there, in case you want to use it.

All the above examples are static matches, as in, the replacement word or phrase never changes.

Will it replace other words which I type? No, that's why the : symbol is used, to prevent words being replaced by accident. You can use matches without the colon symbol, but it will replace words which spell similarly. Refer to the official documentation about Word Triggers to avoid this issue.

Dynamic Matches

These are matches with variables, e.g. to replace the variable with the date and time.

espanso extensions

Look at YML document's "Dates" section; this one has a trigger that will add the current date in the format "month/date/year (US format). The syntax for it may appear to be complicated, almost like a program code. First you set the keyword as usual, then you declare a variable called "mydate", which contains the type (extension) and the parameter to calculate it. The documentation I linked to above, explains how to add a match for a similar "Time" match.

Note: I use the word section just as a reference to the order of the commands that the default configuration file lists them in. You can write your matches in any order you want to.

Extensions

Espanso supports extensions, commands that you can customize. The Date example which I mentioned uses the "Date" extension. You can set an extension by using the "type" command followed by its own syntax.  The third section in the YML document lists a Shell Command that you can use for that purpose.  The Shell extension lets you write commands that can be executed using the Command Prompt, PowerShell and other shells. The application's Script extension is used to execute scripts that you supply.

The application is written in Rust (Mozilla's alternative to C++).

Espanso is fast, easy to use if you want to quickly insert words and phrases. When it comes to variables I don't think it is user-friendly, BeefText has variables built-in, just right-click and select the one you want to use. On the other hand, you can create custom variables with the former.

Espanso

For Windows

Summary
software image
Author Rating
1star1star1star1star1star
no rating based on 0 votes
Software Name
Espanso
Operating System
Windows, Linux, macOS
Software Category
Productivity
Price
Free
Landing Page
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. MargI said on October 9, 2020 at 10:12 pm
    Reply

    Frederico and Ashwin – thank you so much for Expanso! I am a transcriptionist that uses Windows and I’m looking into switching to Linux for my work computers. It’s not easy but Expanso seems to fit the bill for my usual text expansion needs. Thank you again and I look forward to giving it a whirl!

  2. John Davis said on January 31, 2020 at 12:51 am
    Reply

    This function is now built into MacOS and it’s been on the Mac as TypeIt4Me since the early 90’s. On LInux, Autokey works well, it’s not necessary to type colon as the trigger. Using TypeIt4Me and Autokey, I’ve built a shorthand system that makes typing really fast. This is a necessary function for a computer.

    1. Jonas said on February 1, 2020 at 6:23 am
      Reply

      There’s about a half-dozen longstanding programs of this kind on the Mac, but they’re mostly not free. TypeIt4Me (that you mentioned) costs about $20, I believe, and Typinator costs a little more.

      I mostly use the free one built-in to MacOS. I don’t even know if it has a name, but I get to it via System Preferences: Keyboard: Text tab. Works pretty well, but it doesn’t have the variables and other fancy features that Ashwin describes for Espanso.

      I’ve never seen Espanso mentioned in any Mac forum, but if people say it works, I might give it a try.

  3. Ivan Lazarov said on January 30, 2020 at 4:57 pm
    Reply

    Looks like a keylogger

  4. Hesborn said on January 30, 2020 at 6:58 am
    Reply

    So this is Emmet but just for text. Great concept though👍

  5. Anonymous said on January 30, 2020 at 6:46 am
    Reply

    Ashwin, the dynamic examples are really cool.
    Great job.

  6. Fabrizio Degni said on January 29, 2020 at 11:59 pm
    Reply

    It is great! Thank you!

  7. Federico Terzi said on January 29, 2020 at 11:11 pm
    Reply

    Hey Ashwin,
    Creator of espanso here! Thank you very much for your article, it’s well written and useful for newcomers.
    In the end you mentioned built-in variables, I’ll try to add them in a future release as they seem pretty useful! Do you have any suggestion on some of them?

    Have a great day,
    Federico Terzi

  8. Trey said on January 29, 2020 at 10:05 pm
    Reply

    Very cool, open-ended tool. Can see it being full of useful solutions.

  9. Anonymous said on January 29, 2020 at 8:41 pm
    Reply

    why a copy with reduced functionality when you can have AHK in its full glory? .

    1. Anonymous said on March 4, 2020 at 7:20 am
      Reply

      AHK is windows only, and has a community that like to take a dump on anyone who isn’t 100% behind AHK and AHK only

  10. Klaas Vaak said on January 29, 2020 at 7:05 pm
    Reply

    I have been using Espanso for about 3 months now and it really is a joy. It’s fast, light on resources, and the dev is friendly and helpful. Well worth a donation.

  11. Tom Hawack said on January 29, 2020 at 1:30 pm
    Reply

    Expresso, ma que, mama mia, Valpolicella, Chianti, presto, capito, bella, amore, Romanella and … Expanso.

    These applications really come in handy, Expanso looks great, I’ll give it a try.
    Nice you mention/detail/explain it Ashwin. I don’t know about others but I often encounter situations where I’d find pertinent, opportune to find a small dedicated app which would perform just that task, and snippet tools are of those. So you go to software portals but when your query isn’t specific enough you can end up with dozens or more search results which are unsatisfactory. So great, looks like i’ve found just what I needed.

    1. thebrowser said on January 30, 2020 at 6:45 am
      Reply

      Agreed, small single-purpose utilities are my absolute favorie. I didn’t know about this one but boy wish I had knew if years ago…

      Thanks to Ashwin, great article as always.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.