Why not Shortcuts for snippets?

I’m looking for a way to store and retrieve text snippets (mostly email templates, not code) on mac and iOS. I’ve spent a couple hours scanning this forum for options. I’ve been using KM conflict pallets but adding new snippets is sorta awkward, and its not available on iOS.

@ryanjamurphy obsidian / ios homescreen setup, uses Shortcuts to search a plain text file, and then split by lines / header.

Could this kind of solution work just as well for saving a snippet to clipboard? Editing the snippets would be as simple as opening the text file. Before I dive in further, is this a bad idea? To make a text file with 100 snippets in it?

## snippet 1
     lorem ipsom
## snippet 2
    lorem ipsom
1 Like

How Do you want to get a single snippet out of the text file, to work with it again?

To use it? Just shortcuts > Copy to clipboard

To edit it? just ⌘f the file?

If I understand your approach right, you want to have a list with 100 snippets, like shown, and a shortcut to the extract a specific snippet from that list to insert it somewhere else!?
The shortcuts from the link only search/extract a specific part above a defined line.
If you have hundred of those lines, how should the shortcut know, which one to be the right one?
So even if you give the shortcut the number of the right line, you have to know this number in advance to do so.
So you have to search the list before, to initiate the shortcut.
While you search the list anyway, you can use copy-paste to get the snippet, and skip the shortcut… :wink:

I made a first draft shortcut that works, borrowed from @ryanjamurphy and still containing some artifacts from his shortcut, sorry.

Create a text file like the one in the code block from my original post and set it as the path in the shortcut.

Link to shortcut: Shortcuts I just noticed it will ask for your “projects” file. Choose your snippets file.

When you run a shortcut you see a list of just the snippet titles like

## snippet 1
## snippet 2

when you choose one, it copies just the line below it to clipboard.

1 Like

You mentioned in your first post a list with 100 snippets!
If this works for you, great!
But I wouldn’t see any advantage of this, if I have to scroll thru a list that long, to use a „short“cut!
As said before, from my point of view, as long as you have to search the list for the right snippet every time you use the shortcut, you can just copy and paste the snippet, and don‘t need the detour via a shortcut.
And it would even probably be way faster to just type the text, then to use a snippet this way!

I’m sure it could be elaborated somehow so theres a menu to narrow it down, like

  Email > Clients 
  Email > Leads
  Code
  Account numbers

As I said before, if it works for you, use it!!

But from my view, I can’t see any advantage from using a shortcut this way, over just copy and paste.

To address the point about how easy it is to create a Keyboard Maestro snippet (though not the ‘doesn’t work on iOS one…) Dr Drang has a macro which makes creating snippets much easier. It’s basically a dialogue box which you use to create the snippet, which is then available in the normal way.

I use it (when I’m not in the ‘oh go on then’ phase of the TextExpander on-off-a-thon.) and it works fine. It may be of use to some people.

4 Likes

I have no problems with Keyboard Maestro for snippets and it should be fine unless you have over a thousand or even more. I use conflict palettes extensively too.
I take your point about iOS though: my solution to that problem, after much experimentation, was to stop using iOS for productivity to be blunt. I haven’t regretted the decision made well over a year ago.

2 Likes

Drafts is another option for snippets and it works equally well between iOS and Mac.

I love this, thanks for posting the link in here.
I just set it up with the most likely approach for me being conflict palettes.

So, using Hyper-S brings up all my snippets, which are sensibly named such as:

  • email Graeme@abc…
  • email Shep@def…

So, tapping Hyper-S, e, g will insert the first email address, with onscreen clues helping me remember what I’m doing! (also, typing ;emg is set up to do that too, but I doubt that’ll stick for me).
I always wanted to try this, but the thought of managing them in KM seemed unwieldy. @drdrang 's script is beautiful.

1 Like

I’m glad it works for you!

Dr Drang’s is full of really useful tips (not just about KM), so it’s worth having a look through for anyone interested in this sort of ingenious automation.

2 Likes

I’ll confess I don’t actually try to get work done on iOS, either. But as Shortcuts gets more powerful I feel more hesitant to design anything too grand in KM for example.

1 Like

It’s been a week of toying with ideas around this. I realized I have two types of snippets that might be better to separate in to different systems.

  1. Text “replacements” / auto completion: Account numbers, addresses, signatures.
  2. Email templates.

The most important distinction from a usability standpoint: #1 rarely changes, whereas #2 I want to edit almost every time I use. And because the emails are meant to be easy-to-read, I need to be able to see them in their natural habitat, not crammed inside a box in Keyboard Maestro, for example.

So I think Shortcuts may be a more reasonable option for #2, where I expect to spend more time browsing anyway. Also I’m more likely to use #2 on iOS. (More likely to send an email than to need my bank routing number when I’m sitting at the airport, etc)

The “split by headings” is one way to do it, but might be more trouble than it’s worth, especially since the emails are multiple lines. I’m thinking it would be simpler (from a Shortcuts perspective) to make each email template it’s own markdown file to pick from.

I’m in the same position with the template I use for the Daily Note in my NotePlan app although I use Snippets in Alfred for this purpose. I’m always tinkering with my daily note template and Alfred makes it easy to quickly get in and edit it as often as the whim or need arises.