I have been using text expanders for a long time and today I am telling you about a tool that anyone concerned about their productivity should have in their toolbox.
If you spend many hours of your life writing, you need a tool like Espanso, to help you improve and be more productive, avoiding repeating the same texts over and over again, or even simply for something so simple, such as using something so interesting like emojis.
Write more with less, Espanso
It is a tool that replaces a keyword with text as you type. In this way, you define as many keywords as you need, and as you write the text extender takes care of replacing that keyword with what you consider.
How many times during the day do you write your email? Or the date of the day? Or even, in the event that you do not have the email signature configured, because you use different clients, how many times do you write the signature?
With the text extender, you will simply replace that keyword which can be perfectly ;mail
by your email.
This will lead you to be much more productive, without a doubt.
Why Espanso?
The point is that one of the great advantages of espanso, among others, is that it is multiplatform, so I could use it both for the blog and for work, and this is something that I find very comfortable.
But don’t think this caught my attention. What really caught my attention is that this tool is implemented in Rust.
And not only this, but also the application developer, Federico Terzi, has some videos on YouTube and had seen some of them, and everything together, was what pushed me to give this tool a try.
Espanso is a multiplatform tool to replace a keyword with a text.
This multiplatform is a real advantage, because you can use the same tool wherever you go. But it is not only this, but you will also be able to take your keywords to all your platforms.
When documenting about the application it has caught my attention that to implement this tool, Federico has used up to three technologies,
Rust for most of the project.
C++ to build compatibility layer for both Windows and Linux
Objective C the same as in the previous case, to build the compatibility layer, but in this case for MacOS.
In addition to these characteristics, indicate that it has some since you can download more substitutions from an official store. And it has support for emojis, which is a feature I was looking for, to use with Twitter.
Install espanso
In this case, I recommend that you visit the espanso installation page for both Microsoft and MacOs.
In the case of Linux, although I still recommend that you give it a visit, if you are anxious, you can install it by executing the following instructions in a terminal para ubuntu:
$ wget https://github.com/federico-terzi/espanso/releases/latest/download/espanso-debian-amd64.deb
$ sudo dpkg -i espanso-debian-amd64.deb
But also if you want to make use of a special feature for forms, you need to install an additional tool called module, also implemented by Federico himself. Installation is extremely easy:
$ mkdir -p ~/.local/bin
$ wget https://github.com/federico-terzi/modulo/releases/latest/download/modulo-x86_64.AppImage -O ~/.local/bin/modulo.AppImage
$ chmod u+x ~/.local/bin/modulo.AppImage
$ sudo ln -s ~/.local/bin/modulo.AppImage /usr/bin/modulo
The above instructions are not exactly the same as those on the Espanso page, because I prefer to use ~/.local/bin
Espanso test
You can now test the operation of espanso. And it is that scary starts automatically.
Just open any text editing application, or a terminal if you prefer, and write :espanso
, which you have to logically replace with Hi there!!!, if everything has been installed correctly.
First steps
How can I know if espanso is working? In Windows and MacOS this is simple, because the sparse icon appears in the status bar.
In Linux, you have to open a terminal and type the command espanso status
and in case it is not working execute espanso start
.
Now the time has come to set up dreadful to get the most out of it.
For this, the first thing to do is edit the configuration file for Espanso.
You can do this directly in the terminal by executing the espanso edit
. This opens your preferred editor and the configuration found in ~/.config/espanso/default.yml
.
Inside this configuration file, which is in YAML format, you will find a section called matches
where you will find different elements of the type:
- trigger: ":espanso"
replace: "Hi there!!!"
Where the trigger
is the keyword, while the replace
is the text you’ll replace
It is not necessary for me to tell you that the great advantage of this is that you can create your own keywords.
But not only that, but that being in plain text, all of this can be any service on Dropbox, Google Drive type cloud, but not only this, but also you can have in a repository on GitHub, GitLab or where you want.
Each time you modify the configuration file, it is necessary to restart Espanso, but do not worry, that this and the tool itself is responsible, so that any changes to the restart, to take account from that moment.
Packages
Another interesting tool that gives you great is the possibility of installing packages.
Packages that are available to consume directly, without having to write a single line.
But, in addition, you don’t have to worry about installing them from the repository, but Espanso takes care of this task.
For example, if you want to install a package with the basic emojis, you just have to execute the following instruction:
$ espanso install basic-emojis
$ espanso restart
And you will have at your fingertips, and never better said the following keywords:
Palabra clave | Emoji |
---|---|
:lol | ๐ |
:llol | ๐๐๐๐ |
:sad | โน |
:ssad | โนโนโนโน |
:sml | ๐ |
:strong | ๐ช |
:stlol | ๐ช๐ |
:ba | ๐ |
:ok | ๐ |
:ook | ๐๐๐๐ |
:happy | ๐ |
:cry | ๐ญ |
:wow | ๐ฎ |
You can find a whole list of packages in the espanso hub.
And I can assure you that there are of all kinds, and each one more spectacular.
There are more options to install packages, but for this I recommend that you visit the horror page directly.
On the other hand, if you want to know the packages you have installed, execute:
$ espanso package list
And you need to uninstall a package you should run the following:
$ espanso uninstall <name-of-package>
Creating your own packages
As I was saying, one of the great advantages of Espanso is that its configuration is a plain text file.
And not only this, but also the packages are plain text files. And not only this but you can have them in a GitHub repository.
With the advantage that this supposes, simply a git push and a git pull and you already have it synchronized on your devices.
If you want to create your own package, you simply have to fork the sample package and modify it as needed. You can even publish it on the espanso hub, following the instructions that appear in the official documentation.
Substitutions
Obviously the most interesting part of this tool is the substitutions. Here you have different options, and all following the characteristics marked by the YAML format, as I have indicated previously.
Static substitutions
Static substitutions are those that do not vary from time to time. They can be in a single line, as in:
- trigger: "hello"
replace: "Hello World!"
Dynamic substitutions
But you can not only do static substitutions, but you can also do dynamic substitutions, such as to put the date:
- trigger: ":date"
replace: "Today is {{vdate}}"
vars:
- name: vdate
type: date
params:
format: "%m-%d-%Y"
Global variables
Another interesting option that you have at your disposal is the possibility of using global variables that you can use anywhere.
For example, in the case of your name or other data. This goes in your default.yml
configuration file, which looks like the following:
global_vars:
- name: "global1"
type: "dummy"
params:
echo: "Global"
Selecting the cursor position
Selecting the cursor position
Sometimes you don’t just want to replace a keyword, but you also want the cursor to stay in a specific position.
For example, in the case of writing HTML, if you use <span></span>
you will want the cursor to be in the middle. You can do this in the following way:
- trigger: ":span"
replace: "<span>$|$</span>"
You can only use a positioning, in case you want to do more things, you will need to resort to forms.
Scripts
It is possible to extend the sparse functionality with the use of scripts.
So you can create a simple Python script that prints Hello world
, as in:
print("Hello wolrd")
Later add this to your replacement list:
- trigger: ":script"
replace: "{{output}}"
vars:
- name: output
type: script
params:
args:
- python
- script.py
Shell extension
In the same way that you can execute a script to return its content, it is also possible to create a substitution that allows you to execute an instruction in your preferred shell and that returns the result.
For example:
- trigger: ":ip"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "curl 'https://api.ipify.org'"
shell: bash
Forms
It is possible to use forms, something really useful in case you have to enter several parameters.
For example, again, if you work with HTML, and you need to enter an address in the form <a href="https://domain>text</a>
, This can be done with forms in the following way:
- trigger: ";a"
form: "<a href=\"{{url}}\">{{web}}</a>"
Not only this, but you can also use multi-line text boxes and even combos or lists to choose different options:
- trigger: ";form"
form: |
{{opcion}}
form_fields:
opciones:
type: choice
values:
- First option
- Second option
Setting
As I have told you, the configuration of Espanso is YAML format with all the advantages that this provides. You can edit it using espanso edit
.
You can organize your replacements in different files to make it easier to edit.
So, for example, if you want to create specific replacements for emails, you can do it with spam edit email.
Another interesting feature that joins the previous one is the possibility of using replacements depending on the application you are in.
To help you with this you have the option espanso detect
that offers you information about the window you are in and that you can use later for these filters.
Apart from this, you have a complete list of options available to configure and customize how Espanso works.
For example, I have used the backend: Clipboard
#option to make Espanso work correctly for me.
Conclusion
Honestly, with everything you have seen so far about Espanso, you have surely been as surprised as I was by the possibilities that have just opened up before your eyes. This is truly spectacular, and you just have to start it up to take your productivity to another sphere.
Indicate that espanso is open source released under the GPL-3 license, and that you can help the development of espanso not only by contributing the code, but also via donation. ๐.
Remember that if you want to synchronize your Espanso configuration, using a cloud service like Dropbox, you can use symbolic links.