Skip to content

Commit 7a99636

Browse files
committed
Add YASnippet metadata and placeholder snippets
This is partly done for parity with YASnippet, whose docs make a passing mention of "snippets for writing snippets" (`vars`, `$f`, and `$m`). See joaotavora/yasnippet-snippets@ac385b0.
1 parent 05e1b34 commit 7a99636

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org).
99
[Unpublished]
1010
------------------------------------------------------------------------
1111
* __Added:__ Comment highlighting for interpreter directives (hashbangs)
12+
* __Added:__ Snippets for [YASnippet][] metadata and placeholders
1213
* __Fixed:__ [Various inaccuracies][1] related to modeline matching
1314

1415
[1]: https://github.com/github/linguist/pull/5271

snippets/snippets.cson

+52-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
$3
1313
"""
1414

15+
Snippet2:
16+
prefix: "vars"
17+
leftLabel: "yas"
18+
description: "Extended snippet header with less common metadata."
19+
descriptionMoreURL: "https://github.com/joaotavora/yasnippet-snippets/blob/ac385b0e/snippet-mode/vars"
20+
body: """
21+
# -*- mode: snippet -*-
22+
# name: $1${2:
23+
# key: ${3:trigger-key}}${4:
24+
# keybinding: ${5:keybinding}}${6:
25+
# expand-env: (${7:})}
26+
# contributor: $6
27+
# --
28+
$0
29+
"""
30+
1531
Modeline1:
1632
prefix: "mo"
1733
body: "# -*- mode: snippet -*-"
@@ -40,9 +56,44 @@
4056
description: "Optional human-readable label for snippet's menu entry."
4157
descriptionMoreURL: "http://joaotavora.github.io/yasnippet/snippet-development.html#org592456a"
4258

59+
Field:
60+
prefix: "$f"
61+
body: "\\${${1:${2:n}:}$3${4:\\$(${5:lisp-fn})}\\}$0"
62+
leftLabel: "yas"
63+
description: "<code>${…}</code> field"
64+
descriptionMoreURL: "https://github.com/joaotavora/yasnippet-snippets/blob/ac385b0e/snippet-mode/field"
65+
66+
Group:
67+
prefix: "g"
68+
body: "# group: ${1:Menu grouping}"
69+
leftLabel: "yas"
70+
description: "Snippet menu grouping."
71+
descriptionMoreURL: "http://joaotavora.github.io/yasnippet/snippet-development.html#orgd710184"
72+
73+
Mirror:
74+
prefix: "$m"
75+
body: "\\${${2:n}:${4:\\$(${5:reflection-fn})}\\}$0"
76+
leftLabel: "yas"
77+
description: "`${n:$(…)}` mirror"
78+
descriptionMoreURL: "https://github.com/joaotavora/yasnippet-snippets/blob/ac385b0e/snippet-mode/mirror"
79+
80+
Author:
81+
prefix: "au"
82+
body: "# contributor: ${1:John Doe} <${2:john.doe@email}>$0"
83+
leftLabel: "yas"
84+
description: "Name of snippet's author or contributor."
85+
descriptionMoreURL: "http://joaotavora.github.io/yasnippet/snippet-development.html#orge2b38b9"
86+
87+
AtomDescriptionMoreURL:
88+
prefix: "url"
89+
body: "# atom-description-more-url: ${1:http://more.info/}"
90+
leftLabel: "yas"
91+
description: "Atom-specific header used by `yas2atom`"
92+
descriptionMoreURL: "https://github.com/atom/snippets#optional-parameters"
93+
4394
AtomSelector:
4495
prefix: "as"
4596
body: "# atom-selector: ${1::not(*)}"
4697
leftLabel: "yas"
47-
description: "Atom-specific header used by <code>yas2atom</code>."
98+
description: "Atom-specific header used by `yas2atom`."
4899
descriptionMoreURL: "https://github.com/Alhadis/YASR"

0 commit comments

Comments
 (0)