Updates to imported ruby-mode block snippets.

This commit is contained in:
Rob Christie 2009-10-22 14:06:52 +00:00
parent fb1a98dcbf
commit ca2b25e84a
3 changed files with 6 additions and 4 deletions

View File

@ -4,6 +4,6 @@
# name: Insert do |variable| … end # name: Insert do |variable| … end
## condition: "source.ruby" ## condition: "source.ruby"
# -- # --
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:|)/} do ${1:$(if (string= yas/text "") "" "|")}${1:variable}${1:$(if (string= yas/text "") "" "|")}
$0 $0
end end

View File

@ -4,4 +4,4 @@
# name: lambda { |args| .. } # name: lambda { |args| .. }
## condition: "source.ruby" ## condition: "source.ruby"
# -- # --
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 } lambda { ${1:$(if (string= yas/text "") "" "|")}${1:args}${1:$(if (string= yas/text "") "" "|")}$0 }

View File

@ -1,7 +1,9 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# key: { # key: {
# contributor: Translated from TextMate Snippet # contributor: Translated from TextMate Snippet
# assumes some sort of autopairing of the braces such as autopair.el or ruby electric
# that would have added the closing brace.
# name: Insert { |variable| … } # name: Insert { |variable| … }
## condition: "source.ruby - string - comment" ## condition: "source.ruby - string - comment"
# -- # --
{ ${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`} { ${1:$(if (string= yas/text "") "" "|")}${1:variable}${1:$(if (string= yas/text "") "" "|")}${2:`yas/selected-text`}