DEV Community

loading...

Alfred Snippet workflow

krzysztofzuraw profile image Krzysztof Żuraw Originally published at krzysztofzuraw.com on ・2 min read

I recently decided to remove a few no so frequently used applications. One of them was Typinator. It is a text expander - one of many. While I was researching if I can remove it and consolidate my snippets I stumbled upon a feature in one of the most used apps by me - Alfred. There are two messages if you are looking into Alfred text expanding capabilities - you can do it - yay 🎉 and it wont be so simple.

There are two types of text expanding in Alfred world:

  1. Simple - like expanding telephone number or date with cursor
  2. Complex - with multiple variables & selecting from a list of possible options.

I want to cover here the second one. To have complex text expanding you need to create snippet workflow. As a demo I've created conventional comments snippet workflow that ask me a couple of questions and pastes nicely formatted string into GitHub comment box. Workflow can be found on GitHub.

How it is working? At the beginning it ask me about label => which I can select from list; then I type title of my comment. Right after that workflow is pasting string:

**label** : title
{cursor_postion}

Enter fullscreen mode Exit fullscreen mode

into currently focused input field.

You can see workflow in action below:

Summary

If you want to have text expander like capabilities in Alfred - it is doable via snippet workflow. You can start by looking into my conventional comments one.

Discussion (0)

pic
Editor guide