Since I added Linux to my operating system workflow I am no longer able to have all my text snippets, including code, only available on macOS. I need a cross-platform snippet tool and today we’re going to look at Espanso which is my current option for a cross-platform snippet manager.
Installing Espanso
On macOS, you have two options to install Espanso. Most people should probably download the application image from the link above and install it in the traditional way. I prefer to use Homebrew when possible so I used the following two commands (also on the install page) to get Espanso running on macOS.
brew tap espanso/espanso
brew install espanso
If you want to install Espanso on Linux then they have an AppImage option for you, or you could manually compile from source. I went with the AppImage on my Fedora 38 install.
Basic Espanso Configuration
If you’re comfortable with the command line then the easiest way to find where the Espanso configuration file is is to use espanso path
via terminal. It should yield one of the following three paths depending on your platform.
- Linux:
$XDG_CONFIG_HOME/espanso
(e.g./home/user/.config/espanso
) - macOS:
$HOME/Library/Application Support/espanso
(e.g./Users/user/Library/Application Support/espanso
)- NOTE: when migrating from the previous 0.7.3 version, the configuration directory will be located in
$HOME/Library/Preferences/espanso
for compatibility purposes.
- NOTE: when migrating from the previous 0.7.3 version, the configuration directory will be located in
- Windows:
{FOLDERID_RoamingAppData}\espanso
(e.g.C:\Users\user\AppData\Roaming\espanso
)
Once you find the path in the terminal you need to open up that configuration file so that you can change the snippets that are available for replacement. The configuration file uses the yml
format so make sure you’re using spaces in your text editor.
You can see in the screenshot below I left myself a note to add Obsidian as a snippet so that I don’t have to type it all the time.
Now you can see that I’ve added Obsidian to the registered snippets.
All you have to do is save the file and Espanso will live reload your snippets and you’ll have the new fill-in value available.
Espanso Search
Once you have many snippets in your library it can be hard to remember all the find/replace sequences that are available for you to use. Luckily Espanso has a built-in search feature. This is available on macOS via ⌥ Shift
and in Linux/Windows via ALT Shift
.
Pressing this command brings up the search window where you can type to filter your snippets, and if you see what you want you can select the snippet with a quick keyboard command.
Syncing Espanso
Out of the box, Espanso doesn’t provide any sync function for your snippets. I’ve chosen to build a GitHub repository for my snippets and then push/pull the yml
file between systems as I make changes. I could certainly see this being a pain in the ass for some, but I use Git regularly so it’s not that big a hurdle for me.
With that said, I am working on a single script to set up a computer that would pull my GitHub configuration repositories down so that I can have a computer set up and synced with a single command.
There is more
Today we’ve only taken a basic look at what Espanso offers because that’s enough for most people. In the future we’ll look at cursor placement, dealing with custom extensions and configuration files, and dealing with long code snippets that have lots of line breaks.
Stay Organized with Things 3
Things 3 is my favourite iOS, iPadOS, macOS task manager. It combines the right mix of organization without all the nags that some task managers have when you get a bit behind. By the time you finish this course you’ll be a master of Things 3. You can also become a member to get all my courses.
$49 USD (30-day guarantee)