Skip to content

Commit

Permalink
convert from nerdsnippets format to snipmate
Browse files Browse the repository at this point in the history
Snippets that have nested tabstops have been left in the nerdsnippets
format
  • Loading branch information
Martin Grenfell committed Feb 21, 2009
1 parent a547422 commit 4690ff9
Show file tree
Hide file tree
Showing 42 changed files with 73 additions and 74 deletions.
2 changes: 1 addition & 1 deletion ruby-rails/crw.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cattr_accessor :<+attr_names+>
cattr_accessor :${1:attr_names}
12 changes: 6 additions & 6 deletions ruby-rails/defcreate.snippet
Original file line number Diff line number Diff line change
@@ -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>])
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])

respond_to do |wants|
if @\<c-r>=NS_underscore(snippet_classname)\<cr>.save
if @$1.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> }
wants.html { redirect_to(@$1) }
wants.xml { render :xml => @$1, :status => :created, :location => @$1 }
else
wants.html { render :action => "new" }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
end
end
end
end${3}
8 changes: 4 additions & 4 deletions ruby-rails/defdestroy.snippet
Original file line number Diff line number Diff line change
@@ -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
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
@$1.destroy

respond_to do |wants|
wants.html { redirect_to(\<c-r>=NS_underscore(snippet_classname)\<cr>s_url) }
wants.html { redirect_to($1s_url) }
wants.xml { head :ok }
end
end
end${3}
2 changes: 1 addition & 1 deletion ruby-rails/defedit.snippet
Original file line number Diff line number Diff line change
@@ -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])
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
end
6 changes: 3 additions & 3 deletions ruby-rails/defindex.snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def index
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.all
@${1:model_class_name} = ${2:ModelClassName}.all

respond_to do |wants|
wants.html # index.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>s }
wants.xml { render :xml => @$1s }
end
end
end${3}
6 changes: 3 additions & 3 deletions ruby-rails/defnew.snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def new
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new
@${1:model_class_name} = ${2:ModelClassName}.new

respond_to do |wants|
wants.html # new.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
wants.xml { render :xml => @$1 }
end
end
end${3}
6 changes: 3 additions & 3 deletions ruby-rails/defshow.snippet
Original file line number Diff line number Diff line change
@@ -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])
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])

respond_to do |wants|
wants.html # show.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
wants.xml { render :xml => @$1 }
end
end
end${3}
12 changes: 6 additions & 6 deletions ruby-rails/defupdate.snippet
Original file line number Diff line number Diff line change
@@ -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])
@${1:model_class_name} = ${2:ModelClassName}.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>) }
if @$1.update_attributes(params[:$1])
flash[:notice] = '$2 was successfully updated.'
wants.html { redirect_to(@$1) }
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 }
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
end
end
end
end${3}
2 changes: 1 addition & 1 deletion ruby-rails/habtm.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
has_and_belongs_to_many :<+object+><+, :join_table => "<+table_name+>", :foreign_key => "<+<++>_id+>"+>
has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4}
2 changes: 1 addition & 1 deletion ruby-rails/ho.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
has_one :<+object+><+, :class_name => "<+Class+>", :foreign_key => "<+<++>_id+>"+>
has_one :${1:object}, :class_name => "${2:Class}", :foreign_key => "${3:class}_id"
2 changes: 1 addition & 1 deletion ruby-rails/mac.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
add_column :<+table+>, :<+column+>, :<+type+>
add_column :${1:table}, :${2:column}, :${3:type}
2 changes: 1 addition & 1 deletion ruby-rails/mapc.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<+map+>.<+connect+> '<+controller/:action/:id+>'
${1:map}.${2:connect} '${3:controller/:action/:id}'
2 changes: 1 addition & 1 deletion ruby-rails/mapca.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<+map+>.catch_all "*<+anything+>", :controller => "<+default+>", :action => "<+error+>"
${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5}
2 changes: 1 addition & 1 deletion ruby-rails/mapr.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<+map+>.resource :<+resource+>
${1:map}.resource :${2:resource}
2 changes: 1 addition & 1 deletion ruby-rails/maprs.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<+map+>.resources :<+resource+>
${1:map}.resources :${2:resource}
4 changes: 2 additions & 2 deletions ruby-rails/mccc.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.column :<+title+>, :<+string+>
mccc<++>
t.column :${1:title}, :${2:string}
mccc${3}
2 changes: 1 addition & 1 deletion ruby-rails/mcol.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
remove_column :<+table+>, :<+column+>
remove_column :${1:table}, :${2:column}
4 changes: 2 additions & 2 deletions ruby-rails/mct.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
create_table :<+table_name+> do |t|
t.column :<+name+>, :<+type+>
create_table :${1:table_name} do |t|
t.column :${2:name}, :${3:type}
end
5 changes: 2 additions & 3 deletions ruby-rails/migration.snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
class \<c-r>=Snippet_MigrationNameFromFilename()\<cr> < ActiveRecord::Migration
class ${1:`Snippet_MigrationNameFromFilename()`} < ActiveRecord::Migration
def self.up
<++>
${2}
end

