Espresso

Zen

Zen shortcuts are CSS selector-like abbreviations that expand into a full structure when you press tab. Where you are writing HTML, every HTML tag is a Zen shortcut. This means you can expand a sequence like this:

div#helloworld p.yay a

Into this full HTML:

<div id="helloworld">
    <p class="yay"><a href=""></a></p>
</div>

Press tab again to move from one place to fill in to the next.

The Zen button in the toolbar turns when what you have typed is something tab would expand.

An element written after another, with a space or a > between them, goes inside it. Each word has to be the name of an element for tab to expand it, so ordinary words are left alone, and a sequence is read back from the cursor only as far as it makes sense: in see nav ul li, the shortcut is nav ul li. You can also select a shortcut and press tab.

Combining elements

"+" places elements next to each other instead of inside, "*N" writes an element N times, and parentheses group elements. For example:

div#helloworld*3 + footer

Expands into:

<div id="helloworld"></div>
<div id="helloworld"></div>
<div id="helloworld"></div>
<footer></footer>

And ul>(li>a)*2 into a list of two links. You can give an element attributes in square brackets and text in braces, as in a[href=/about]{About us}, and number repeated elements with $, as in li.item-$*3.

Shorter names

Many elements have shorter names, or names that bring their attributes with them. These are the same abbreviations Text ⟩ HTML ⟩ Expand Abbreviation (control ,) uses:

Customize

You can also give your own snippets a trigger. Click the + button in the toolbar and choose Edit Snippets... (see Snippets). Try setting up a new snippet with a Zen trigger of "test123" and the contents below. Note the use of the ${ZEN_ID} and ${ZEN_CLASSES} variables.

<body>
    <nav><a href="http://espressoapp.com/${ZEN_ID}">Espresso${ZEN_CLASSES/([^\s]+)/ \U$1\E/g}!</a></nav>
</body>

Now, type the following and press tab:

test123#powerup.is.awesome

If all goes right, you now have the result below. Mighty morphin' power snippets!

<body>
    <nav><a href="http://espressoapp.com/powerup">Espresso IS  AWESOME!</a></nav>
</body>

A snippet's trigger works in any language, and is typed by itself: it is not one of the elements of a longer shortcut.