mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
more snippets and a bug fix: strange (= nil nil) will cause error in elisp.
This commit is contained in:
parent
8ef771a696
commit
c45eff49e2
3
snippets/ruby-mode/#
Normal file
3
snippets/ruby-mode/#
Normal file
@ -0,0 +1,3 @@
|
||||
#name : # =>
|
||||
# --
|
||||
# =>
|
3
snippets/ruby-mode/am
Normal file
3
snippets/ruby-mode/am
Normal file
@ -0,0 +1,3 @@
|
||||
#name : alias_method new, old
|
||||
# --
|
||||
alias_method :${new_name}, :${old_name}
|
6
snippets/ruby-mode/case
Normal file
6
snippets/ruby-mode/case
Normal file
@ -0,0 +1,6 @@
|
||||
#name : case ... end
|
||||
# --
|
||||
case ${1:object}
|
||||
when ${2:condition}
|
||||
$0
|
||||
end
|
5
snippets/ruby-mode/forin
Normal file
5
snippets/ruby-mode/forin
Normal file
@ -0,0 +1,5 @@
|
||||
#name : for ... in ...; ... end
|
||||
# --
|
||||
for ${1:element} in ${2:collection}
|
||||
$0
|
||||
end
|
5
snippets/ruby-mode/if
Normal file
5
snippets/ruby-mode/if
Normal file
@ -0,0 +1,5 @@
|
||||
#name : if ... end
|
||||
# --
|
||||
if ${1:condition}
|
||||
$0
|
||||
end
|
7
snippets/ruby-mode/ife
Normal file
7
snippets/ruby-mode/ife
Normal file
@ -0,0 +1,7 @@
|
||||
#name : if ... else ... end
|
||||
# --
|
||||
if ${1:condition}
|
||||
$2
|
||||
else
|
||||
$3
|
||||
end
|
3
snippets/ruby-mode/inject
Normal file
3
snippets/ruby-mode/inject
Normal file
@ -0,0 +1,3 @@
|
||||
#name : inject(...) { |...| ... }
|
||||
# --
|
||||
inject(${1:0}) { |${2:injection}, ${3:element}| $0 }
|
3
snippets/ruby-mode/rb
Normal file
3
snippets/ruby-mode/rb
Normal file
@ -0,0 +1,3 @@
|
||||
#name : /usr/bin/ruby -wKU
|
||||
# --
|
||||
#!/usr/bin/ruby -wKU
|
3
snippets/ruby-mode/reject
Normal file
3
snippets/ruby-mode/reject
Normal file
@ -0,0 +1,3 @@
|
||||
#name : reject { |...| ... }
|
||||
# --
|
||||
reject { |${1:element}| $0 }
|
3
snippets/ruby-mode/select
Normal file
3
snippets/ruby-mode/select
Normal file
@ -0,0 +1,3 @@
|
||||
#name : select { |...| ... }
|
||||
# --
|
||||
select { |${1:element}| $0 }
|
@ -27,7 +27,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; 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
|
||||
to try to find a key. For example, if the list is '(\"w\" \"w_\").
|
||||
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)
|
||||
:test
|
||||
'(lambda (field group)
|
||||
(= (yas/field-number field)
|
||||
(yas/group-number group))))))
|
||||
(and (not (null (yas/field-number field)))
|
||||
(= (yas/field-number field)
|
||||
(yas/group-number group)))))))
|
||||
(if group
|
||||
(yas/group-add-field group field)
|
||||
(push (yas/make-group field snippet)
|
||||
|
Loading…
x
Reference in New Issue
Block a user