mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
* Small change to textmate_import.rb to import (commented) "scope" directive
* Reimported the HTML and Ruby bundle with the previous fix * Applied Rob Christie's patches of issues 109 and 110 0001-Deleted-because-this-is-supported-via-dwim-with-rcod.patch 0002-Updated-snippets.patch 0003-Added-setup.el-file-that-must-be-loaded-prior-to-loa.patch 0004-ruby-mode-class-and-module-snippets-updated.patch 0005-changes-to-counting-snippets-and-some-declaration-sn.patch patching some things manually. Thanks a lot Rob!
This commit is contained in:
parent
a18e5fda5d
commit
deb0755824
@ -2,5 +2,6 @@
|
||||
# key: Array
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Array.new(10) { |i| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
Array.new(${1:10}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:i}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
||||
Array.new(${1:10}) { ${2:$(if (string= yas/text "") "" "|")}${2:i}${2:$(if (string= yas/text "") "" "|")} $0 }
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: deli
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: delete_if { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
delete_if { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: fil
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: fill(range) { |i| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
fill(${1:range}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:i}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
||||
fill(${1:range}) { ${2:$(if (string= yas/text "") "" "|")}${2:variable}${2:$(if (string= yas/text "") "" "|")} $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: flao
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: flatten_once()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
inject(Array.new) { |${1:arr}, ${2:a}| ${1:arr}.push(*${2:a}) }
|
||||
inject(Array.new) { | ${1:arr}, ${2:a}| $1.push(*$2) }
|
@ -2,5 +2,6 @@
|
||||
# key: zip
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: zip(enums) { |row| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
zip(${1:enums}) { |${2:row}| $0 }
|
@ -2,7 +2,8 @@
|
||||
# key: do
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Insert do |variable| … end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
do ${1:$(if (string= yas/text "") "" "|")}${1:variable}${1:$(if (string= yas/text "") "" "|")}
|
||||
$0
|
||||
do${1/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1: |)/}${1:variable}${1/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}
|
||||
$0
|
||||
end
|
@ -2,6 +2,6 @@
|
||||
# key: lam
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: lambda { |args| .. }
|
||||
# expand-env: ((yas/wrap-around-region t))
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
lambda { ${1:$(if (string= yas/text "") "" "|")}${1:variable}${1:$(if (string= yas/text "") "" "|")} $0 }
|
||||
lambda { ${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${1:args}${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
@ -2,6 +2,6 @@
|
||||
# key: {
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Insert { |variable| … }
|
||||
# expand-env: ((yas/wrap-around-region t))
|
||||
## condition: "source.ruby - string - comment"
|
||||
# --
|
||||
{ ${1:$(if (string= yas/text "") "" "|")}${1:variable}${1:$(if (string= yas/text "") "" "|")} $0 }
|
||||
{ ${1/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${1:variable}${1/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}${2:`yas/selected-text`}
|
@ -2,13 +2,11 @@
|
||||
# key: cla-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. < DelegateClass .. initialize .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} < DelegateClass(${2:ParentClass})
|
||||
def initialize${3/(^.*?\S.*)|.*/(?1:\()/}${3:args}${3/(^.*?\S.*)|.*/(?1:\))/}
|
||||
super(${4:del_obj})
|
||||
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
class ${1:`(yas/ruby-infer-class-name)`} < DelegateClass(${2:ParentClass})
|
||||
def initialize${3:$(if (string= yas/text "") "" "(")}${3:args}${3:$(if (string= yas/text "") "" ")")}
|
||||
super(${4:del_obj})
|
||||
$0
|
||||
end
|
||||
end
|
@ -2,11 +2,10 @@
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. < ParentClass .. initialize .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} < ${2:ParentClass}
|
||||
def initialize${3/(^.*?\S.*)|.*/(?1:\()/}${3:args}${3/(^.*?\S.*)|.*/(?1:\))/}
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
class ${1:`(yas/ruby-infer-class-name)`} < ${2:ParentClass}
|
||||
def initialize${3:$(if (string= yas/text "") "" "(")}${3:args}${3:$(if (string= yas/text "") "" ")")}
|
||||
$0
|
||||
end
|
||||
end
|
@ -2,11 +2,10 @@
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: ClassName = Struct .. do .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} = Struct.new(:${2:attr_names}) do
|
||||
def ${3:method_name}
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
${1:`(yas/ruby-infer-class-name)`} = Struct.new(:${2:attr_names}) do
|
||||
def ${3:method_name}
|
||||
$0
|
||||
end
|
||||
end
|
@ -2,7 +2,8 @@
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
class ${1:`(yas/ruby-infer-class-name)`}
|
||||
$0
|
||||
end
|
@ -2,11 +2,11 @@
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class .. initialize .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/}
|
||||
$0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
class ${1:`(yas/ruby-infer-class-name)`}
|
||||
def initialize${2:$(if (string= yas/text "") "" "(")}${2:args}${2:$(if (string= yas/text "") "" ")")}
|
||||
$0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2,18 +2,19 @@
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class BlankSlate .. initialize .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class ${1:BlankSlate}
|
||||
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
|
||||
|
||||
def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/}
|
||||
def initialize${2:$(if (string= yas/text "") "" "(")}${2:args}${2:$(if (string= yas/text "") "" ")")}
|
||||
@${3:delegate} = ${4:delegate_object}
|
||||
|
||||
$0
|
||||
end
|
||||
|
||||
def method_missing(meth, *args, &block)
|
||||
@${3:delegate}.send(meth, *args, &block)
|
||||
@$3.send(meth, *args, &block)
|
||||
end
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class << self .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class << ${1:self}
|
||||
$0
|
||||
|
@ -2,8 +2,9 @@
|
||||
# key: mod
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: module .. ClassMethods .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
module ${1:`(yas/ruby-infer-class-name)`}
|
||||
module ClassMethods
|
||||
$0
|
||||
end
|
||||
|
@ -2,7 +2,8 @@
|
||||
# key: mod
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: module .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
$0
|
||||
module ${1:`(yas/ruby-infer-class-name)`}
|
||||
$0
|
||||
end
|
@ -2,8 +2,9 @@
|
||||
# key: mod
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: module .. module_function .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
|
||||
module ${1:`(yas/ruby-infer-class-name)`}
|
||||
module_function
|
||||
|
||||
$0
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: dow
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: downto(0) { |n| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
downto(${1:0}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
||||
downto(${1:0}) { ${2:$(if (string= yas/text "") "" "|")}${2:n}${2:$(if (string= yas/text "") "" "|")} $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: loo
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: loop { .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
loop { $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: ste
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: step(2) { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
step(${1:2}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
||||
step(${1:2}) { ${2:$(if (string= yas/text "") "" "|")}${2:n}${2:$(if (string= yas/text "") "" "|")} $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: tim
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: times { |n| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
times { ${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${1:n}${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
||||
times { ${1:$(if (string= yas/text "") "" "|")}${1:n}${1:$(if (string= yas/text "") "" "|")} $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: upt
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: upto(1.0/0.0) { |n| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
upto(${1:1.0/0.0}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
||||
upto(${1:1.0/0.0}) { ${2:$(if (string= yas/text "") "" "|")}${2:n}${2:$(if (string= yas/text "") "" "|")} $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: rb
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: #!/usr/bin/env ruby -wKU
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
#!/usr/bin/env ruby${TM_RUBY_SWITCHES: -wKU}
|
||||
#!/usr/bin/env ruby -wKU
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: ife
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: if … else … end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
if ${1:condition}
|
||||
$2
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: if
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: if … end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
if ${1:condition}
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: case
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: case … end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
case ${1:object}
|
||||
when ${2:condition}
|
||||
|
@ -2,10 +2,11 @@
|
||||
# key: begin
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: begin … rescue … end
|
||||
# binding: "^W"
|
||||
## binding: "^W"
|
||||
## condition: "source.ruby - comment"
|
||||
# --
|
||||
${TM_SELECTED_TEXT/([\t ]*).*/$1/m}begin
|
||||
${3:${TM_SELECTED_TEXT/(\A.*)|(.+)|\n\z/(?1:$0:(?2:\t$0))/g}}
|
||||
${TM_SELECTED_TEXT/([\t ]*).*/$1/m}rescue ${1:Exception}${2/.+/ => /}${2:e}
|
||||
${TM_SELECTED_TEXT/([\t ]*).*/$1/m} $0
|
||||
${TM_SELECTED_TEXT/([\t ]*).*/$1/m}end
|
||||
begin
|
||||
`(or yas/selected-text (car kill-ring))`$3
|
||||
rescue ${1:Exception}${2:$(if (string= yas/text "") "" " => ")}${2:e}
|
||||
$0
|
||||
end
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: end
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: __END__
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
__END__
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: app
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: application { .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
if __FILE__ == \$PROGRAM_NAME
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: def
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def … end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
def ${1:method_name}
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: elsif
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: elsif ...
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
elsif ${1:condition}
|
||||
$0
|
@ -2,5 +2,6 @@
|
||||
# key: req
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: require ".."
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
require "$0"
|
@ -2,5 +2,6 @@
|
||||
# key: reqg-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: require_gem ".."
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
require "$0"
|
@ -2,6 +2,7 @@
|
||||
# key: unless
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: unless … end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
unless ${1:condition}
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: until
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: until ... end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
until ${1:condition}
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: usai
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: usage_if()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
if ARGV.$1
|
||||
abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: usau
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: usage_unless()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
unless ARGV.$1
|
||||
abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: when
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: when …
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
when ${1:condition}
|
||||
$0
|
@ -2,6 +2,7 @@
|
||||
# key: while
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: while ... end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
while ${1:condition}
|
||||
$0
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: ea
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eab
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_byte { |byte| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_byte { |${1:byte}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eac-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_char { |chr| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_char { |${1:chr}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eac-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_cons(..) { |group| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_cons(${1:2}) { |${2:group}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eai
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_index { |i| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_index { |${1:i}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eak
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_key { |key| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_key { |${1:key}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eal
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_line { |line| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_line$1 { |${2:line}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eap
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_pair { |name, val| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_pair { |${1:name}, ${2:val}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eas-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_slice(..) { |group| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_slice(${1:2}) { |${2:group}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eav
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_value { |val| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_value { |${1:val}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: eawi
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: each_with_index { |e, i| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
each_with_index { |${1:e}, ${2:i}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: inj
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: inject(init) { |mem, var| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
inject${1/.+/(/}${1:init}${1/.+/)/} { |${2:mem}, ${3:var}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: map
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: map { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
map { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: mapwi-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: map_with_index { |e, i| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
enum_with_index.map { |${1:e}, ${2:i}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: reve
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: reverse_each { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
reverse_each { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: Dir
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Dir.glob("..") { |file| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
Dir.glob(${1:"${2:dir/glob/*}"}) { |${3:file}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: Dir
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Dir[".."]
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
Dir[${1:"${2:glob/**/*.rb}"}]
|
@ -2,5 +2,6 @@
|
||||
# key: File
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: File.foreach ("..") { |line| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
File.foreach(${1:"${2:path/to/file}"}) { |${3:line}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: File
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: File.open("..") { |file| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
File.open(${1:"${2:path/to/file}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:file}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: File
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: File.read("..")
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
File.read(${1:"${2:path/to/file}"})
|
@ -2,5 +2,6 @@
|
||||
# key: dir
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: directory()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
File.dirname(__FILE__)
|
@ -2,5 +2,6 @@
|
||||
# key: ope
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: open("path/or/url", "w") { |io| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
open(${1:"${2:path/or/url/or/pipe}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:io}| $0 }
|
@ -2,6 +2,7 @@
|
||||
# key: optp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: option_parse { .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
require "optparse"
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: patfh
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: path_from_here( .. )
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
File.join(File.dirname(__FILE__), *%w[${1:rel path here}])
|
@ -2,6 +2,7 @@
|
||||
# key: unif
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: unix_filter { .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
ARGF.each_line$1 do |${2:line}|
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: opt
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: option(..)
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
opts.on( "-${1:o}", "--${2:long-option-name}"${3/^\s*$|(.*\S.*)/(?1:, )/}${3:String},
|
||||
"${4:Option description.}" ) do |${6:opt}|
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: Hash
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Hash.new { |hash, key| hash[key] = .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
Hash.new { |${1:hash}, ${2:key}| ${1:hash}[${2:key}] = $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: :
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Hash Pair — :key => "value"
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
:${1:key} => ${2:"${3:value}"}${4:, }
|
@ -1,6 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Hash Pointer — =>
|
||||
# binding: "^l"
|
||||
## binding: "^l"
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
=>
|
@ -2,5 +2,6 @@
|
||||
# key: clafn
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: class_from_name()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
split("::").inject(Object) { |par, const| par.const_get(const) }
|
@ -2,5 +2,6 @@
|
||||
# key: deec
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: deep_copy(..)
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
Marshal.load(Marshal.dump(${0:obj_to_copy}))
|
@ -2,5 +2,6 @@
|
||||
# key: sinc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: singleton_class()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
class << self; self end
|
@ -1,7 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Insert ERb’s <% .. %> or <%= .. %>
|
||||
# binding: "^>"
|
||||
# expand-env: ((yas/wrap-around-region t))
|
||||
## binding: "C-c <"
|
||||
## condition: "text.html, source.yaml, meta.erb"
|
||||
# --
|
||||
<%= $0 %>
|
@ -2,5 +2,6 @@
|
||||
# key: am
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: alias_method ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
alias_method :${1:new_name}, :${0:old_name}
|
@ -2,5 +2,6 @@
|
||||
# key: rw
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: attr_accessor ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
attr_accessor :${0:attr_names}
|
||||
attr_accessor :${1:attr_names}
|
@ -2,5 +2,6 @@
|
||||
# key: r
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: attr_reader ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
attr_reader :${0:attr_names}
|
@ -2,5 +2,6 @@
|
||||
# key: w
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: attr_writer ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
attr_writer :${0:attr_names}
|
@ -2,6 +2,7 @@
|
||||
# key: defmm
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def method_missing .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
def method_missing(meth, *args, &blk)
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: defs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def self .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
def self.${1:class_method_name}
|
||||
$0
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: defd
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def_delegator ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}
|
@ -2,5 +2,6 @@
|
||||
# key: defds
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def_delegators ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
def_delegators :${1:@del_obj}, :${0:del_methods}
|
@ -2,5 +2,6 @@
|
||||
# key: Forw-
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: extend Forwardable
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
extend Forwardable
|
@ -2,6 +2,7 @@
|
||||
# key: Comp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: include Comparable ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
include Comparable
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: Enum
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: include Enumerable ..
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
include Enumerable
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: ran
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: randomize()
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
sort_by { rand }
|
@ -2,5 +2,6 @@
|
||||
# key: sor
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: sort { |a, b| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
sort { |a, b| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: sorb
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: sort_by { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
sort_by { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: y
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: :yields:
|
||||
## condition: "source.ruby comment"
|
||||
# --
|
||||
:yields: ${0:arguments}
|
@ -2,6 +2,7 @@
|
||||
# key: =b
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: New Block
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
`[[ $TM_LINE_INDEX != 0 ]] && echo; echo`=begin rdoc
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: nam
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: namespace :.. do .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
namespace :${1:${TM_FILENAME/\.\w+//}} do
|
||||
$0
|
||||
|
@ -2,6 +2,7 @@
|
||||
# key: tas
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: task :task_name => [:dependent, :tasks] do .. end
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
desc "${1:Task description}"
|
||||
task :${2:${3:task_name} => ${4:[:${5:dependent, :tasks}]}} do
|
||||
|
@ -2,5 +2,6 @@
|
||||
# key: all
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: all? { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
all? { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: any
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: any? { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
any? { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: cl
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: classify { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
classify { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: col
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: collect { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
collect { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: det
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: detect { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
detect { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: fet
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: fetch(name) { |key| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
fetch(${1:name}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:key}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }
|
@ -2,5 +2,6 @@
|
||||
# key: fin
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: find { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
find { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: fina
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: find_all { |e| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
find_all { |${1:e}| $0 }
|
@ -2,5 +2,6 @@
|
||||
# key: gre
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: grep(/pattern/) { |match| .. }
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
grep(${1:/${2:pattern}/}) { |${3:match}| $0 }
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user