From fb00219a4c777506473aaacf3085c013affe77b7 Mon Sep 17 00:00:00 2001 From: DSIW Date: Tue, 7 Aug 2012 16:08:35 +0200 Subject: [PATCH 01/20] Add snippet root for sh --- snippets/sh.snippets | 2 -- 1 file changed, 2 deletions(-) diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 83e7848..e2853b6 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -80,7 +80,5 @@ snippet getopt esac # --- end of case --- done shift $(($OPTIND-1)) - - snippet root if [ $(id -u) -ne 0 ]; then exec sudo $0; fi From 6a459fdc56a7dc8f0f8dc2618208125e900a3916 Mon Sep 17 00:00:00 2001 From: DSIW Date: Thu, 7 Mar 2013 15:23:08 +0100 Subject: [PATCH 02/20] Add snippet itsn for rspec --- snippets/ruby.snippets | 1 - 1 file changed, 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 417a4f4..995274c 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -936,7 +936,6 @@ snippet its its(:${1:method}) { should ${2} } snippet itsn its(:${1:method}) { should_not ${2} } - snippet desc describe ${1:class_name} do ${2} From fdb7185a0b7d5b18c3641d6261549f7fb693e7b8 Mon Sep 17 00:00:00 2001 From: DSIW Date: Thu, 7 Mar 2013 15:23:21 +0100 Subject: [PATCH 03/20] Add snippet s for rspec --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 995274c..6a9d269 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -958,6 +958,8 @@ snippet let! let!(:${1:object}) ${2:block} snippet subj subject { ${1} } +snippet s + subject${1:.method} snippet spec specify { subject.${1} } snippet exp From f89f57e359b849019a0cd7871a23a56551ff84c1 Mon Sep 17 00:00:00 2001 From: DSIW Date: Thu, 14 Mar 2013 17:45:04 +0100 Subject: [PATCH 04/20] Update snippet s. and remove snippet s for rspec --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 6a9d269..cbccd73 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -958,8 +958,8 @@ snippet let! let!(:${1:object}) ${2:block} snippet subj subject { ${1} } -snippet s - subject${1:.method} +snippet s. + subject.${1:method} snippet spec specify { subject.${1} } snippet exp From f222c1b8065adeae3ab699bf458932a719b49a64 Mon Sep 17 00:00:00 2001 From: DSIW Date: Thu, 14 Mar 2013 17:45:27 +0100 Subject: [PATCH 05/20] Add snippet for initialize method for ruby --- snippets/ruby.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index cbccd73..5cf28d2 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -178,6 +178,11 @@ snippet defs def self.${1:class_method_name} ${2} end +# def initialize +snippet definit + def initialize(${1:args}) + ${2} + end # def method_missing snippet defmm def method_missing(meth, *args, &blk) From 9e31911a7908dec5f3f9d500458575310c646435 Mon Sep 17 00:00:00 2001 From: DSIW Date: Thu, 14 Mar 2013 17:45:52 +0100 Subject: [PATCH 06/20] Add snippet raise for rspec --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 5cf28d2..dddc101 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -969,6 +969,8 @@ snippet spec specify { subject.${1} } snippet exp expect(${1:object}).to ${2} +snippet raise + expect { ${1:object} }.to raise_error ${2:StandardError}, /${3:message_regex}/ snippet btr be_true snippet bfa From 1a4fc2561dd2636adbd104f17847d96faf9e7b84 Mon Sep 17 00:00:00 2001 From: DSIW Date: Thu, 14 Mar 2013 17:46:09 +0100 Subject: [PATCH 07/20] Fix snippet exp for rspec --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index dddc101..10ecc8d 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -968,7 +968,7 @@ snippet s. snippet spec specify { subject.${1} } snippet exp - expect(${1:object}).to ${2} + expect { ${1:object} }.to ${2} snippet raise expect { ${1:object} }.to raise_error ${2:StandardError}, /${3:message_regex}/ snippet btr From 46ba1032e490a8858704cd2bac0a6eef6d4e824b Mon Sep 17 00:00:00 2001 From: DSIW Date: Tue, 26 Mar 2013 17:53:05 +0100 Subject: [PATCH 08/20] Add snippet descm for rspec --- snippets/ruby.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 10ecc8d..71b3e62 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -945,6 +945,12 @@ snippet desc describe ${1:class_name} do ${2} end +snippet descm + describe "#${1:method}" do + pending "Not implemented" + end + + ${2} snippet cont context "${1:message}" do ${2} From 3d14eb9750bea7c34e691168f736e83e093788a6 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:52:40 +0200 Subject: [PATCH 09/20] Add span. span# to html snippets --- snippets/html.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/html.snippets b/snippets/html.snippets index 9693fe0..3615d4b 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -730,10 +730,10 @@ snippet source snippet span ${1} -snippet span# - ${2} snippet span. ${2} +snippet span# + ${2} snippet strong ${1} snippet style From 3699e8654fa72c0df4ec67cbe115ff177cabd9c2 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:53:09 +0200 Subject: [PATCH 10/20] Add prot and priv to ruby snipppets --- snippets/ruby.snippets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 71b3e62..d5d6516 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -16,6 +16,14 @@ snippet =b =begin rdoc ${1} =end +snippet prot + protected + + ${1} +snippet priv + private + + ${1} snippet y :yields: ${1:arguments} snippet rb From 609ac9ecffa93eb1cfbd7352b5f0c85951e32437 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:53:42 +0200 Subject: [PATCH 11/20] Add reduce snippets to ruby snippets --- snippets/ruby.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index d5d6516..00f7884 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -322,6 +322,12 @@ snippet injd inject(${1:init}) do |${2:mem}, ${3:var}| ${4} end +snippet red + reduce(${1:init}) { |${2:mem}, ${3:var}| ${4} } +snippet redd + reduce(${1:init}) do |${2:mem}, ${3:var}| + ${4} + end snippet map map { |${1:e}| ${2} } snippet mapd From 34ead4e3bf0ba91f5fb5d8f1339d9e0cd01ea51d Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:54:24 +0200 Subject: [PATCH 12/20] Rename wants to format in respond_to blocks in ruby snippets --- snippets/ruby.snippets | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 00f7884..0b4616b 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -616,14 +616,14 @@ snippet defcreate def create @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) - respond_to do |wants| + respond_to do |format| if @$1.save flash[:notice] = '$2 was successfully created.' - wants.html { redirect_to(@$1) } - wants.xml { render :xml => @$1, :status => :created, :location => @$1 } + format.html { redirect_to(@$1) } + format.xml { render :xml => @$1, :status => :created, :location => @$1 } else - wants.html { render :action => "new" } - wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } + format.html { render :action => "new" } + format.xml { render :xml => @$1.errors, :status => :unprocessable_entity } end end end${3} @@ -632,9 +632,9 @@ snippet defdestroy @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) @$1.destroy - respond_to do |wants| - wants.html { redirect_to($1s_url) } - wants.xml { head :ok } + respond_to do |format| + format.html { redirect_to($1s_url) } + format.xml { head :ok } end end${3} snippet defedit @@ -645,41 +645,41 @@ snippet defindex def index @${1:model_class_name} = ${2:ModelClassName}.all - respond_to do |wants| - wants.html # index.html.erb - wants.xml { render :xml => @$1s } + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @$1s } end end${3} snippet defnew def new @${1:model_class_name} = ${2:ModelClassName}.new - respond_to do |wants| - wants.html # new.html.erb - wants.xml { render :xml => @$1 } + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @$1 } end end${3} snippet defshow def show @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - respond_to do |wants| - wants.html # show.html.erb - wants.xml { render :xml => @$1 } + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @$1 } end end${3} snippet defupdate def update @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - respond_to do |wants| + respond_to do |format| if @$1.update_attributes(params[:$1]) flash[:notice] = '$2 was successfully updated.' - wants.html { redirect_to(@$1) } - wants.xml { head :ok } + format.html { redirect_to(@$1) } + format.xml { head :ok } else - wants.html { render :action => "edit" } - wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } + format.html { render :action => "edit" } + format.xml { render :xml => @$1.errors, :status => :unprocessable_entity } end end end${3} @@ -752,8 +752,8 @@ snippet ra snippet ral render :action => "${1:action}", :layout => "${2:layoutname}" snippet rest - respond_to do |wants| - wants.${1:html} { ${2} } + respond_to do |format| + format.${1:html} { ${2} } end snippet rf render :file => "${1:filepath}" @@ -886,8 +886,8 @@ snippet vp validates :${1:attribute}, :presence => true snippet vu validates :${1:attribute}, :uniqueness => true -snippet wants - wants.${1:js|xml|html} { ${2} } +snippet format + format.${1:js|xml|html} { ${2} } snippet wc where(${1:"conditions"}${2:, bind_var}) snippet wh From 8c2ad98d54d68fb1e2d30a78f01500422d021de0 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:55:38 +0200 Subject: [PATCH 13/20] Use lambda in scopes for rails snippets --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0b4616b..0ea63b6 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -798,7 +798,7 @@ snippet ru snippet rxml render :xml => ${1:text to render} snippet sc - scope :${1:name}, :where(:@${2:field} => ${3:value}) + scope :${1:name}, -> { where(${2:field}: ${3:value}) } snippet sl scope :${1:name}, lambda do |${2:value}| where("${3:field = ?}", ${4:bind var}) From 317c6ac6391bbad47328f55ca81d356b343937f7 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:56:00 +0200 Subject: [PATCH 14/20] Add eqnarray to latex snippets --- snippets/tex.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 1b3a8e4..7d4322b 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -56,6 +56,11 @@ snippet \ \[ ${1} \] +# Equation array +snippet eqnarray + \begin{eqnarray} + ${1} + \end{eqnarray} # Enumerate snippet enum \begin{enumerate} From a987ec6e0d30b0d11c6e761e19baf23974c1c619 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:56:22 +0200 Subject: [PATCH 15/20] Add endless item to latex snippets --- snippets/tex.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 7d4322b..bb07159 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -78,6 +78,10 @@ snippet desc \begin{description} \item[${1}] ${2} \end{description} +# Endless new item +snippet ]i + \item ${1} + ${2:]i} # Matrix snippet mat \begin{${1:p/b/v/V/B/small}matrix} From dc6ca62c2537c4f2c27d5f0eaa5cc8ed3a293e2b Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:57:16 +0200 Subject: [PATCH 16/20] Add section snippets without numbers to latex snippets --- snippets/tex.snippets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index bb07159..7737afa 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -114,16 +114,31 @@ snippet sec \section{${1:section name}} \label{sec:${2:$1}} ${3} +# Section without number +snippet sec* + \section*{${1:section name}} + \label{sec:${2:$1}} + ${3} # Sub Section snippet sub \subsection{${1:subsection name}} \label{sub:${2:$1}} ${3} +# Sub Section without number +snippet sub* + \subsection*{${1:subsection name}} + \label{sub:${2:$1}} + ${3} # Sub Sub Section snippet subs \subsubsection{${1:subsubsection name}} \label{ssub:${2:$1}} ${3} +# Sub Sub Section without number +snippet subs* + \subsubsection*{${1:subsubsection name}} + \label{ssub:${2:$1}} + ${3} # Paragraph snippet par \paragraph{${1:paragraph name}} From aadb5e72271cee05d3d3f19e0fd5ad4b12a31f29 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:58:31 +0200 Subject: [PATCH 17/20] Add block, example, alert blocks to latex snippets --- snippets/tex.snippets | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 7737afa..94664cd 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -229,4 +229,15 @@ snippet sum \sum^{${1:n}}_{${2:i=1}} ${3} snippet lim \lim_{${1:x \to +\infty}} ${2} - +snippet block + \begin{block}{${1:title}} + ${2} + \end{block} +snippet alert + \begin{alertblock}{${1:title}} + ${2} + \end{alertblock} +snippet example + \begin{exampleblock}{${1:title}} + ${2} + \end{exampleblock} From 78b0f38e5c3207d82fa722a118bcf149c0881487 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:58:45 +0200 Subject: [PATCH 18/20] Add frame to latex snippets --- snippets/tex.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 94664cd..ababc99 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -229,6 +229,12 @@ snippet sum \sum^{${1:n}}_{${2:i=1}} ${3} snippet lim \lim_{${1:x \to +\infty}} ${2} +snippet frame + \begin{frame}[<+->] + \frametitle{${1:title}} + + ${2} + \end{frame} snippet block \begin{block}{${1:title}} ${2} From 0806bd70d681094a40479f819414e432cafc2a02 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:59:18 +0200 Subject: [PATCH 19/20] Add snippet for two columns to latex snippets --- snippets/tex.snippets | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index ababc99..fc44fff 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -247,3 +247,12 @@ snippet example \begin{exampleblock}{${1:title}} ${2} \end{exampleblock} +snippet col2 + \begin{columns} + \begin{column}{0.5\textwidth} + ${1} + \end{column} + \begin{column}{0.5\textwidth} + ${2} + \end{column} + \end{columns} From 64c819f8929ad657cbace5b6beb8d7e985764801 Mon Sep 17 00:00:00 2001 From: DSIW Date: Sat, 22 Jun 2013 14:59:44 +0200 Subject: [PATCH 20/20] Add instance variable cache snippet to ruby snippets --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0ea63b6..b9fbf21 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -164,6 +164,8 @@ snippet atp attr_protected :${1:attr_names} snippet ata attr_accessible :${1:attr_names} +snippet ivc + @${1:variable_name} ||= ${2:chached_value} # include Enumerable snippet Enum include Enumerable