Skip to main content

Espanso - Open Source, Cross Platform Text Expander

Why?

Why use a text expander?  If you have a job, any job, that requires you to re-type the same templated type text, over and over, and ove, then a text expander is a tool you should be using.

It simply does exactly what the name implies.  It expands text.  Let's look at some examples.

In my day job, I write "stories" for developers who then need to understand what's expected of their code.   My template for this lookks something like:

<h2>Story
As a <user type> I need <software feature> so that I (can / don't have to) <perform a function of my job more easily>.

<h2>Acceptance Criteria
A. criteria 1
B. Criteria 2

<h2>Section Title
"Some Title"

<h2>Drop Lists Needed
A. Droplist 1
B. Droplist 2
C. Droplist 3

So, the shell of all the stuff above is about half of what I put in a story, and retyping all those sizings, an dtitles, and so on, is redundant work.  Instead of typping all that, I have a shortcut set, and I simply type

stry

And my software expands that out to have all of the "guts" of my story template.  All that's left, is for me to fill in the important information that's different from story to story.  It saves tons of time, and lots of opportunity for simple spelling errors.

I don't know if I really need something like this

You might be surprised, and I can only speak from experience in jobs I've held, but let me lay down a few jobs and where I can see those jobs using a tool like Expanso.

  • Product Manager (Business Analyst, Product Analyst, etc) - Sotry / requirements writing.
  • Developer - Code layout / shell for code snippets
  • Engineer / Scientist - White Paper / Research Paper Templates, Technical Notes / Logs
  • Mathemetician - Long Formulae (type pyth) and have it add in pythagorean theorum (I know you know it, but think of even longer forumlae you use regularly).
  • Police Offier - Face it Cops - Narratives are a template: "On or about <date / time>, this officer was called to <address> in reference to a <call type>.  Upon arrival, this officer observed <observations>.  Based on these observations, the officer took the following action:  <List of actions>."    Is this every single report, no, is it the basis for 95% of them...yep.  And now you just fill the parts with < > around it.  You're welcome.

If you really stop and think about what you do on a daily basis, weekly basis, or otherwise, you will likely find a text expander can help you tremendously.  

Installation fo Espnaso

You can find install instructions for Ubuntu, Dbian, and Arch here.  IF you're insterested in building from source for another distribution, or in applications for Windows and MacOS, then head over to the github Releases Page.

For Ubuntu, or any distro that has snap support, howver, it's quite straight forward to install. Simply put the following command into your terminal:

sudo snap install espanso --classic

Once installed, you may also find you need to install XClip.  On Ubuntu / Debian systems use the command:

sudo apt install xclip -y

Now run, the command

espanso start

To start the espanso daemon running.

If you get no errors, you should be good to go.

Using Espanso

To test Espanso, type in one of the following test commands into your terminal.

:espanso - Hi there!

:date - 09/13/2020 (of course this will show the current date)

:shell - Hello from your shell

Each of these should epand out to show the text after the command is typed ompletely.

Configuring New Expansions

Everything is working, but big deal...how do I get my own text expansions into the system?  Well, Expanso uses yaml to configure expansions.  And while I'm not going to go into extreme detail here, they do have some good documentation out there, so check that out as well.

If you'll look in your /home//<user>/.config/espanso path, you'll find a file called default.yml.  This is the file we want to edit and add to.  You can much more easily open this file for editing by typing the command espanso edit in your terminal.

Now that you have it open, you'll see the three configurations for the commands in the section above.  These are a great template of how to create a new expansion.

Essentially, you need a trigger, or what you'll type to trigger an expansion.  Expanso starts theirs with a ":", so you might stick with that as a rule.   Next, you need the replace text.  Basically, what you want to replace your trigger word with.

Let's make a simple expansion addition.

Create a couple of blank lines just below the Shell commands section.  Keep in mind, that yaml is very particular about spaces...so make sure you put the right number in.

Add the following

Note that in the first line I have 2 spaces, a pound sign, then 2 spaces before the words "Simple Sample"

On the next lines put the following:

  #  Simple Sample
  -  trigger: ":samp"
     replace: "This is my very simple sample expansion. It works!"
     

Now, save ( CTRL+ O, then Enter / Return) your modified file, and exit ( CTRL + X).   Enter expanso restart in your terminal, and press enter.  You should get a message stating that espanso has restarted successfully.

Now, try your expansion by typing :samp into the terminal, or any field or app on your system.

That's it, now you can start adding more expansions galore!

Support my Channel and Content

Support my Channel and ongoing efforts through Patreon:
https://patreon.com/awesomeopensource