Created
December 7, 2020 23:53
-
-
Save brenopacheco/9ca5c7c7e8cc76cccde33b30a0dd1184 to your computer and use it in GitHub Desktop.
convert yasnippet to vsnip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Roughly converts yasnippet format snippets to vsnip (vs code like) snippets | |
" performs in-place substitutions. make sure not to use autopairs plugin. | |
" | |
" example: | |
" | |
" # -*- mode: snippet -*- | |
" # name: equals | |
" # key: eq | |
" # -- | |
" public boolean equals(${1:Class} other) { | |
" $0 | |
" } | |
" | |
" will translate to: | |
" | |
" "equals": { | |
" "prefix": "eq", | |
" "description": "eq", | |
" "body": [ | |
" "public boolean equals(${1:Class} other) {", | |
" "$0", | |
" "}" | |
" ] | |
" }, | |
function Convert() abort | |
g/^$/d | |
2norm 0df:r"A": { | |
3norm 0df:xi"prefix": " | |
3norm 0A", | |
3norm yyp | |
4s/prefix/description | |
5s/.*/"body": [ | |
6,$norm I" | |
6,$norm A", | |
1d | |
2,$> | |
1,$> | |
5,$> | |
$norm $xo] | |
$norm <o}, | |
$norm < | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment