Skip to content

Commit

Permalink
Create snippets-in-vscode.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinnington authored Jul 18, 2024
1 parent 836918a commit cad1b5b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions input/posts/snippets-in-vscode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Title: VSCode Snippets
Published: 18/7/2024 11:00
Tags: [markdown, vscode]
---

I use Visual Studio Code to write markdown notes of my meetings. I datetime every meeting to be able to find it afterwards. One of the shorthands I use is 'dt'. I always forget how to set it up when I reinstall my vscode, so here's the instructions from github copilot chat, which explained how to set it up again!

So now I know I can ask Copilot how to do it, but I still want to document it, so here it is:

### Github Copilot Instructions

To recreate the shorthand command in Visual Studio Code for inserting the current date and time in a Markdown file using `ctrl-space`, you can use a snippet. Here's how to set it up:

1. Open the Command Palette with `Ctrl+Shift+P`.
2. Type `Configure User Snippets` and select it.
3. Choose `markdown.json` for Markdown files.
4. Insert the following snippet configuration:

```json
"Insert Current Date and Time": {
"prefix": "dt",
"body": [
"### $CURRENT_YEAR.$CURRENT_MONTH.$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND"
],
"description": "Inserts the current date and time"
}
```

5. Save the `markdown.json` file.

Now, when you type `dt` in a Markdown file and press `Ctrl+Space`, it should suggest your snippet. Selecting it will insert the current date and time formatted as you described.

0 comments on commit cad1b5b

Please sign in to comment.