One possible solution would be to control the snippets with key bindings by adding a line of code to each snippet -- e.g., # binding: C-I a b c
or # binding: C-I d e f
The combination C-I
is equivalent to the tab key and the space between the following letters means that they are pressed individually one at a time. In addition, the following lines of code can also be modified to reflect different key(s): # key: a_b_c
and # key: d_e_f
.
The variable yas-snippet-dirs
can be used to control the location(s) of snippets. It may be a good idea to move snippets to a different location so that they are not touched by future updates (e.g., el-get
).
The xxx
snippet looks like this:
ORIGINAL
# -*- mode: snippet -*-
# name: xxx
# key: x
# --
`(yas-with-comment "XXX: ")`
MODIFIED
# -*- mode: snippet -*-
# name: xxx
# key: a_b_c
# binding: C-I a b c
# --
`(yas-with-comment "XXX: ")`
The todo
snippet looks like this:
ORIGINAL
# -*- mode: snippet -*-
# name: todo
# key: t
# --
`(yas-with-comment "TODO: ")`
MODIFIED
# -*- mode: snippet -*-
# name: todo
# key: d_e_f
# binding: C-I d e f
# --
`(yas-with-comment "TODO: ")`
For those who are curious, the function yas-with-comment
looks like this
(defun yas-with-comment (str)
(format "%s%s%s" comment-start str comment-end))
yas-snippet-dirs
and move your snippets to a location that will not be touched by future updates from MELPA. – Thill