snippets in VSCode
What are snippets in VS Code?
Snippets are reusable text templates triggered by a short keyword (prefix). They:
expand into predefined text
support variables (like dates)
allow placeholders and cursor jumps
You define them in a JSON file (I like to use a separate .vscode/workspace-name-code.snippets), usually scoped to a language like Markdown or AsciiDoc.
Sample snippets
tdy → insert today’s date
tdy → insert today’s datePurpose:
Quickly insert the current date in ISO format (YYYY-MM-DD), useful for logs, notes, changelogs.
How it works: Uses built-in VS Code variables for year, month, and day.
Click to see code...
{
"today" : {
"scope": "markdown",
"prefix": "tdy",
"body": "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}"
}
}week → weekly notes template
week → weekly notes templatePurpose: Generate a structured weekly note with placeholders and repeated sections.
Click to see code...
Key features:
$1→ first cursor position (e.g. week number)tdyinside template → can be expanded further after insertionconsistent daily structure
integrates with linking (e.g.
[daily])
Usage flow:
Type
week→ expand snippetFill in week number
Expand
tdyper day if needed
Extensions: Markdown All in One, Markdown Preview Enhanced
Notes
Snippets compound well (e.g.
week+tdy)Keep prefixes short but unambiguous
Use placeholders (
$1,$2) for structured inputTreat snippets as part of your writing "toolbelt", not just automation
See also
VS Code → User Snippets (
Ctrl + Shift + P→ “Configure User Snippets”)Markdown preview (
Ctrl + Shift + V)
Last updated