Use automatic text replacement to speed up your coding and typing

In programming, and probably in most other lines of work where you work with text on a computer, there are some symbols and special characters that you use a lot, but that are quite difficult to type. Perhaps you need to hit a combination of keys to produce the symbol, or even more time-consuming, you might need to open a menu or tool to insert the symbol.

For me as a programmer, symbols I use all the time, are { and }.

Let us have a look at the symbol {. On a Norwegian Windows keyboard, this is written by hitting ALT+8. On a Norwegian Apple keyboard, the situation is even worse, there the key combination is ALT+SHIFT+8.

Therefore I have started using AutoHotkey for Windows and Keyboard Maestro for Mac to create shortcuts to this and other symbols I use a lot.

My preferred shortcuts

These are the shortcuts I have started using regularly, both on Windows and Mac. When I type the shortcut on the left, the text is automatically replaced with the text on the right. By using AutoHotkey/Keyboard Maestro, the automatic text replacement works in any application.

AutoHotkey (Windows)

AHK is a little utility monitoring your keystrokes, and if you type something you have defined as a shortcut, it can do lots of different tasks. You define the shortcuts in an ahk file. My AutoHotkey.ahk looks like this:

AutoHotkey is a bit difficult to set up, because it is very powerful, and can do many tasks beyond simple text replacement.

Keyboard Maestro, TypeIt4Me, aText (OS X)

I have tried many different applications for text replacement for OS X, and the one I like the most is Keyboard Maestro. It is very expensive for a text replacement app (because it can do a lot more than simple text replacement), but it is the only one I have found to work everywhere.

Some very good, and much cheaper, alternatives are aText and TypeIt4Me. They work 99 % of the time, but the 1 % bugged me enough that I ended up purchasing Keyboard Maestro.

I think one of the reasons why I have struggled to get the alternatives to always work, is that I also use a clipboard manager, and most of the text replacement applications work by pasting text from the clipboard.

My setup for TypeIt4Me

TypeIt4Me makes it really simple to setup text replacement.

Screen Shot 2015-12-04 at 22.41.18

My setup for Keyboard Maestro

Keyboard Maestro has a lot more options, but the setup is almost as simple. You have to create one macro for each symbol. You can duplicate macros, so as soon as you have created one, you are able to create many macros pretty quickly.

Screen Shot 2015-12-29 at 20.50.24

Note: The best option is to use the action Type a Keystroke. This does not conflict with clipboard managers.

However, this only works with symbols that you can actually write. When creating shortcuts for symbols you have to copy and paste, like “→”, you have to use the action Insert Text by Pasting or Insert Text by Typing. I have found Insert Text by Pasting to be the most reliable of these two.

Downloads

Download AutoHotkey:
https://www.autohotkey.com/download/

Download TypeIt4Me:
http://www.ettoresoftware.com/products/typeit4me/

Download aText:
https://www.trankynam.com/atext/

Download Keyboard Maestro:
https://www.keyboardmaestro.com/

One thought on “Use automatic text replacement to speed up your coding and typing”

Leave a Reply

Your email address will not be published. Required fields are marked *