Snippets!! How to use the new !! snippet feature in Trunk Notes

Snippets are a feature of Trunk Notes to help you enter text quickly on your iPhone and iPad. In this blog post I will show you how snippets can help you quickly insert the current date/time and aid your creativity.

Some characters are quicker to type than others, especially on the small keyboard on the iPhone. If you want to insert some Markdown into Trunk Notes often defining a snippet can hugely speed up text entry. For example I have a snippet with the name Snippet:l. When I type lxx (that is the snippet name, without the Snippet: prefix, and the execute text xx) Trunk Notes inserts and puts the cursor just before the >. Much quicker than switching keyboards to find all the punctuation symbols.

Trunk Notes has had support for this kind of snippet for some time. In 2.4.2 snippets were made even more powerful by allowing you to define snippets with dynamic content in which is ‘executed’ before being inserted.

Timestamps

One obvious use for this is inserting a timestamp. I can type in txx and Trunk Notes will insert the current date and time.

To create a timestamp snippet follow these steps:

  1. Create a new wiki page with the name Snippet:t
  2. Enter the text !!{{timestamp}} and tap Save

Now when you type txx into a note Trunk Notes will expand the dynamic content {{timestamp}} and insert the date (and time depending on your settings) into your note. Without the !! Trunk Notes would just insert the text {{timestamp}}.

To create a custom timestamp you can supply arguments to the timestamp function.

Here are some examples:

  • !!{{timestamp yyyy dd/MM}} might insert 2011 10/02 (that is year day/month)
  • !!{{timestamp HH:mm}} for 21:52 (hour:minute)
  • !!{{timestamp EEEE}} for Thursday (the day name)

The timestamp function is really flexible. For full details on what all the codes are you can use see unicode.org.

Randomness

Here is something you might find fun (or maybe even useful if you are a creative type.)

If you are writing something and are stuck for the ideal word to use why not have Trunk Notes pick one for you at random.

The first task is to come up with a list of words which you want Trunk to pick from at random. I created a page called Adjectives and added the following (you may want to use a much longer list):

adorable

average

bright

gleaming

magnificent

prickly

repulsive

teeny-tiny

yummy

I then created my snippet. I called it Snippet:adj (so I can then type in adjxx and have my random word inserted). Snippet:adj contains the following text:

!!{{random Adjectives}}

Now whenever I type in adjxx Trunk Notes will insert a random adjective. Excellent if you use adorable magnificent Trunk Notes for writing short stories or poems!

How might you use !! ??

These are just two suggestions for using the !! snippets feature. If you find a cool use of !! let us know in the comments or start a forum thread.