Home RSS icon Posts RSS icon Microblog

Snippet Pixie 1.2 released with support for placeholders 🎉️

I'm very proud to announce that Snippet Pixie now includes support for placeholders! 🎉️

Snippet Pixie

This release took an immense amount of work, with lots of thought taken in the design of the placeholders feature, hopefully you find these new super powers useful!

Read on for a summary of the placeholders feature and how to use the different types of placeholder.

Placeholders

All placeholders are delimited (wrapped) by $$, with the placeholder name starting with an @ symbol.

For example, today's date can be inserted with $$@date$$.

Some placeholders allow for extra arguments when : follows their name and that is followed by the argument. For example a format for a date, or the abbreviation for a snippet. Check the following descriptions for each placeholder for more details.

To use $$ in your snippet body, escape the second $ with a backslash like so: $\$.

@date

Quick Examples:

@time is an alias for @date, with one important difference, the default output if no format specified is the default time format (%X) rather than default date format (%x).

The optional format specified after : can take a format string as detailed in the GLib.DateTime.format function's docs.

GLib.DateTime.format function's docs

The optional date calculation starts with an @ after the placeholder name, followed by a signed integer and unit. The unit types are as follows:

You can apply more than one date calculation, for example +2h+30m adds 2 hours and 30 minutes to the current time.

You can use both positive (+) and negative calculations, for example -3D takes 3 days from the current date.

@clipboard

When $$@clipboard$$ is part of a snippet's body, when its abbreviation is expanded the current text contents of the clipboard will replace the placeholder.

@snippet

You can have up to three levels of embedded snippets with the @snippet placeholder.

The abbreviation for the snippet to be embedded is entered after :, for example $$@snippet:sigg;$$ expands the snippet with abbreviation sigg; in place of the placeholder.

@cursor

Adding $$@cursor$$ to a snippet's body will put the cursor in its place after expansion instead of at the end of the expanded text.

If $$@cursor$$ is entered more than once in a snippet's body or via snippet embedding, then the last occurrence of the cursor placeholder wins.

Get It!!!

https://appcenter.elementary.io/com.github.bytepixie.snippetpixie

---

"Snippet Pixie 1.2 released with support for placeholders 🎉️" was published on May 3, 2019.

~/