A tool can generate VSCode code snippets fastly.
$ npm i -g csnp
$ yarn i -g csnp
$ pnpm i -g csnp
$ bun i -g csnp
Using interactive prompts to generate .csnp files for managing code snippets.
.csnp/js/log.csnp
match
.csnp/{SnippetType}/{SnippetFileName}.csnp
SnippetType: js
SnippetFileName: log
Open file .csnp/js/log.csnp
and edit the default code snippets.
---
name: Log
prefix: '-log'
description: my snippet description
---
code snippets
The line code snippets
is a default code snippets.
Just edit and replace it of code console.log
.
---
name: Log
prefix: '-log'
description: log sth
---
console.log($1)
After csnp push
, use the prefix -log
in VSCode to generate code.
Result:
Transform all *.csnp files and store them locally or globally(VSCode).
# local (default)
$ csnp push
# global (VSCode)
$ csnp push --global
Sync all snippets from local or global(VSCode) and store in .csnp dir.
# local (default)
$ csnp pull
# global (VSCode)
$ csnp pull --global
Using Snippet in Visual Studio Code.
MIT