Appearance
Snippets
A snippet is a small piece of code you insert repeatedly — a for-loop skeleton, a function declaration, a logging statement. Snippets in hachicode support placeholders, so you can tab through the fields the snippet defines and fill them in instead of editing the template by hand each time.
This page covers what snippets are, how to author them, and the ways to insert them.
Where snippets live
The snippet library is in Settings → Snippets. Tap + to create a new snippet; tap an existing one to edit.
The same data is also reachable from Settings → Keyboard → Snippet bindings, which is where you bind snippets to keys on your custom keyboard. Editing in either place updates the same underlying library.
A snippet's fields
- Name (required). Free text — what you'd search for in the palette. E.g. "for loop", "console log", "json schema".
- Template (required). The body the snippet inserts. Supports placeholder syntax (see below).
- Mnemonic (optional). One or two characters / symbols that display as the key label when this snippet is bound to a custom keyboard slot. E.g.
fn,→,🔥. Sanitized to a maximum of two graphemes. - Language (optional). Tag the snippet to a specific file type (TypeScript, Python, etc.) so it ranks higher when that file type is active. Leave blank for generic snippets.
- Description (optional). Free text — a short note shown in the snippet list and palette.
Placeholder syntax
Snippet templates support tab stops via ${name} syntax. When you insert the snippet, the cursor jumps to each tab stop in turn as you press Tab.
for (let ${i} = 0; ${i} < ${n}; ${i}++) {
${0}
}${name}defines a tab stop. Identifiers with the same name expand together — typing into one${i}updates all three at once.${0}is the final cursor position after you've tabbed through everything else. Conventionally the body of the construct (inside the for loop, between the curly braces, etc.).
That's the whole syntax. No conditionals, no shell expansion, no nested choices.
Inserting a snippet
Three ways:
From the snippet palette
Cmd+Shift+P opens the command palette; type "snippets" (or the specific snippet name) and pick it. Or the palette may have a direct binding to a "snippets palette" mode — check your keybinding catalog.
The palette buckets results by relevance:
- Snippets whose language tag matches the active file's language
- Untagged (generic) snippets
- Snippets tagged to a different language
All three buckets are always visible — the palette never hides non-matching snippets, it just ranks them. Useful when you want a Python snippet while editing a .md file (e.g. for a code-block template).
From a custom keyboard slot
If you've bound the snippet to a slot on your custom keyboard (Settings → Keyboard → Snippet bindings), tap the key on the accessory bar above the iOS soft keyboard. The snippet inserts at the cursor, and any ${name} placeholders activate as tab stops.
This is the fastest path when you reach for the same snippet constantly — bind it to a key and a tap inserts it.
From a keyboard shortcut
You can bind a snippet to a hardware-keyboard shortcut in Settings → Keyboard Shortcuts. (At time of writing this is a narrow surface — most snippet binding goes through the soft-keyboard slots — but the catalog supports it.)
How language tagging works
When a snippet is tagged "TypeScript", it floats to the top of the palette when you're editing a .ts file. It doesn't hide when you're editing a .py file — it's just ranked lower.
If you want a snippet to work everywhere with no language bias, leave the Language field empty. Generics rank between "matches current language" and "matches a different language."
The detection uses the open file's extension. For files with no extension, snippets are ranked by relevance without language matching.
Mnemonics — what they're for
When you bind a snippet to a custom-keyboard slot, the slot needs a label. The mnemonic is that label: one or two characters that read at a glance. Examples that work well:
fnfor a function templateclforconsole.log(${0})→for an arrow expressioniffor a conditional skeleton
Keep it short — the key is small and you don't have room for a word. The app caps the mnemonic at two graphemes (which means an emoji that takes two code points still counts as one mnemonic char, but multi-emoji strings get clipped).
Examples
A console.log snippet:
- Name:
log - Template:
console.log(${0}); - Mnemonic:
lg - Language: TypeScript (or leave blank for any JS-shaped language)
A Python if __name__ == "__main__": skeleton:
- Name:
main - Template:
if __name__ == "__main__":\n ${0} - Mnemonic:
mn - Language: Python
A markdown code-block:
- Name:
code - Template:
```${lang}\n${0}\n``` - Mnemonic:
\`` - Language: (leave blank)
See also
- Custom keyboards — bind snippets to keys on your accessory bar
- Editor basics — the command palette and cursor model
