Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

start converting to the snipmate format, still lots to do

  • Loading branch information...
commit ba6fa12aa45619e8758ba76b73df29f2561dba14 1 parent 522e5ca
@scrooloose scrooloose authored
Showing with 234 additions and 220 deletions.
  1. +2 −2 ruby-rails/asd.snippet
  2. +2 −2 ruby-rails/asnd.snippet
  3. +11 −11 ruby-rails/defcreate.snippet
  4. +6 −6 ruby-rails/defdestroy.snippet
  5. +1 −1  ruby-rails/defedit.snippet
  6. +5 −5 ruby-rails/defindex.snippet
  7. +5 −5 ruby-rails/defnew.snippet
  8. +5 −5 ruby-rails/defshow.snippet
  9. +11 −11 ruby-rails/defupdate.snippet
  10. +1 −1  ruby-rails/mapwo.snippet
  11. +1 −1  ruby-rails/mct.snippet
  12. +6 −6 ruby-rails/migration.snippet
  13. +1 −1  ruby-rails/rest.snippet
  14. +2 −2 ruby-rails/ru.snippet
  15. +10 −10 ruby-rails/sweeper.snippet
  16. +1 −1  ruby-rails/tcb.snippet
  17. +1 −1  ruby-rails/tcbi.snippet
  18. +1 −1  ruby-rails/tcd.snippet
  19. +1 −1  ruby-rails/tcda.snippet
  20. +1 −1  ruby-rails/tcdt.snippet
  21. +1 −1  ruby-rails/tcf.snippet
  22. +1 −1  ruby-rails/tch.snippet
  23. +1 −1  ruby-rails/tci.snippet
  24. +1 −1  ruby-rails/tcl.snippet
  25. +1 −1  ruby-rails/tcs.snippet
  26. +1 −1  ruby-rails/tct.snippet
  27. +1 −1  ruby-rails/tcti.snippet
  28. +1 −1  ruby-rails/tcts.snippet
  29. +1 −1  ruby-rails/tctss.snippet
  30. +1 −1  ruby-rails/tre.snippet
  31. +1 −1  ruby/Md.snippet
  32. +1 −1  ruby/Ml.snippet
  33. +1 −1  ruby/Pn.snippet
  34. +1 −1  ruby/Yd.snippet
  35. +1 −1  ruby/Yl.snippet
  36. +1 −1  ruby/am.snippet
  37. +1 −1  ruby/anr.snippet
  38. +1 −1  ruby/as.snippet
  39. +1 −1  ruby/ase.snippet
  40. +1 −1  ruby/asid.snippet
  41. +1 −1  ruby/asio.snippet
  42. +1 −1  ruby/asko.snippet
  43. +1 −1  ruby/asm.snippet
  44. +1 −1  ruby/asn.snippet
  45. +1 −1  ruby/asne.snippet
  46. +1 −1  ruby/asnm.snippet
  47. +1 −1  ruby/asnn.snippet
  48. +1 −1  ruby/asns.snippet
  49. +1 −1  ruby/asnt.snippet
  50. +1 −1  ruby/aso.snippet
  51. +1 −1  ruby/asr.snippet
  52. +1 −1  ruby/asrt.snippet
  53. +1 −1  ruby/ass.snippet
  54. +1 −1  ruby/ast.snippet
  55. +3 −3 ruby/bm.snippet
  56. +3 −3 ruby/case.snippet
  57. +1 −1  ruby/class.snippet
  58. +2 −2 ruby/def.snippet
  59. +2 −2 ruby/defmm.snippet
  60. +3 −3 ruby/defs.snippet
  61. +3 −3 ruby/deft.snippet
  62. +1 −1  ruby/detect.snippet
  63. +2 −2 ruby/detecto.snippet
  64. +1 −1  ruby/dglob.snippet
  65. +1 −1  ruby/do.snippet
  66. +2 −2 ruby/dop.snippet
  67. +1 −1  ruby/ea.snippet
  68. +1 −1  ruby/each.snippet
  69. +1 −1  ruby/each_with_index.snippet
  70. +2 −2 ruby/each_with_indexo.snippet
  71. +2 −2 ruby/eacho.snippet
  72. +2 −2 ruby/eado.snippet
  73. +1 −1  ruby/eawi.snippet
  74. +2 −2 ruby/eawido.snippet
  75. +2 −2 ruby/elsif.snippet
  76. +1 −1  ruby/fileeach.snippet
  77. +1 −1  ruby/fopen.snippet
  78. +1 −1  ruby/fread.snippet
  79. +3 −3 ruby/if.snippet
  80. +3 −3 ruby/ife.snippet
  81. +1 −1  ruby/inj.snippet
  82. +2 −2 ruby/injdo.snippet
  83. +1 −1  ruby/inject.snippet
  84. +2 −2 ruby/injecto.snippet
  85. +1 −1  ruby/map.snippet
  86. +2 −2 ruby/mapdo.snippet
  87. +2 −2 ruby/mapo.snippet
  88. +1 −1  ruby/mod.snippet
  89. +9 −9 ruby/module.snippet
  90. +3 −3 ruby/nam.snippet
  91. +1 −1  ruby/ope.snippet
  92. +1 −1  ruby/pathhere.snippet
  93. +1 −1  ruby/r.snippet
  94. +1 −1  ruby/reject.snippet
  95. +2 −2 ruby/rejecto.snippet
  96. +1 −1  ruby/rep.snippet
  97. +1 −1  ruby/rw.snippet
  98. +1 −1  ruby/select.snippet
  99. +2 −2 ruby/selecto.snippet
  100. +1 −1  ruby/sort.snippet
  101. +2 −2 ruby/sorto.snippet
  102. +4 −4 ruby/tas.snippet
  103. +4 −4 ruby/task.snippet
  104. +4 −4 ruby/tc.snippet
  105. +2 −1  ruby/unless.snippet
  106. +2 −2 ruby/unlesse.snippet
  107. +1 −1  ruby/w.snippet
  108. +3 −3 ruby/while.snippet
  109. +1 −1  ruby/xmlr.snippet
  110. +3 −3 ruby/xpa.snippet
  111. +1 −1  ruby/zip.snippet
  112. +16 −3 support_functions.vim
