If you're a writer, coder, or you respond to lots of emails in a day, a text expander is an indispensable program on your computer. It's essentially a productivity tool that expands or replaces your typed text with its longer equivalent to help you type faster.

Generally speaking, you'll find text expansion tools of all kinds. However, Espanso proves to be one of the most promising ones of the lot, since it's free to use and offers plenty of customization options.

Let's check out Espanso and explore how you can use it in your workflow.

What Is Espanso?

Espanso is a free and open-source text expansion tool for Linux, macOS, and Windows. It works by analyzing the text as you type it into a text field to check it against its records in the configuration file, and replaces it with its equivalent longer version if there's a match.

How to Install Espanso

Espanso is available on all major desktop platforms. If you own a Mac or a Windows PC, download Espanso's installer from the links below and run it to install the program on your system.

Download Espanso: Windows | Mac (Intel), Mac (Apple Silicon)

On the other hand, if you have a Linux machine, the installation can be a little complicated, as you can expect. So to simplify things, here's a breakdown of the instructions to help you install Espanso on different Linux distros.

Ubuntu/Debian

On Ubuntu/Debian, you can install Espanso using a DEB package or Snap. If you prefer using a DEB package, open the terminal and run these commands:

        wget https://github.com/federico-terzi/espanso/releases/download/v2.1.5-beta/espanso-debian-x11-amd64.deb

sudo apt install ./espanso-debian-x11-amd64.deb

Alternatively, to install it via Snap, first, make sure your system has Snap using this command:

        snap --version
    

If this returns a version number, Snap is installed on your machine. Else, it isn't, and you need to install it first, which you can do using our Snap guide.

Once it's installed, installing Espanso is as simple as running:

        sudo snap install espanso --classic --channel=latest/edge
    

Other Linux Distros

If you're using any other Linux distro, you can use Espanso's AppImage to get the program up and running on your computer.

Open the terminal and run the following commands to do this, and you'll have an executable Espanso AppImage on your system at the end of it, which you can run just like any other app:

        mkdir -p ~/opt

wget -O ~/opt/Espanso.AppImage 'https://github.com/federico-terzi/espanso/releases/download/v2.1.5-beta/Espanso-X11.AppImage'

chmod u+x ~/opt/Espanso.AppImage

sudo ~/opt/Espanso.AppImage env-path register

Registering Espanso as a systemd Service

With Espanso installed, you now need to register it as a systemd service. This is to make Espanso automatically launch at the time of system startup, so you don't have to bother doing it manually every time you boot up your computer.

For registering Espanso as a systemd service, run:

        espanso service register
    

If you don’t wish to do this, you can start Espanso using the following command instead:

        espanso start --unmanaged
    

To stop it, run:

        espanso stop
    

On Mac and Windows, you won't need to do this. Instead, you'll be required to select the option to Start Espanso at startup (or equivalent) in the installation wizard.

Espanso Basics

Before you jump in and start using or configuring Espanso, here are a couple of Espanso concepts you must know:

  • Trigger: It's the keyword (letter or word) that Espanso tries to find a match for in its configuration file and replaces with its longer equivalent (a.k.a. replacement text) when there's a match.
  • Replacement Text: It's the longer text snippet that replaces its equivalent trigger as you type it.
  • Match: It's essentially a key-value pair that associates a trigger with its replacement text. Oftentimes, it's set using a rule, which you can either create yourself or download using packages.

Espanso uses two kinds of matches: static and dynamic. A static match is constant and ideal for situations that don't require active/dynamic values. On the other hand, a dynamic match changes depending on the context and, therefore, is better suited for dynamic text expansions, i.e., where values (or replacement text) are variable.

For instance, here's an example of a dynamic Espanso match that replaces instances of :date with April 6, 2022:

        - trigger: ":date"
replace: "April 6, 2022"

How to Use Espanso

With the basics out of the way, you can now start using Espanso on your computer. Using it is pretty straightforward: you simply need to type : (colon) followed by a trigger, after which, Espanso will analyze it and replace it with its replacement text if there's a match.

For example, in its simplest form, Espanso can help you automatically fill out the current date in a text field. So rather than entering the date manually, you can enter its trigger instead, and Espanso will replace it with the actual date.

Configure Espanso to Include More Matches

As you now know, for Espanso to work, it's important to have matches in its configuration file. But it turns out that Espanso doesn't have many matches in this file by default, so there's only so much you can do with it out of the box.

Fortunately, populating matches in the Espanso configuration file is fairly simple. It requires you to edit a YAML file, which uses a simple syntax and is pretty easy to edit. Or, if you're feeling lazy, you can download an Espanso package instead, which includes a series of similar kinds of matches for a specific requirement created by the community, to expand its functionality.

1. Creating Matches to the Configuration File Manually

Espanso stores the YAML configuration file under different directories depending on the operating system. Here's where you'd find it on:

  • Linux: /home/user/.config/espanso/
  • macOS: /Users/user/Library/Application Support/espanso/
  • Windows: C:\Users\user\AppData\Roaming\espanso

Use the cd command in the terminal followed by the directory path to access it. You can also use the ls command (on Linux and macOS) to list files and directories inside a directory.

Alternatively, you can open the terminal (on Linux and Mac) and run the following command to find espanso's path:

        espanso path
    

On Windows, open the File Explorer and navigate to the espanso folder under: C:\Users\user\AppData\Roaming\

Inside the espanso folder, you have a config folder and a match folder. The config folder stores all the essential settings and behavioral options for Espanso, whereas the match folder contains all the matches.

It's the match folder that contains the base.yml, to which we need to add matches. Here's how you do it.

On Linux or macOS, once you navigate to the match folder inside the espanso directory, open the base.yml using:

        nano base.yml
    

In Windows, you can go into the match folder, right-click on the base.yml file, and select Open with Notepad to open it.

configuring Espanso matches

Once inside the base.yml file, follow the syntax below to create a match:

        -trigger: ":muo"
replace: "MakeUseOf"

Useful Espanso Matches

1. Fill in email address

        -trigger: ":email"

replace: "xyz@gmail.com"

2. Correct a misspelled word

        -trigger: "propogate"

replace: "propagate"

3. Enter the current time

        -trigger: ":now"

replace: "It's {{mytime}} "

vars:

- name: mytime

   type: date

   params:

      format: "%H:%M"

4. Expand a text snippet

        -trigger: ":ilu"

replace: "in lieu of"

To capitalize the first word, use

        -trigger: ":ilu"

replace: "in lieu of"

propagate_case: true

5. Print a greeting message

        -trigger: ":greet"

replace: |

Best Regards,

XYZ

Here, | is used to add replacement text that spans multiple lines

6. Add an image

        -trigger: ":image"

image_path: "/path/to/image/"

Of course, these are just a few examples of what you can do with Espanso, and there are various other use cases where the program can come in handy. Check out Espanso's documentation to learn more.

2. Using Packages to Expand Espanso's Functionality

Head over to Espanso Hub to check out all the different packages created by the Espanso community. When you find a package useful, click on it to access its details. In there, you'll also see the installation and usage instructions for that package.

espanso hub

Open the terminal or Command Prompt and run the installation command to install the package on your system. Once it's installed, enter its trigger keyword in a text field to verify if it works.

Get More Done With Espanso

Although a text expander may not seem important to you at first or may seem overkill (since it needs to be configured before you can use it), it's certainly a valuable tool that can help you type faster and be more productive.

We hope this guide gives you a quick primer to help you get started with Espanso, so you can include it into your workflow and get more done on your computer. Besides, if you've never used text expanders before and would like to learn more about them to find out if they're worth it, we've got you covered.