def self.down
<++>
end
end
2 changes: 1 addition & 1 deletion ruby-rails/mp.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
map(&:<+id+>)
map(&:${1:id})
2 changes: 1 addition & 1 deletion ruby-rails/mrnc.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rename_column :<+table+>, :<+old+>, :<+new+>
rename_column :${1:table}, :${2:old}, :${3:new}
2 changes: 1 addition & 1 deletion ruby-rails/mrw.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mattr_accessor :<+attr_names+>
mattr_accessor :${1:attr_names}
2 changes: 1 addition & 1 deletion ruby-rails/ra.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :action => "<+action+>"
render :action => "${1:action}"
2 changes: 1 addition & 1 deletion ruby-rails/ral.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :action => "<+action+>", :layout => "<+layoutname+>"
render :action => "${1:action}", :layout => "${2:layoutname}"
2 changes: 1 addition & 1 deletion ruby-rails/rf.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :file => "<+filepath+>"
render :file => "${1:filepath}"
2 changes: 1 addition & 1 deletion ruby-rails/rfu.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :file => "<+filepath+>", :use_full_path => <+false+>
render :file => "${1:filepath}", :use_full_path => ${2:false}
2 changes: 1 addition & 1 deletion ruby-rails/ril.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :inline => "<+<%= 'hello' %>+>", :locals => { <+:name+> => "<+value+>"<++> }
render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} }
2 changes: 1 addition & 1 deletion ruby-rails/rit.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :inline => "<+<%= 'hello' %>+>", :type => <+:rxml+>
render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml}
2 changes: 1 addition & 1 deletion ruby-rails/rl.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :layout => "<+layoutname+>"
render :layout => "${1:layoutname}"
2 changes: 1 addition & 1 deletion ruby-rails/rn.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :nothing => <+true+>
render :nothing => ${1:true}
2 changes: 1 addition & 1 deletion ruby-rails/rns.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :nothing => <+true+>, :status => <+401+>
render :nothing => ${1:true}, :status => ${2:401}
2 changes: 1 addition & 1 deletion ruby-rails/rp.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :partial => "<+item+>"
render :partial => "${1:item}"
2 changes: 1 addition & 1 deletion ruby-rails/rps.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :partial => "<+item+>", :status => <+500+>
render :partial => "${1:item}", :status => ${2:500}
2 changes: 1 addition & 1 deletion ruby-rails/rt.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :text => "<+text to render+>"
render :text => "${1:text to render}"
2 changes: 1 addition & 1 deletion ruby-rails/rtl.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :text => "<+text to render+>", :layout => "<+layoutname+>"
render :text => "${1:text to render}", :layout => "${2:layoutname}"
2 changes: 1 addition & 1 deletion ruby-rails/rtlt.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :text => "<+text to render+>", :layout => <+true+>
render :text => "${1:text to render}", :layout => ${2:true}
2 changes: 1 addition & 1 deletion ruby-rails/rts.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
render :text => "<+text to render+>", :status => <+401+>
render :text => "${1:text to render}", :status => ${2:401}
14 changes: 7 additions & 7 deletions ruby-rails/sweeper.snippet
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
class \<c-r>=NS_prompt("snip_classname", "Model classname", "")\<cr>Sweeper < ActionController::Caching::Sweeper
observe \<c-r>=snip_classname\<cr>
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
observe $1

def after_save(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
def after_save(${2:model_class_name})
expire_cache($2)
end

def after_destroy(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
def after_destroy($2)
expire_cache($2)
end

def expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
def expire_cache($2)
expire_page
end
end
4 changes: 2 additions & 2 deletions ruby-rails/tct.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.text :<+title+>
<++>
t.text :${1:title}
${2}
4 changes: 2 additions & 2 deletions ruby-rails/tcti.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.time :<+title+>
<++>
t.time :${1:title}
${2}
4 changes: 2 additions & 2 deletions ruby-rails/tcts.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.timestamp :<+title+>
<++>
t.timestamp :${1:title}
${2}
2 changes: 1 addition & 1 deletion ruby-rails/tctss.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.timestamps
<++>
${1}

0 comments on commit 4690ff9

Please sign in to comment.