mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-12 16:34:18 +00:00
* Empty fields that are the last of the list *and* match the
snippet's exit are skipped automatically. * Added a printf snippet to show off. * The printf snippet also exhibits the back-adjacent mirror bug
This commit is contained in:
20
snippets/text-mode/cc-mode/c-mode/printf
Normal file
20
snippets/text-mode/cc-mode/c-mode/printf
Normal file
@@ -0,0 +1,20 @@
|
||||
# name : printf
|
||||
# contributor : joaotavora
|
||||
# description : a snippet that is very slightly buggy in 0.6.0b. There *must* be a space before the $2!
|
||||
#
|
||||
# While a per-snippet exit-hook property does not exist, this can be fixed with
|
||||
# this in your .emacs
|
||||
#
|
||||
# (setq yas/after-exit-snippet-hook '(yas/munch-useless-spaces-at-end))
|
||||
#
|
||||
# (defun yas/munch-useless-spaces-at-end ()
|
||||
# (let ((end (1- yas/snippet-end)))
|
||||
# (while (= (char-after end) ?\s)
|
||||
# (setq end (1- end))
|
||||
# (backward-char))
|
||||
# (delete-region (point) yas/snippet-end)))
|
||||
#
|
||||
# but this might break some other snippets...
|
||||
#
|
||||
# --
|
||||
printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")} $2${1:$(if (string-match "%" text) "\);" "")}
|
||||
@@ -2,5 +2,4 @@
|
||||
# key : $m
|
||||
# contributor : joaotavora
|
||||
# --
|
||||
\${${2:n}:${4:\$(${5:reflection-fn})}\}$0
|
||||
|
||||
\${${2:n}:${4:\$(${5:reflection-fn})}\}$0
|
||||
Reference in New Issue
Block a user