@ncko/snippet
v0.1.0
Published
Manage VS Code snippets from the command line
Downloads
3
Maintainers
Readme
Snippet
Manage VS Code snippets from the command line.
Installation
First install the package globally
> npm install -g @ncko/snippet
Then run the config
command.
> snippet config
Now you're ready to use it!
Usage
After installing and running the config command. Create a new snippet stub:
> snippet stub MySnippet mysnip
A new file appears in your current directory called ./snippet.snippet
:
Title: MySnippet
Prefix: mysnip
-------------------------------------------
snippet body here
-------------------------------------------
Edit the body of this file like so:
Title: MySnippet
Prefix: mysnip
-------------------------------------------
console.log("My first snippet!");
console.log("I can set tabstops with defaults like this:", ${1:thing});
-------------------------------------------
Now that your stub is complete, you can write the snippet to VS Code's snippets directory.
> snippet write snippet.snippet javascript
Now, open a javascript file in VS Code, type mysnip
and hit tab.
Commands
snippet config
- After installation, this command must be run to set the folder that snippets will be managed insnippet stub
- generate a stub for a new snippet in the current directorysnippet list <language>
- List all snippets for a given languagesnippet view <language> <prefix>
- View a specific snippetsnippet export <language> <prefix>
- Export a snippet to local file (default: ./snippet.snippet)snippet write <path-to-snippet-file> <language>
- Write a snippet from a local file (default: ./snippet.snippet) to a VS Code snippet filesnippet remove <language> <prefix>
- Delete a snippet
Contributing
If you'd like to help, please send a pull request! There is still some work to be done. Check the issues tab.