Snippets
A snippet is a parameterized SQL template with placeholders for fast insertion. ide99 ships with a base set (typical SELECT, EXPLAIN, migrations) and supports custom ones.
Open the palette
⌘+J — opens the snippet palette over the editor.
Type to filter by name and tags. ↑/↓ to navigate, Enter to insert the selected one.
Placeholders
After insert, the cursor lands on the first placeholder. Tab for next, Shift+Tab for previous.
Placeholder syntax:
| Pattern |
Meaning |
${1:table_name} |
Placeholder #1 with default table_name |
${2:column} |
Placeholder #2 |
$0 |
Final cursor position (after Tab through all others) |
${1|orders,users|} |
Placeholder with a dropdown of choices |
Example built-in select-recent:
SELECT *
FROM ${1:table_name}
WHERE ${2:created_at} > now() - interval '${3:7 days}'
ORDER BY ${2:created_at} DESC
LIMIT ${4:100};$0
Built-in snippets
Categories:
- select —
select-all, select-count, select-recent, select-where-jsonb
- explain —
explain-analyze, explain-analyze-buffers
- schema —
create-table, add-column, add-index-concurrently
- maintenance —
vacuum-analyze, reindex-concurrently, find-bloat
- jsonb —
jsonb-extract, jsonb-keys, jsonb-array-explode
- stats —
top-slow-queries, unused-indexes, cache-hit-ratio
Full list — in the palette, filter by tag: type #explain or #maintenance.
Custom snippets
Settings → Snippets → New. Form:
- Name — shown in the palette (e.g.,
daily-revenue)
- Trigger — short prefix for fast search (e.g.,
dr)
- Tags — comma-separated (
stats, daily)
- Body — SQL with placeholders
Example: daily revenue by country:
SELECT
${1:c.country},
count(*) AS events,
sum(amount_cents) / 100.0 AS revenue
FROM ${2:events} e
JOIN ${3:customers} c ON c.id = e.customer_id
WHERE e.event_at > now() - interval '${4:1 day}'
GROUP BY 1
ORDER BY revenue DESC$0
Saved to ~/Library/Application Support/ide99/snippets.json (or the equivalent path on Windows / Linux). The file is plain JSON — you can edit it by hand or commit it to git to share with the team.
Import / export
Settings → Snippets → Export — saves your snippets as an .ide99-snippets file. Import loads someone else's set. Convenient for sharing via git or Slack.
See also: App settings → Sharing.
Next