mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Files ruby-mode snippets updated to work with yasnippet.
This commit is contained in:
parent
02408621e8
commit
32c837290d
@ -4,4 +4,4 @@
|
||||
# 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 }
|
||||
File.open(${1:"${2:path/to/file}"}${3:$(if (string-match "^[rwab+]+$" yas/text) ", '" "")}${3:w}${3:$(if (string-match "^[rwab+]+$" yas/text) "'" "")}) { |${4:file}| $0 }
|
@ -4,4 +4,4 @@
|
||||
# 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 }
|
||||
open(${1:"${2:path/or/url/or/pipe}"}${3:$(if (string-match "^[rwab+]+$" yas/text) ", '" "")}${3:w}${3:$(if (string-match "^[rwab+]+$" yas/text) "'" "")}) { |${4:io}| $0 }
|
@ -9,7 +9,7 @@ require "optparse"
|
||||
options = {${1::default => "args"}}
|
||||
|
||||
ARGV.options do |opts|
|
||||
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2/^\s*$|(.*\S.*)/(?1: )/}${2:OTHER_ARGS}"
|
||||
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2:$(if (string= yas/text "") "" " ")}${2:OTHER_ARGS}"
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Specific Options:"
|
||||
|
@ -1,10 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# 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}|
|
||||
$0
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user