Skip to content

Commit

Permalink
Merge commit 'd46588cad4f48f1fe6f0e80c06b87f9b78792422'
Browse files Browse the repository at this point in the history
* commit 'd46588cad4f48f1fe6f0e80c06b87f9b78792422':
  made "context"'s variable a little more appropriate
  added double quotes for rspec context
  fixed 'do' to not prompt anything since we have 'dov' when there's a variable
  added the context snippet as well
  added ruby-debug snippet
  removed an unnecessary empty line
  removed the beginning 'should' from spec snippet
  added before & after to ruby snippets
  added rename column snippet
  Haml: html and rails snippets
  added eruby snippets
  added a do without a variable
  added content_for & fixed desc
  added a couple of rspec & migrations snippets

Conflicts:
	.gitignore
	plugin/snipMate.vim
	snippets/ruby.snippets

not merged
===

(1)
181d4ae
+		elseif ft == 'eruby'
+			call s:DefineSnips(a:dir, 'html', 'eruby')

this should be done using scope_aliasse now. And I'd vote for doing this
in .vimrc. Because PHP dev's don't care about ruby snippets

(2)
d27b3bf added a do without a variable
	do${1}
		${2}
	end

is this the same as do without ${1} ? What do you put at ${1} ?
this seems to be current snippet doo
  • Loading branch information
MarcWeber committed May 31, 2011
2 parents 0233388 + d46588c commit dc893ba
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
/doc/tags
doc/tags
*.swp
.DS_Store
124 changes: 124 additions & 0 deletions snippets/eruby.snippets
@@ -0,0 +1,124 @@
# .erb and .rhmtl files

# Includes html.snippets

# Rails *****************************
snippet rc
<% ${1} -%>
snippet rce
<%= ${1} %>${2}
snippet end
<% end -%>${1}
snippet for
<% for ${2:item} in $1 %>
${3}
<% end %>
snippet rp
<%= render :partial => '${1:item}' %>
snippet rpl
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %>
snippet rps
<%= render :partial => '${1:item}', :status => ${2:500} %>
snippet rpc
<%= render :partial => '${1:item}', :collection => ${2:items} %>
snippet lia
<%= link_to '${1:link text...}', :action => '${2:index}' %>
snippet liai
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %>
snippet lic
<%= link_to '${1:link text...}', :controller => '${2:items}' %>
snippet lica
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %>
snippet licai
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %>
snippet yield
<%= yield${1::content_symbol}%>${2}
snippet conf
<% content_for ${1::foo} do %>
${2}
<% end -%>
# Ruby ******************************
snippet :
:${1:key} => ${2:"value"}${3}
snippet if
if ${1:condition}
${2}
end
snippet ife
if ${1:condition}
${2}
else
${3}
end
snippet elsif
elsif ${1:condition}
${2}
snippet unless
unless ${1:condition}
${2}
end
snippet while
while ${1:condition}
${2}
end
snippet until
until ${1:condition}
${2}
end
snippet case
case ${1:object}
when ${2:condition}
${3}
end
snippet when
when ${1:condition}
${2}
end
snippet dow
downto(${1:0}) { |${2:n}| ${3} }
snippet ste
step(${1:2}) { |${2:n}| ${3} }
snippet tim
times { |${1:n}| ${2} }
snippet upt
upto(${1:1.0/0.0}) { |${2:n}| ${3} }
snippet loo
loop { ${1} }
snippet ea
each { |${1:e}| ${2} }
snippet eab
each_byte { |${1:byte}| ${2} }
snippet eac- each_char { |chr| .. }
each_char { |${1:chr}| ${2} }
snippet eac- each_cons(..) { |group| .. }
each_cons(${1:2}) { |${2:group}| ${3} }
snippet eai
each_index { |${1:i}| ${2} }
snippet eak
each_key { |${1:key}| ${2} }
snippet eal
each_line { |${1:line}| ${2} }
snippet eap
each_pair { |${1:name}, ${2:val}| ${3} }
snippet eas-
each_slice(${1:2}) { |${2:group}| ${3} }
snippet eav
each_value { |${1:val}| ${2} }
snippet eawi
each_with_index { |${1:e}, ${2:i}| ${3} }
snippet reve
reverse_each { |${1:e}| ${2} }
snippet inj
inject(${1:init}) { |${2:mem}, ${3:var}| ${4} }
snippet map
map { |${1:e}| ${2} }
snippet mapwi-
enum_with_index.map { |${1:e}, ${2:i}| ${3} }
snippet col
collect { |${1:e}| ${2} }
snippet det
detect { |${1:e}| ${2} }
snippet rej
reject { |${1:e}|, ${2} }
snippet sel
select { |${1:e}|, ${2} }
20 changes: 20 additions & 0 deletions snippets/haml.snippets
@@ -0,0 +1,20 @@
snippet t
%table
%tr
%th
${1:headers}
%tr
%td
${2:headers}
snippet ul
%ul
%li
${1:item}
%li
snippet =rp
= render :partial => '${1:partial}'
snippet =rpl
= render :partial => '${1:partial}', :locals => {}
snippet =rpc
= render :partial => '${1:partial}', :collection => @$1

47 changes: 43 additions & 4 deletions snippets/ruby.snippets
Expand Up @@ -375,11 +375,11 @@ snippet seld
end
snippet lam
lambda { |${1:args}| ${2} }
snippet do
do${1}
${2}
end
snippet doo
do
${1}
end
snippet dov
do |${1:variable}|
${2}
end
Expand Down Expand Up @@ -521,3 +521,42 @@ snippet begin
ensure
# always excute
end

#migrations
snippet mac
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
snippet mrc
remove_column :${1:table_name}, :${2:column_name}
snippet mrenc
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
#rspec
snippet it
it "${1:spec_name}" do
${2}
end
snippet desc
describe ${1:class_name} do
${2}
end
snippet cont
context "${1:message}" do
${2}
end
snippet bef
before(:${1:each}) do
${2}
end
snippet aft
after(:${1:each}) do
${2}
end

#debugging
snippet debug
require 'ruby-debug'; debugger;
#views
snippet cfor
<% content_for :${1:head} do %>
${2}
<% end %>
>>>>>>> d46588cad4f48f1fe6f0e80c06b87f9b78792422

0 comments on commit dc893ba

Please sign in to comment.