mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-05-05 23:28:19 +00:00
more snippets and a bug fix: strange (= nil nil) will cause error in elisp.
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
#name : # =>
|
||||||
|
# --
|
||||||
|
# =>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : alias_method new, old
|
||||||
|
# --
|
||||||
|
alias_method :${new_name}, :${old_name}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#name : case ... end
|
||||||
|
# --
|
||||||
|
case ${1:object}
|
||||||
|
when ${2:condition}
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : for ... in ...; ... end
|
||||||
|
# --
|
||||||
|
for ${1:element} in ${2:collection}
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#name : if ... end
|
||||||
|
# --
|
||||||
|
if ${1:condition}
|
||||||
|
$0
|
||||||
|
end
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#name : if ... else ... end
|
||||||
|
# --
|
||||||
|
if ${1:condition}
|
||||||
|
$2
|
||||||
|
else
|
||||||
|
$3
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : inject(...) { |...| ... }
|
||||||
|
# --
|
||||||
|
inject(${1:0}) { |${2:injection}, ${3:element}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : /usr/bin/ruby -wKU
|
||||||
|
# --
|
||||||
|
#!/usr/bin/ruby -wKU
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : reject { |...| ... }
|
||||||
|
# --
|
||||||
|
reject { |${1:element}| $0 }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#name : select { |...| ... }
|
||||||
|
# --
|
||||||
|
select { |${1:element}| $0 }
|
||||||
+4
-3
@@ -27,7 +27,7 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; User customizable variables
|
;; User customizable variables
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defvar yas/key-syntaxes (list "w" "w_")
|
(defvar yas/key-syntaxes (list "w" "w_" "w_." "^ ")
|
||||||
"A list of syntax of a key. This list is tried in the order
|
"A list of syntax of a key. This list is tried in the order
|
||||||
to try to find a key. For example, if the list is '(\"w\" \"w_\").
|
to try to find a key. For example, if the list is '(\"w\" \"w_\").
|
||||||
And in emacs-lisp-mode, where \"-\" has the syntax of \"_\":
|
And in emacs-lisp-mode, where \"-\" has the syntax of \"_\":
|
||||||
@@ -137,8 +137,9 @@ mode will be listed under the menu \"yasnippet\".")
|
|||||||
(yas/snippet-groups snippet)
|
(yas/snippet-groups snippet)
|
||||||
:test
|
:test
|
||||||
'(lambda (field group)
|
'(lambda (field group)
|
||||||
(= (yas/field-number field)
|
(and (not (null (yas/field-number field)))
|
||||||
(yas/group-number group))))))
|
(= (yas/field-number field)
|
||||||
|
(yas/group-number group)))))))
|
||||||
(if group
|
(if group
|
||||||
(yas/group-add-field group field)
|
(yas/group-add-field group field)
|
||||||
(push (yas/make-group field snippet)
|
(push (yas/make-group field snippet)
|
||||||
|
|||||||
Reference in New Issue
Block a user