View
4 ruby-rails/asd.snippet
@@ -1,3 +1,3 @@
assert_difference "<+Model+>.<+count+>", <+Model+> do
- <++>
-end
+ <++>
+end
View
4 ruby-rails/asnd.snippet
@@ -1,3 +1,3 @@
assert_no_difference "<+Model+>.<+count+>" do
- <++>
-end
+ <++>
+end
View
22 ruby-rails/defcreate.snippet
@@ -1,14 +1,14 @@
def create
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
- respond_to do |wants|
- if @\<c-r>=NS_underscore(snippet_classname)\<cr>.save
- flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully created.'
- wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
- wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>, :status => :created, :location => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
- else
- wants.html { render :action => "new" }
- wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
- end
- end
+ respond_to do |wants|
+ if @\<c-r>=NS_underscore(snippet_classname)\<cr>.save
+ flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully created.'
+ wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
+ wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>, :status => :created, :location => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
+ else
+ wants.html { render :action => "new" }
+ wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
+ end
+ end
end
View
12 ruby-rails/defdestroy.snippet
@@ -1,9 +1,9 @@
def destroy
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
- @\<c-r>=NS_underscore(snippet_classname)\<cr>.destroy
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
+ @\<c-r>=NS_underscore(snippet_classname)\<cr>.destroy
- respond_to do |wants|
- wants.html { redirect_to(\<c-r>=NS_underscore(snippet_classname)\<cr>s_url) }
- wants.xml { head :ok }
- end
+ respond_to do |wants|
+ wants.html { redirect_to(\<c-r>=NS_underscore(snippet_classname)\<cr>s_url) }
+ wants.xml { head :ok }
+ end
end
View
2  ruby-rails/defedit.snippet
@@ -1,3 +1,3 @@
def edit
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
end
View
10 ruby-rails/defindex.snippet
@@ -1,8 +1,8 @@
def index
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.all
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.all
- respond_to do |wants|
- wants.html # index.html.erb
- wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>s }
- end
+ respond_to do |wants|
+ wants.html # index.html.erb
+ wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>s }
+ end
end
View
10 ruby-rails/defnew.snippet
@@ -1,8 +1,8 @@
def new
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new
- respond_to do |wants|
- wants.html # new.html.erb
- wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
- end
+ respond_to do |wants|
+ wants.html # new.html.erb
+ wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
+ end
end
View
10 ruby-rails/defshow.snippet
@@ -1,8 +1,8 @@
def show
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
- respond_to do |wants|
- wants.html # show.html.erb
- wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
- end
+ respond_to do |wants|
+ wants.html # show.html.erb
+ wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
+ end
end
View
22 ruby-rails/defupdate.snippet
@@ -1,14 +1,14 @@
def update
- @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
+ @\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
- respond_to do |wants|
- if @\<c-r>=NS_underscore(snippet_classname)\<cr>.update_attributes(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
- flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully updated.'
- wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
- wants.xml { head :ok }
- else
- wants.html { render :action => "edit" }
- wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
- end
- end
+ respond_to do |wants|
+ if @\<c-r>=NS_underscore(snippet_classname)\<cr>.update_attributes(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
+ flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully updated.'
+ wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
+ wants.xml { head :ok }
+ else
+ wants.html { render :action => "edit" }
+ wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
+ end
+ end
end
View
2  ruby-rails/mapwo.snippet
@@ -1,3 +1,3 @@
<+map+>.with_options :<+controller+> => '<+thing+>' do |<+thing+>|
- <++>
+ <++>
end
View
2  ruby-rails/mct.snippet
@@ -1,3 +1,3 @@
create_table :<+table_name+> do |t|
- t.column :<+name+>, :<+type+>
+ t.column :<+name+>, :<+type+>
end
View
12 ruby-rails/migration.snippet
@@ -1,9 +1,9 @@
class \<c-r>=Snippet_MigrationNameFromFilename()\<cr> < ActiveRecord::Migration
- def self.up
- <++>
- end
+ def self.up
+ <++>
+ end
- def self.down
- <++>
- end
+ def self.down
+ <++>
+ end
end
View
2  ruby-rails/rest.snippet
@@ -1,3 +1,3 @@
respond_to do |wants|
- wants.<+html+> <+{ <++> }+>
+ wants.<+html+> <+{ <++> }+>
end
View
4 ruby-rails/ru.snippet
@@ -1,3 +1,3 @@
render :update do |<+page+>|
- <+page+>.<++>
-end
+ <+page+>.<++>
+end
View
20 ruby-rails/sweeper.snippet
@@ -1,15 +1,15 @@
class \<c-r>=NS_prompt("snip_classname", "Model classname", "")\<cr>Sweeper < ActionController::Caching::Sweeper
- observe \<c-r>=snip_classname\<cr>
+ observe \<c-r>=snip_classname\<cr>
- def after_save(\<c-r>=NS_underscore(snip_classname)\<cr>)
- expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
- end
+ def after_save(\<c-r>=NS_underscore(snip_classname)\<cr>)
+ expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
+ end
- def after_destroy(\<c-r>=NS_underscore(snip_classname)\<cr>)
- expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
- end
+ def after_destroy(\<c-r>=NS_underscore(snip_classname)\<cr>)
+ expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
+ end
- def expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
- expire_page
- end
+ def expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
+ expire_page
+ end
end
View
2  ruby-rails/tcb.snippet
@@ -1,2 +1,2 @@
t.boolean :<+title+>
-<++>
+<++>
View
2  ruby-rails/tcbi.snippet
@@ -1,2 +1,2 @@
t.binary :<+title+><+, :limit => <+2+>.megabytes+>
-<++>
+<++>
View
2  ruby-rails/tcd.snippet
@@ -1,2 +1,2 @@
t.decimal :<+title+><+<+, :precision => <+10+>+><+, :scale => <+2+>+>+>
-<++>
+<++>
View
2  ruby-rails/tcda.snippet
@@ -1,2 +1,2 @@
t.date :<+title+>
-<++>
+<++>
View
2  ruby-rails/tcdt.snippet
@@ -1,2 +1,2 @@
t.datetime :<+title+>
-<++>
+<++>
View
2  ruby-rails/tcf.snippet
@@ -1,2 +1,2 @@
t.float :<+title+>
-<++>
+<++>
View
2  ruby-rails/tch.snippet
@@ -1,2 +1,2 @@
t.change :<+name+><+, :<+string+><+, :<+limit+> => <+80+>+>+>
-<++>
+<++>
View
2  ruby-rails/tci.snippet
@@ -1,2 +1,2 @@
t.integer :<+title+>
-<++>
+<++>
View
2  ruby-rails/tcl.snippet
@@ -1,2 +1,2 @@
t.integer :lock_version, :null => false, :default => 0
-<++>
+<++>
View
2  ruby-rails/tcs.snippet
@@ -1,2 +1,2 @@
t.string :<+title+>
-<++>
+<++>
View
2  ruby-rails/tct.snippet
@@ -1,2 +1,2 @@
t.text :<+title+>
-<++>
+<++>
View
2  ruby-rails/tcti.snippet
@@ -1,2 +1,2 @@
t.time :<+title+>
-<++>
+<++>
View
2  ruby-rails/tcts.snippet
@@ -1,2 +1,2 @@
t.timestamp :<+title+>
-<++>
+<++>
View
2  ruby-rails/tctss.snippet
@@ -1,2 +1,2 @@
t.timestamps
-<++>
+<++>
View
2  ruby-rails/tre.snippet
@@ -1,2 +1,2 @@
t.rename :<+old_column_name+>, :<+new_column_name+>
-<++>
+<++>
View
2  ruby/Md.snippet
@@ -1 +1 @@
-File.open(<+"<+path+>.dump"+>, "wb") { |<+file+>| Marshal.dump(<+obj+>, <+file+>) }
+File.open(${1:dump_path}, "wb") { |${2:file}| Marshal.dump(${3:obj}, ${4:$2}) }
View
2  ruby/Ml.snippet
@@ -1 +1 @@
-File.open(<+"<+path+>.dump"+>, "rb") { |<+file+>| Marshal.load(<+file+>) }
+File.open(${1:dump_path}, "rb") { |${2:file}| Marshal.load(${3:$2}) }
View
2  ruby/Pn.snippet
@@ -1 +1 @@
-PStore.new(<+"<+file_name.pstore+>"+>)
+PStore.new(${1})
View
2  ruby/Yd.snippet
@@ -1 +1 @@
-File.open(<+"<+path+>.yaml"+>, "w") { |<+file+>| YAML.dump(<+obj+>, <+file+>) }
+File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) }
View
2  ruby/Yl.snippet
@@ -1 +1 @@
-File.open(<+"<+path+>.yaml"+>) { |<+file+>| YAML.load(<+file+>) }
+File.open(${1:path_to_yml}) { |${2:file}| YAML.load(${3:$2}) }
View
2  ruby/am.snippet
@@ -1 +1 @@
-alias_method :<+new_name+>, :<+old_name+>
+alias_method :${1:new_name}, :${2:old_name}
View
2  ruby/anr.snippet
@@ -1 +1 @@
-assert_nothing_raised(<+Exception+>) { <++> }
+assert_nothing_raised(${1:Exception}) { ${2} }
View
2  ruby/as.snippet
@@ -1 +1 @@
-assert <+test+>, "<+failure_message+>"
+assert ${1:test}, "${2:failure_message}"
View
2  ruby/ase.snippet
@@ -1 +1 @@
-assert_equal <+expected+>, <+actual+>
+assert_equal ${1:expected}, ${2:actual}
View
2  ruby/asid.snippet
@@ -1 +1 @@
-assert_in_delta <+expected_float+>, <+actual_float+>, <+delta_float+>
+assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:delta_float}
View
2  ruby/asio.snippet
@@ -1 +1 @@
-assert_instance_of <+ExpectedClass+>, <+actual_instance+>
+assert_instance_of ${1:ExpectedClass}, ${2:actual_instance}
View
2  ruby/asko.snippet
@@ -1 +1 @@
-assert_kind_of <+ExpectedKind+>, <+actual_instance+>
+assert_kind_of ${1:ExpectedKind}, ${2:actual_instance}
View
2  ruby/asm.snippet
@@ -1 +1 @@
-assert_match /<+expected_pattern+>/, <+actual_string+>
+assert_match /${1:expected_pattern}/, ${2:actual_string}
View
2  ruby/asn.snippet
@@ -1 +1 @@
-assert_nil <+instance+>
+assert_nil ${1:instance}
View
2  ruby/asne.snippet
@@ -1 +1 @@
-assert_not_equal <+unexpected+>, <+actual+>
+assert_not_equal ${1:unexpected}, ${2:actual}
View
2  ruby/asnm.snippet
@@ -1 +1 @@
-assert_no_match /<+unexpected_pattern+>/, <+actual_string+>
+assert_no_match /${1:unexpected_pattern}/, ${2:actual_string}
View
2  ruby/asnn.snippet
@@ -1 +1 @@
-assert_not_nil <+instance+>
+assert_not_nil ${1:instance}
View
2  ruby/asns.snippet
@@ -1 +1 @@
-assert_not_same <+unexpected+>, <+actual+>
+assert_not_same ${1:unexpected}, ${2:actual}
View
2  ruby/asnt.snippet
@@ -1 +1 @@
-assert_nothing_thrown { <++> }
+assert_nothing_thrown { ${1} }
View
2  ruby/aso.snippet
@@ -1 +1 @@
-assert_operator <+left+>, :<+operator+>, <+right+>
+assert_operator ${1:left}, :${2:operator}, ${3:right}
View
2  ruby/asr.snippet
@@ -1 +1 @@
-assert_raise(<+Exception+>) { <++> }
+assert_raise(${1:Exception}) { ${2} }
View
2  ruby/asrt.snippet
@@ -1 +1 @@
-assert_respond_to <+object+>, :<+method+>
+assert_respond_to ${1:object}, :${2:method}
View
2  ruby/ass.snippet
@@ -1 +1 @@
-assert_send [<+object+>, :<+message+>, <+args+>]
+assert_send [${1:object}, :${2:message}, ${3:args}]
View
2  ruby/ast.snippet
@@ -1 +1 @@
-assert_throws(:<+expected+>) { <++> }
+assert_throws(:${1:expected}) { ${2} }
View
6 ruby/bm.snippet
@@ -1,4 +1,4 @@
-TESTS = <+10_000+>
+TESTS = ${1:10_000}
Benchmark.bmbm do |results|
- <++>
-end
+ ${2}
+end
View
6 ruby/case.snippet
@@ -1,5 +1,5 @@
-case <++>
-when <++>
+case ${1}
+when ${2}
else
- <++>
+ ${3}
end
View
2  ruby/class.snippet
@@ -1,2 +1,2 @@
-class <+\<c-r>=Snippet_RubyClassNameFromFilename()\<CR>+>
+class ${1:`Snippet_RubyClassNameFromFilename()`}
end
View
4 ruby/def.snippet
@@ -1,3 +1,3 @@
-def <+function_name+>
- <++>
+def ${1:name}
+ ${2}
end
View
4 ruby/defmm.snippet
@@ -1,3 +1,3 @@
def method_missing(meth, *args, &blk)
- <++>
-end
+ ${1}
+end
View
6 ruby/defs.snippet
@@ -1,3 +1,3 @@
-def self.<+class_method_name+>
- <++>
-end
+def self.${1:class_method_name}
+ ${2}
+end
View
6 ruby/deft.snippet
@@ -1,3 +1,3 @@
-def test_<+case_name+>
- <++>
-end
+def test_${1:case_name}
+ ${2}
+end
View
2  ruby/detect.snippet
@@ -1 +1 @@
-detect { |<+element+>| <+body+> }
+detect { |${1:element}| ${2:body} }
View
4 ruby/detecto.snippet
@@ -1,3 +1,3 @@
-detect do |<+element+>|
- <+body+>
+detect do |${1:element}|
+ ${2:body}
end
View
2  ruby/dglob.snippet
@@ -1 +1 @@
-Dir.glob(<+"<+dir+>"+>) { |<+file+>| <++> }
+Dir.glob(${1:"<+dir}"+>) { |${2:file}| ${3} }
View
2  ruby/do.snippet
@@ -1,3 +1,3 @@
do
- <++>
+ ${1}
end
View
4 ruby/dop.snippet
@@ -1,3 +1,3 @@
-do |<+param+>|
- <++>
+do |${1:param}|
+ ${2}
end
View
2  ruby/ea.snippet
@@ -1 +1 @@
-each { |<+element+>| <+body+> }
+each { |${1:element}| ${2:body} }
View
2  ruby/each.snippet
@@ -1 +1 @@
-each { |<+element+>| <+body+> }
+each { |${1:element}| ${2:body} }
View
2  ruby/each_with_index.snippet
@@ -1 +1 @@
-each_with_index { |<+element+>,<+i+>| <++> }
+each_with_index { |${1:element},${2:i}| ${3:} }
View
4 ruby/each_with_indexo.snippet
@@ -1,4 +1,4 @@
-each_with_index do |<+element+>,<+i+>|
- <+body+>
+each_with_index do |${1:element},${2:i}|
+ ${3:body}
end
View
4 ruby/eacho.snippet
@@ -1,3 +1,3 @@
-each do |<+element+>|
- <+body+>
+each do |${1:element}|
+ ${2:body}
end
View
4 ruby/eado.snippet
@@ -1,3 +1,3 @@
-each do |<+element+>|
- <+body+>
+each do |${1:element}|
+ ${2:body}
end
View
2  ruby/eawi.snippet
@@ -1 +1 @@
-each_with_index { |<+element+>,<+i+>| <++> }
+each_with_index { |${1:element},${2:i}| ${3:} }
View
4 ruby/eawido.snippet
@@ -1,4 +1,4 @@
-each_with_index do |<+element+>,<+i+>|
- <+body+>
+each_with_index do |${1:element},${2:i}|
+ ${3:body}
end
View
4 ruby/elsif.snippet
@@ -1,2 +1,2 @@
-elsif <+condition+>
- <++>
+elsif ${1:condition}
+ ${2}
View
2  ruby/fileeach.snippet
@@ -1 +1 @@
-File.foreach(<+"<+path+>"+>) { |<+line+>| <++> }
+File.foreach(${1:"<+path}"+>) { |${2:line}| ${3} }
View
2  ruby/fopen.snippet
@@ -1 +1 @@
-File.open(<+"<+path+>"+><+, "<+rwab+>"+>) { |<+file+>| <++> }
+File.open(${1:path}, "${2:rwab}") { |${3:file}| ${4} }
View
2  ruby/fread.snippet
@@ -1 +1 @@
-File.read(<+"<+path+>"+>)
+File.read(${1})
View
6 ruby/if.snippet
@@ -1,3 +1,3 @@
-if <+condition+>
- <++>
-end
+if ${1:condition}
+ ${2}
+end
View
6 ruby/ife.snippet
@@ -1,5 +1,5 @@
-if <+condition+>
- <++>
+if ${1:condition}
+ ${2}
else
- <++>
+ ${3}
end
View
2  ruby/inj.snippet
@@ -1 +1 @@
-inject(<+init+>) { |<+total+>, <+next+>| <+body+> }
+inject(${1:init}) { |${2:total}, ${3:next}| ${4:body} }
View
4 ruby/injdo.snippet
@@ -1,3 +1,3 @@
-inject(<+init+>) do |<+total+>, <+next+>|
- <+body+>
+inject(${1:init}) do |${2:total}, ${3:next}|
+ ${4:body}
end
View
2  ruby/inject.snippet
@@ -1 +1 @@
-inject { |<+total+>,<+next+>| <+body+> }
+inject { |${1:total},${2:next}| ${3:body} }
View
4 ruby/injecto.snippet
@@ -1,3 +1,3 @@
-inject do |<+total+>,<+next+>|
- <+body+>
+inject do |${1:total},${2:next}|
+ ${3:body}
end
View
2  ruby/map.snippet
@@ -1 +1 @@
-map { |<+element+>| <+body+> }
+map { |${1:element}| ${2:body} }
View
4 ruby/mapdo.snippet
@@ -1,3 +1,3 @@
-map do |<+element+>|
- <+body+>
+map do |${1:element}|
+ ${2:body}
end
View
4 ruby/mapo.snippet
@@ -1,3 +1,3 @@
-map do |<+element+>|
- <+body+>
+map do |${1:element}|
+ ${2:body}
end
View
2  ruby/mod.snippet
@@ -1,3 +1,3 @@
module <+\<c-r>=Snippet_RubyClassNameFromFilename()\<CR>+>
- <++>
+ <++>
end
View
18 ruby/module.snippet
@@ -1,14 +1,14 @@
module <+\<c-r>=Snippet_RubyClassNameFromFilename()\<CR>+>
- module ClassMethods
- <++>
- end
+ module ClassMethods
+ <++>
+ end
- module InstanceMethods
+ module InstanceMethods
- end
+ end
- def self.included(receiver)
- receiver.extend ClassMethods
- receiver.send :include, InstanceMethods
- end
+ def self.included(receiver)
+ receiver.extend ClassMethods
+ receiver.send :include, InstanceMethods
+ end
end
View
6 ruby/nam.snippet
@@ -1,3 +1,3 @@
-namespace :<+namespace+> do
- <++>
-end
+namespace :${1:namespace} do
+ ${2}
+end
View
2  ruby/ope.snippet
@@ -1 +1 @@
-open(<+"<+path+>"+><+, "<+rwab+>"+>) { |<+io+>| <++> }
+open(${1:path}, "${2:rwab}") { |${3:io}| ${4} }
View
2  ruby/pathhere.snippet
@@ -1 +1 @@
-File.join(File.dirname(__FILE__), *%w[<+rel_path_here+>])
+File.join(File.dirname(__FILE__), *%w[${1:rel_path_here}])
View
2  ruby/r.snippet
@@ -1 +1 @@
-attr_reader :<+attr_names+>
+attr_reader :${1:attr_names}
View
2  ruby/reject.snippet
@@ -1 +1 @@
-reject { |<+element+>| <+body+> }
+reject { |${1:element}| ${2:body} }
View
4 ruby/rejecto.snippet
@@ -1,3 +1,3 @@
-reject do |<+element+>|
- <+body+>
+reject do |${1:element}|
+ ${2:body}
end
View
2  ruby/rep.snippet
@@ -1 +1 @@
-results.report("<+name+>:") { TESTS.times { <++> } }
+results.report("${1:name}:") { TESTS.times { ${2} } }
View
2  ruby/rw.snippet
@@ -1 +1 @@
-attr_accessor :<+attr_names+>
+attr_accessor :${1:attr_names}
View
2  ruby/select.snippet
@@ -1 +1 @@
-select { |<+element+>| <+body+> }
+select { |${1:element}| ${2:body} }
View
4 ruby/selecto.snippet
@@ -1,3 +1,3 @@
-select do |<+element+>|
- <+body+>
+select do |${1:element}|
+ ${2:body}
end
View
2  ruby/sort.snippet
@@ -1 +1 @@
-sort { |<+x+>,<+y+>| <+body+> }
+sort { |${1:x},${2:y}| ${3:body} }
View
4 ruby/sorto.snippet
@@ -1,3 +1,3 @@
-sort do |<+x+>,<+y+>|
- <+body+>
+sort do |${1:x},${2:y}|
+ ${3:body}
end
View
8 ruby/tas.snippet
@@ -1,4 +1,4 @@
-desc "<+Task description+>"
-task :<+<+task_name+> => <+[:<+dependent, :tasks+>]+>+> do
- <++>
-end
+desc "${1:Task description}"
+task :${2:task_name}${3: => [:dependent, :tasks]} do
+ ${4}
+end
View
8 ruby/task.snippet
@@ -1,4 +1,4 @@
-desc "<+Task description+>"
-task :<+<+task_name+> => <+[:<+dependent, :tasks+>]+>+> do
- <++>
-end
+desc "${1:Task description}"
+task :${2:task_name}${3: => [:dependent, :tasks]} do
+ ${4}
+end
View
8 ruby/tc.snippet
@@ -3,7 +3,7 @@ require "test/unit"
require "<+library_file_name+>"
class Test<+\<c-r>=Snippet_RubyClassNameFromFilename()\<CR>+> < Test::Unit::TestCase
- def test_<+case_name+>
- <++>
- end
-end
+ def test_<+case_name+>
+ <++>
+ end
+end
View
3  ruby/unless.snippet
@@ -1,2 +1,3 @@
-unless <++>
+unless ${1:condition}
+ ${2}
end
View
4 ruby/unlesse.snippet
@@ -1,4 +1,4 @@
-unless <++>
+unless ${1:condition}
else
- <++>
+ ${2}
end
View
2  ruby/w.snippet
@@ -1 +1 @@
-attr_writer :<+attr_names+>
+attr_writer :${1:attr_names}
View
6 ruby/while.snippet
@@ -1,3 +1,3 @@
-while <+condition+>
- <++>
-end
+while ${1:condition}
+ ${2}
+end
View
2  ruby/xmlr.snippet
@@ -1 +1 @@
-REXML::Document.new(File.read(<+"<+path+>"+>))
+REXML::Document.new(File.read(${1:path}))
View
6 ruby/xpa.snippet
@@ -1,3 +1,3 @@
-elements.each(<+"<+//XPath+>"+>) do |<+node+>|
- <++>
-end
+elements.each(${1}) do |${2:node}|
+ ${3}
+end
View
2  ruby/zip.snippet
@@ -1 +1 @@
-zip(<+enums+>) { |<+row+>| <++> }
+zip(${1:enums}) { |${2:row}| ${3} }
View
19 support_functions.vim
@@ -1,19 +1,19 @@
"ruby {{{1
function! Snippet_RubyClassNameFromFilename()
let name = expand("%:t:r")
- return NS_camelcase(name)
+ return Snippet_Camelcase(name)
endfunction
function! Snippet_MigrationNameFromFilename()
let name = substitute(expand("%:t:r"), '^.\{-}_', '', '')
- return NS_camelcase(name)
+ return Snippet_Camelcase(name)
endfunction
"python {{{1
function! Snippet_PythonClassNameFromFilename()
let name = expand("%:t:r")
- return NS_camelcase(name)
+ return Snippet_Camelcase(name)
endfunction
"php {{{1
@@ -59,6 +59,19 @@ function! Snippet_Modeline()
return s:start_comment() . " vim: set <+settings+>:" . s:end_comment()
endfunction
+function! Snippet_Camelcase(s)
+ "upcase the first letter
+ let toReturn = substitute(a:s, '^\(.\)', '\=toupper(submatch(1))', '')
+ "turn all '_x' into 'X'
+ return substitute(toReturn, '_\(.\)', '\=toupper(submatch(1))', 'g')
+endfunction
+
+function! Snippet_Underscore(s)
+ "down the first letter
+ let toReturn = substitute(a:s, '^\(.\)', '\=tolower(submatch(1))', '')
+ "turn all 'X' into '_x'
+ return substitute(toReturn, '\([A-Z]\)', '\=tolower("_".submatch(1))', 'g')
+endfunction
" modeline {{{1
Please sign in to comment.
Something went wrong with that request. Please try again.