Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/djyde/snp
VS Code code snippet generator
https://github.com/djyde/snp
Last synced: about 1 month ago
JSON representation
VS Code code snippet generator
- Host: GitHub
- URL: https://github.com/djyde/snp
- Owner: djyde
- License: mit
- Created: 2020-12-24T12:05:46.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-09T09:15:57.000Z (over 2 years ago)
- Last Synced: 2024-08-02T15:48:10.534Z (4 months ago)
- Language: Go
- Homepage:
- Size: 1.63 MB
- Stars: 70
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - snp
README
# snp
VS Code code snippets generator.
## Install
```
curl -sf https://gobinaries.com/djyde/snp | sh
```For Windows users, please download it in [release](https://github.com/djyde/snp/releases) page.
## Usage
> See [my snippets](https://github.com/djyde/snippets) as example.
```
$ mkdir my-snippets
$ cd my-snippets$ touch csl.snp
``````js
// csl.snp---
scope: javascript
description: console log
---console.log($1)
``````bash
$ snp -u
````snp -u` would write a code snippet file to your VS Code snippets folder. Then when you type `csl` in VS Code, the code snippet appear in IntelliSense.
> The program only find the files with `.snp` extension in current working directory.
### The `.snp` file
`.snp` is just a file with [front matter](https://jekyllrb.com/docs/front-matter) and the snippet code. You should pass at least these attributes:
- [scope](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_language-snippet-scope)
- **description** The description of this snippetThe file name would become the snippet prefix (the trigger text).
For the snippet syntax, you should see the [VS Code Docs](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax)
## CLI Options
```
$ snp --helpUsage of snp:
-p Should print out the json text
-u Should automatically update snippet file in VS Code
-v Print version```
### -p
Instead of updating the file on VS Code snippets folder, you could use `-p` to just print out the JSON and then use this output to do what you want, like output to a file:
```
snp -p > my-snippet.code-snippets
```## Build
```
go installgo build
```