Save Time: How I use a text-expander and you should too

Using a text-expander will save you time. I use Espanso every single day, and should have written about it sooner.

Save Time: How I use a text-expander and you should too
Photo by Glenn Carstens-Peters / Unsplash

Using a text-expander will save you time. I use Espanso every single day, and should have written about it sooner.

My Choice: Espanso

Espanso - A Privacy-first, Cross-platform Text Expander

Espanso is an open source, free text-expander. Espanso detects when you type a set of characters, and replaces them with whatever you want. At first this might sound like something you wouldn't care about, because how difficult is it to just type things out. And sure, that maybe true for a lot of things, but I bet if you took a moment to think about it, I'd bet there are certain phrases, email addresses, websites, HTML codes, signature blocks, that you find yourself writing all the time.

For example, when I type :title, Espanso expands it to my full working title (Director of ERP Support, Platform Integration, Workflow & Automation). Or when I type :d8 it displays the current date in yyyy-mm-dd format. Or when I type :em it replaces it with my email address.

It reads your configuration from a simple text file, meaning you can version it using git, or sync it across multiple machines. It's simple to configure and use, meaning this isn't just for IT people.

Here's my shortcuts and what they expand to, so you have some ideas to get started (I've removed my personal details/urls etc, but you'll get the idea)...

NOTE: The "\n" characters translate to new lines once expanded. That way you can expand a couple of characters into multiple lines of text.

Updating Espanso itself

trigger: ":edit"
replace: "open -a /Applications/Sublime\ Text.app /Users/myUserName/Library/Preferences/espanso/default.yml"

For some reason I forget where the config file is sometimes, so i just set up an :edit command which opens the config file in Sublime Text (my editor of choice at the moment).

Work Helpers

trigger: ":meet"
replace: "https://shortlink-to-a-zoom-or-google-meet-link"

trigger: ":em"
replace: "myemail@mydomain.com"

trigger: ":alias"
replace: "myalias@mydomain.com"

trigger: ":ph"
replace: "555-555-5555"

trigger: ":workaddr"
replace: "Nick Young\nMy Department, My Building Name\nPO Box 12345, City, State 12345"

// useful for signing off emails quickly
trigger: ":thx"
replace: "Thanks,\n--Nick"

trigger: ":sig"
replace: "Nick Young\nMy Super Long Title\nMy Institution Name\nmyalias@mydomain.com"

trigger: ":mygroup"
replace: "My Super Long Group Name"

trigger: ":title"
replace: "My super long title"

trigger: ":leavecal"
replace: "super-long-address-for-the-group's-google-calendar-we-use-for-scheduling-leave"

ServiceNow Helpers

These help me expand short text to the HTML code that is used inside ServiceNow to display links or other rich content.

// converts snlink to a clickable link in servicenow work notes
trigger: ":snlink"
replace: "[code]<a href="" target="_blank" title="">[/code]"

// converts sncode to a code block that displays correctly in servicenow
trigger: ":sncode"
replace: "[code][/code]"

// converts snlist or snnumlist to HTML for bulleted lists
trigger: ":snlist"
replace: "[code]<ul><li>One</li><li>Two</li></ul>[/code]"

trigger: ":snnumlist"
replace: "[code]<ol><li>One</li><li>Two</li></ol>[/code]"

// prefilled code block for use in servicenow worknotes
trigger: ":sncodeblock"
replace: "[code]<pre><code>function foo() {<br/>console.log('bar');<br/>}</code></pre>[/code]"

Splunk Helpers

trigger: ":spmetrics"
replace: "| mstats avg(_value) prestats=t WHERE index=myIndex AND metric_name="foo.*" span=1d by metric_name | timechart avg(_value) as "Avg" span=1d by metric_name"

Conclusion

Hopefully you can see the usefulness of a text-expander like Espanso. I'm sure there are others out there too, but Espanso has served me well for many years. I don't know why I didn't write about it sooner. Check it out when you get a chance.