From 4918b844bbe5b183907c8cfa0f9a3dabf8401352 Mon Sep 17 00:00:00 2001 From: indi <1334@shadowproject.net> Date: Tue, 22 Jan 2013 18:20:04 +0100 Subject: [PATCH 0001/1587] add reqr to expand to require_relative --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0500aaa13..b09148854 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -28,6 +28,8 @@ snippet beg snippet req require require "${1}"${2} +snippet reqr + require_relative "${1}"${2} snippet # # => snippet end From c3ae804a82912e318f6c20281bd9b68c84a6bf63 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Sun, 27 Jan 2013 20:13:33 +0100 Subject: [PATCH 0002/1587] A more complete property snippet for python. This snippet is inspired by the snippet provided by Sublime Text. The current snippet in the upstream repository is missing at least two lines: return locals() $1 = property(**$1()) --- snippets/python.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index dd2e8123d..508a51b0a 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -51,6 +51,10 @@ snippet property ${3:return self._$1} def fset(self, value): ${4:self._$1 = value} + def fdel(self): + ${5:del self._$1} + return locals() + $1 = property(**$1()) # Ifs snippet if if ${1:condition}: From 2773a13c332035b2612616389c195c095e645243 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Sun, 27 Jan 2013 20:55:13 +0100 Subject: [PATCH 0003/1587] Added elif snippet to htmldjango. --- snippets/htmldjango.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/htmldjango.snippets b/snippets/htmldjango.snippets index 38f836bf8..c19e8773a 100644 --- a/snippets/htmldjango.snippets +++ b/snippets/htmldjango.snippets @@ -50,6 +50,9 @@ snippet if snippet else {% else %} ${1} +snippet elif + {% elif ${1} %} + ${2} snippet ifchanged {% ifchanged %}${1}{% endifchanged %} snippet ifequal From 664c3dd6840c26c8469a36f4e4db933fe4db0e6c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 28 Jan 2013 19:36:36 -0500 Subject: [PATCH 0004/1587] Fixing numbering in html snippets. --- snippets/html.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/html.snippets b/snippets/html.snippets index 0f75efd08..d547f1a54 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -556,7 +556,7 @@ snippet link snippet link:atom ${2} snippet link:css - ${4} + ${3} snippet link:favicon ${2} snippet link:rss From 576063eb676d8c75e35f37971ca9affc821121bf Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Tue, 5 Feb 2013 10:02:29 -0300 Subject: [PATCH 0005/1587] Add more rspec snippets. --- snippets/ruby.snippets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0500aaa13..a93b23958 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -910,6 +910,8 @@ snippet it snippet itp it "${1:spec_name}" ${2} +snippet its + its(:${1:method}) { should ${2} } snippet desc describe ${1:class_name} do ${2} @@ -926,3 +928,9 @@ snippet aft after :${1:each} do ${2} end +snippet let + let(:${1:method}) { ${2} } +snippet subj + subject { ${1} } +snippet spec + specify { subject.${1} } From d2337af7bbd954bf09ea85a545d6b86d85a0e955 Mon Sep 17 00:00:00 2001 From: Oliver Andrich Date: Tue, 5 Feb 2013 21:57:41 +0100 Subject: [PATCH 0006/1587] =?UTF-8?q?Fixed=20the=20{%=20with=20%}=C2=A0tem?= =?UTF-8?q?plate=20tag=20from=20htmldjango.snippets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/htmldjango.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/htmldjango.snippets b/snippets/htmldjango.snippets index c19e8773a..09cf98ecb 100644 --- a/snippets/htmldjango.snippets +++ b/snippets/htmldjango.snippets @@ -83,6 +83,8 @@ snippet widthratio {% widthratio ${1:this_value} ${2:max_value} ${3:100} %} snippet with {% with ${1} as ${2} %} + ${3} + {% endwith %} # Template Filters From cd8f5e19c48ee94ff0a44163aea9073927445cda Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 7 Feb 2013 12:56:54 +0100 Subject: [PATCH 0007/1587] document renaming of branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a242eca19..c1cc3a64a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ However today there are at least 3 plugins which can make use of this snippet re 2) [Shougo's neosnippet][5] has a compatible mode allowing to reuse most snippets. -3) [ultisnip][6] (experimental, mind the branch snipmate-merge) +3) [ultisnip][6] (stable enough to be used, branch master previously snipmate-merge) This code is subject to change. Take it as preview. That branch has additional notes for Snipmate users. at the bottom. In the long run ultisnip will have its own set of snippets, because it is From 4036a5339ba9c13a19fb98576de06f65e6e03273 Mon Sep 17 00:00:00 2001 From: Andreas Krennmair Date: Fri, 8 Feb 2013 20:21:40 +0100 Subject: [PATCH 0008/1587] go: type os.Error became built-in type error after go r60. --- snippets/go.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 0e4fe61d0..372fb57e9 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -126,12 +126,12 @@ snippet fr } # function simple snippet fun - func ${1:funcName}(${2}) ${3:os.Error} { + func ${1:funcName}(${2}) ${3:error} { ${4:/* code */} } # function on receiver snippet fum - func (self ${1:type}) ${2:funcName}(${3}) ${4:os.Error} { + func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5:/* code */} } # make From dfcb7ce519d11d1d46c943dcf17f1d169c7ce088 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 12 Feb 2013 01:12:58 -0800 Subject: [PATCH 0009/1587] Fix go functions --- snippets/go.snippets | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 372fb57e9..e737da6f0 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -67,7 +67,7 @@ snippet i snippet im import ( "${1:package}" - ) + )${2} # interface snippet in interface{} @@ -80,12 +80,12 @@ snippet inf snippet if if ${1:/* condition */} { ${2:/* code */} - } + }${2} # else snippet snippet el else { ${1} - } + }${2} # error snippet snippet ir if err != nil { @@ -114,21 +114,25 @@ snippet ie } else { ${3} } + ${4} # for loop snippet fo for ${2:i} = 0; $2 < ${1:count}; $2${3:++} { ${4:/* code */} } + ${5} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { ${4:/* code */} } + ${5} # function simple snippet fun func ${1:funcName}(${2}) ${3:error} { ${4:/* code */} } + ${5} # function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { @@ -145,6 +149,7 @@ snippet main func main() { ${1:/* code */} } + ${2} # new snippet nw new(${1:type}) @@ -180,7 +185,8 @@ snippet sr snippet st struct ${1:name} { ${2:/* data */} - }${4} + } + ${3} # switch snippet sw switch ${1:var} { From 4c6cc10d54c474d9f3830ef54851400804a3d619 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 12 Feb 2013 01:23:36 -0800 Subject: [PATCH 0010/1587] Add log.Printf and Println to go snippets with fixes --- snippets/go.snippets | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index e737da6f0..d02aa8fdf 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -138,6 +138,13 @@ snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5:/* code */} } + ${6} +# log printf +snippet lf + log.Printf("%${1:s}", ${2:var})${3} +# log printf +snippet lp + log.Println("${1}")${2} # make snippet mk make(${1:[]string}, ${2:0}) @@ -158,7 +165,7 @@ snippet pn panic("${1:msg}") # print snippet pr - fmt.Printf("${1:%s}\n", ${2:var})${3} + fmt.Printf("%${1:s}\n", ${2:var})${3} # range snippet rn range ${1} @@ -198,7 +205,7 @@ snippet sw ${6:/* code */} } snippet sp - fmt.Sprintf("${1:%s}", ${2:var})${3} + fmt.Sprintf("%${1:s}", ${2:var})${3} # true snippet t true From 74e132730243d93e3c07434f0e063898e8571463 Mon Sep 17 00:00:00 2001 From: indi <1334@shadowproject.net> Date: Wed, 13 Feb 2013 19:54:08 +0100 Subject: [PATCH 0011/1587] fixed quotes in time tag snippet --- snippets/html.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/html.snippets b/snippets/html.snippets index d547f1a54..cfc44ad1d 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -789,7 +789,7 @@ snippet thead ${1} snippet time - snippet title ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} snippet tr From 6c4c7f51d79f5c3fde6153dfdad25461981ad8eb Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Mon, 18 Feb 2013 10:09:55 -0300 Subject: [PATCH 0012/1587] Add snippets to rspec shared examples and new rspec syntax. --- snippets/ruby.snippets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index a93b23958..2647d62ed 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -934,3 +934,13 @@ snippet subj subject { ${1} } snippet spec specify { subject.${1} } +snippet exp + expect(${1:object}).to ${2} +snippet bt + be_true +snippet bf + be_false +snippet shared + shared_examples "${1:shared examples name}" ${2} +snippet itb + it_behaves_like "${1:shared examples name}"${2} From 3ef38996f4582a709ca3f8110f2fb53d6e96581e Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Mon, 18 Feb 2013 10:25:25 -0300 Subject: [PATCH 0013/1587] Import scala snippets created by @gorodok with some alterations. --- snippets/scala.snippets | 349 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 snippets/scala.snippets diff --git a/snippets/scala.snippets b/snippets/scala.snippets new file mode 100644 index 000000000..c342228a2 --- /dev/null +++ b/snippets/scala.snippets @@ -0,0 +1,349 @@ +################################################################ +# © Copyright 2011 Konstantin Gorodinskiy. All Rights Reserved.# +# Do What The Fuck You Want To Public License, Version 2. # +# See http://sam.zoy.org/wtfpl/COPYING for more details. # +################################################################ +# Scala lang +#if +snippet if + if(${1:obj}) { + ${2:/* code */} + } +#if not +snippet ifn + if(!${1:obj}) { + ${2:/* code */} + } +#if-else +snippet ifel + if(${1:obj}) { + ${2:/* code */} + } else { + ${3:/* code */} + } +#if-else-if +snippet ifelif + if(${1:obj}) { + ${2:/* code */} + } else if(${3:obj}) { + ${4:/* code */} + } +#while loop +snippet while + while (${1:obj}) { + ${2:/* code */} + } +#for loop(classic) +snippet for + for (${1:item} <- ${2:obj}) { + ${3:/* code */} + } +#for loop(indexed) +snippet fori + for (${1:i} <- ${2:0} to ${3:obj}.length) { + ${4:/* code */} + } +#exceptions +snippet try + try { + ${1:/* code */} + } catch { + case e: FileNotFoundException => ${2:/* code */} + case e: IOException => ${3:/* code */} + } finally { + ${4:/* code */} + } +#match +snippet match + ${1: obj} match { + case ${2:e} => ${3:/* code */} + case _ => ${4:/* code */} + } +#case +snippet case + case ${1:value} => ${2:/* code */} +############################ +# methods and arguments +# +#arg +snippet arg + ${1:a}: ${2:T}${3:, arg} +#args +snippet args + ${1:args}: ${2:T}* +#def +snippet def + def ${1:name}(${2:arg}) = ${3:} +#private def +snippet prdef + private def ${1:name}(${2:arg}) = ${3:} +#override def +snippet ovdef + override def ${1:name}(${2:arg}) = ${3:} +#first class function(see scalabook p 188) +snippet fcf + (${1:a}: ${2:T}) => $1 ${3:/* code */} +snippet => + ${1:name} => ${2:/* code */} +#recursion +snippet rec + def ${1:name}(${2:arg}) = + if($2) $2 + else $1($2) +#curried method +snippet crdef + def ${1:name}(${2:arg})(${3:arg}) = ${4:} +#main method +#check validity of T +snippet main + def main(args: Array[String]):${1:T} = ${2:} +############################ +# basic types(general purpose) +# you might want to use basic types snippets + +#1 +snippet T Double + dbl +#2 +snippet T Int + int +#3 +snippet T Long + lng +#4 +snippet T Char + chr +#5 +snippet T String + str +#6 +snippet T Array + arr +#7 +snippet T Buffer + buf +#8 +snippet T List + list +#9 +snippet T Tuple + tpl +#10 +snippet T Set + set +#11 +snippet T Map + map +#12 +snippet T HashSet + hset +#13 +snippet T HashMap + hmap +#14 +snippet T Boolean + bool +#end + +#named snippets for types +snippet bool + Boolean +snippet anyr + AnyRef +snippet dbl + Double +snippet int + Int +snippet str + String +snippet chr + Char +snippet lng + Long +snippet arr + Array${1:[T]}${2:()} +snippet buf + Buffer${1:[T]}${2:()} +snippet list + List${1:[T]}${2:()} +snippet tpl + Tuple${1:2}[${2:T},${3:T}] +snippet set + Set${1:[T]}${2:()} +snippet hset + HashSet${1:[T]}${2:()} +snippet mhset + mutable.HashSet${1:[T]}${2:()} +#for maps +snippet keyval + ${1:key}->${2:val}${3:, keyval} +snippet map + Map[${1:T},${2:T}]${3:(keyval)} +snippet hmap + HashMap[${1:T},${2:T}]${3:(keyval)} +snippet mmap + mutable.Map[${1:T},${2:T}]${3:(keyval)} +snippet mhmap + mutable.HashMap[${1:T},${2:T}]${3:(keyval)} +#TODO add TreeMap and TreeSet +#asInstanceOf[] +snippet as + ${1:name}.asInstanceOf[${2:T}] +#isInstanceOf[] + ${1:name}.isInstanceOf[${2:T}] +#end +#collections methods + +#scope() with one arg +snippet (a + (${1:a} => ${2:/* code */}) +#scope() with two args +snippet {( + {(${1:a},${2:b}) => + ${3:/* code */} + } +#filter +snippet filter + ${1:name}.filter (a +#map function +snippet mapf + ${1:name}.map (a +#flatmap +snippet flatmap + ${1:name}.flatMap${2:[T]}(a +#fold left +snippet fldl + ${1:name}.foldLeft(${2:first}) {( +#fold right +snippet fldr + ${1:name}.foldRight(${2:first}) {( +#fold left operator(if u wanna reduce readability of ur code) +#use wildcard symbols +snippet /: + (${1:first}/:${2:name})(${3:/* code */}) +#fold right operator +snippet :\ + (${1:first}:\${2:name})(${3:/* code */}) +#reduce left +snippet redl + ${1:name}.reduceLeft[${2:T}] {( +#reduce right +snippet redr + ${1:name}.reduceRight[${2:T}] {( +#zipWithIndex(safe way). +#see http://daily-scala.blogspot.com/2010/05/zipwithindex.html +snippet zipwi + ${1:name}.view.zipWithIndex +#split +snippet spl + ${1:name}.split("${2:,}") +#end +snippet val + val ${1:name}${2:: T} = ${3:value} +snippet var + var ${1:name}${2:: T} = ${3:value} +############################ +# classes +# +#extends +snippet extends + extends ${1:what} +#with +snippet with + with ${1:what}${2: with} +#auxiliary constructor(a. this) +snippet athis + def this(arg) = this(arg) +#abstract class +snippet abstract + abstract class ${1:name}${2:(arg)}${3: extends }${4: with} { + ${5:override def toString = "$1"} + ${6:/* code */} + } +#class +snippet class + class ${1:name}${2:(arg)}${3: extends }${4: with} { + ${5:override def toString = "$1"} + ${6:/* code */} + } +#object +snippet object + object ${1:name}${2:(arg)}${3: extends }${4: with} ${5:} +#trait +snippet trait + trait ${1:name}${2: extends }${3: with} { + ${4:} + } +#class with trait Ordered(page 265) +snippet ordered + class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} { + ${4:override def toString = "$1"} + def compare(that: $1) = ${5:this - that} + ${6:/* code */} + } +#case class +snippet casecl + case class ${1:name}${2:(arg)}${3: extends }${4: with} ${5:} +############################ +# testing +# +#scalatest imports +snippet scalatest + ${1:import org.scalatest.Suite} + ${2:import org.scalatest.FunSuite} +#assert +snippet assert + assert(${1:a}==${2:b}) +#ensuring(p 296) +snippet ensuring + ifel ensuring(${1:a}==${2:b}) +#expect +snippet expect + expect(${1:what}) { +#intercept +snippet intercept + intercept[${1:IllegalArgumentException}] { +#test +snippet test + test("${1:description}") { +#suite +snippet suite + class ${1:name} extends Suite { + def test() { + } +#funsuite +snippet fsuite + class ${1:name} extends FunSuite { + test("${2:description}") { + } +############################ +# SBT +# +snippet webproject + import sbt._ + + class ${1:Name}(info: ProjectInfo) extends DefaultWebProject(info) { + val liftVersion = "${2:2.3}" + + override def libraryDependencies = Set( + + ) ++ super.libraryDependencies + + val snapshots = ScalaToolsSnapshots + } +#depencies +snippet liftjar + "net.liftweb" %% "${1:lib}" % liftVersion % "compile->default", +snippet jettyjar + "org.mortbay.jetty" % "jetty" % "${1:version}" % "test->default", +############################ +# Lift +# +#lift imports +snippet liftimports + import _root_.net.liftweb.http._ + import S._ + import _root_.net.liftweb.util._ + import Helpers._ + import _root_.scala.xml._ +#TODO LIFT,SBT,WEB.XML,HTML snippets From 6e58f722f3770777b8303bc284ad5c0d88bc096c Mon Sep 17 00:00:00 2001 From: Eustaquio Rangel Date: Mon, 25 Feb 2013 09:07:04 -0300 Subject: [PATCH 0014/1587] Fixed Ruby rSpec be_true and be_false --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 2647d62ed..0365ec222 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -936,9 +936,9 @@ snippet spec specify { subject.${1} } snippet exp expect(${1:object}).to ${2} -snippet bt +snippet btr be_true -snippet bf +snippet bfa be_false snippet shared shared_examples "${1:shared examples name}" ${2} From 63551117aac15a93e7b32b31b096484b0ed59cf2 Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Tue, 26 Feb 2013 15:51:09 -0800 Subject: [PATCH 0015/1587] added each_with_object Ruby snippets --- snippets/ruby.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0365ec222..879677ca6 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -289,6 +289,12 @@ snippet eawid each_with_index do |${1:e},${2:i}| ${3} end +snippet eawo + each_with_object(${1:init}) { |${2:e}, ${3:var}| ${4} } +snippet eawod + each_with_object(${1:init}) do |${2:e}, ${3:var}| + ${4} + end snippet reve reverse_each { |${1:e}| ${2} } snippet reved From 0ccc49e39d813829d5b5d84d237bbed05e620024 Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Tue, 26 Feb 2013 15:51:33 -0800 Subject: [PATCH 0016/1587] added a space to each_with_index Ruby snippet, to be consistent with similar snippets --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 879677ca6..8805430a8 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -286,7 +286,7 @@ snippet eavd snippet eawi each_with_index { |${1:e}, ${2:i}| ${3} } snippet eawid - each_with_index do |${1:e},${2:i}| + each_with_index do |${1:e}, ${2:i}| ${3} end snippet eawo From 0fbb89d9086ef3b831d8d6f3b238ad19893f543a Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Fri, 1 Mar 2013 14:48:50 -0800 Subject: [PATCH 0017/1587] added delegate to ruby.snippets --- snippets/ruby.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 8805430a8..ccb3968ac 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -660,6 +660,10 @@ snippet defupdate end end end${3} +snippet dele delegate .. to + delegate :${1:methods}, :to => :${2:object} +snippet dele delegate .. to .. prefix .. allow_nil + delegate :${1:methods}, :to => :${2:object}, :prefix => :${3:prefix}, :allow_nil => ${4:allow_nil} snippet flash flash[:${1:notice}] = "${2}" snippet habtm From d8b43c12e8d45fa9475a7eba3f9b5b1ad20653dd Mon Sep 17 00:00:00 2001 From: Gui Lin Date: Wed, 6 Mar 2013 12:15:11 +0800 Subject: [PATCH 0018/1587] improve for loop --- snippets/javascript.snippets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index de50a0cf0..edbb87894 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -52,13 +52,13 @@ snippet case ${3} # for (...) {...} snippet for - for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3: += 1}) { - ${4:$1[$2]} + for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) { + var ${3:v} = $1[$2];${4:} } # for (...) {...} (Improved Native For-Loop) snippet forr - for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3: -= 1}) { - ${4:$1[$2]} + for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) { + var ${3:v} = $1[$2];${4:} } # while (...) {...} snippet wh From 4ce177eadd5596503c1c647fd84d1b5d654de6d8 Mon Sep 17 00:00:00 2001 From: mwcz Date: Thu, 14 Mar 2013 14:38:03 -0300 Subject: [PATCH 0019/1587] add semicolon to self-defining function (sdf) --- snippets/javascript.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 9a98add4d..141f933a7 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -129,7 +129,7 @@ snippet sdf $1 = function ($2) { ${4:// main code} }; - } + }; # singleton snippet sing function ${1:Singleton} (${2:argument}) { From c85575e50d366f41d130c740159dd737f35f5a49 Mon Sep 17 00:00:00 2001 From: mwcz Date: Thu, 14 Mar 2013 15:13:36 -0300 Subject: [PATCH 0020/1587] add a snippet for Crockford's object() function --- snippets/javascript.snippets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 141f933a7..cf543e8ac 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -154,3 +154,10 @@ snippet sing return instance; } +# Crockford's object function +snippet obj + object(o) { + function F() {} + F.prototype = o; + return new F(); + } From 91f24bd88b9aaf040eeea78024e1e2d786219a2b Mon Sep 17 00:00:00 2001 From: mwcz Date: Fri, 15 Mar 2013 14:53:35 -0300 Subject: [PATCH 0021/1587] fix javascript `object` function snippet --- snippets/javascript.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index cf543e8ac..2901587f0 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -156,7 +156,7 @@ snippet sing } # Crockford's object function snippet obj - object(o) { + function object(o) { function F() {} F.prototype = o; return new F(); From d07009f27f22d39e1e12eee0b56fe6ce0d8144c2 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 17 Mar 2013 20:13:47 +0100 Subject: [PATCH 0022/1587] Adding UltiSnips snippets, updating Readme UltiSnips snippets are taken from UltiSnips repo. Putting them nearby the engine seems to be the wrong thing to do. One reason is that there are two forks now. --- AUTHORS | 3 + README.md | 70 +- UltiSnips/README | 21 + UltiSnips/all.snippets | 112 ++++ UltiSnips/bindzone.snippets | 27 + UltiSnips/c.snippets | 117 ++++ UltiSnips/coffee.snippets | 90 +++ UltiSnips/coffee_jasmine.snippets | 163 +++++ UltiSnips/cpp.snippets | 52 ++ UltiSnips/css.snippets | 405 ++++++++++++ UltiSnips/d.snippets | 583 +++++++++++++++++ UltiSnips/django.snippets | 236 +++++++ UltiSnips/erlang.snippets | 98 +++ UltiSnips/eruby.snippets | 279 ++++++++ UltiSnips/go.snippets | 107 +++ UltiSnips/haskell.snippets | 61 ++ UltiSnips/help.snippets | 30 + UltiSnips/html.snippets | 297 +++++++++ UltiSnips/htmldjango.snippets | 1 + UltiSnips/java.snippets | 212 ++++++ UltiSnips/javascript.snippets | 65 ++ UltiSnips/javascript_jasmine.snippets | 168 +++++ UltiSnips/jinja2.snippets | 209 ++++++ UltiSnips/json.snippets | 19 + UltiSnips/lua.snippets | 37 ++ UltiSnips/mako.snippets | 90 +++ UltiSnips/markdown.snippets | 44 ++ UltiSnips/objc.snippets | 270 ++++++++ UltiSnips/perl.snippets | 127 ++++ UltiSnips/php.snippets | 258 ++++++++ UltiSnips/puppet.snippets | 78 +++ UltiSnips/python.snippets | 468 +++++++++++++ UltiSnips/rails.snippets | 906 ++++++++++++++++++++++++++ UltiSnips/rst.snippets | 61 ++ UltiSnips/ruby.snippets | 568 ++++++++++++++++ UltiSnips/sh.snippets | 88 +++ UltiSnips/snippets.snippets | 23 + UltiSnips/tcl.snippets | 50 ++ UltiSnips/tex.snippets | 125 ++++ UltiSnips/texmath.snippets | 54 ++ UltiSnips/vim.snippets | 58 ++ UltiSnips/xhtml.snippets | 1 + UltiSnips/zsh.snippets | 13 + 43 files changed, 6727 insertions(+), 17 deletions(-) create mode 100644 UltiSnips/README create mode 100644 UltiSnips/all.snippets create mode 100644 UltiSnips/bindzone.snippets create mode 100644 UltiSnips/c.snippets create mode 100644 UltiSnips/coffee.snippets create mode 100644 UltiSnips/coffee_jasmine.snippets create mode 100644 UltiSnips/cpp.snippets create mode 100644 UltiSnips/css.snippets create mode 100644 UltiSnips/d.snippets create mode 100644 UltiSnips/django.snippets create mode 100644 UltiSnips/erlang.snippets create mode 100644 UltiSnips/eruby.snippets create mode 100644 UltiSnips/go.snippets create mode 100644 UltiSnips/haskell.snippets create mode 100644 UltiSnips/help.snippets create mode 100644 UltiSnips/html.snippets create mode 100644 UltiSnips/htmldjango.snippets create mode 100644 UltiSnips/java.snippets create mode 100644 UltiSnips/javascript.snippets create mode 100644 UltiSnips/javascript_jasmine.snippets create mode 100644 UltiSnips/jinja2.snippets create mode 100644 UltiSnips/json.snippets create mode 100644 UltiSnips/lua.snippets create mode 100644 UltiSnips/mako.snippets create mode 100644 UltiSnips/markdown.snippets create mode 100644 UltiSnips/objc.snippets create mode 100644 UltiSnips/perl.snippets create mode 100644 UltiSnips/php.snippets create mode 100644 UltiSnips/puppet.snippets create mode 100644 UltiSnips/python.snippets create mode 100644 UltiSnips/rails.snippets create mode 100644 UltiSnips/rst.snippets create mode 100644 UltiSnips/ruby.snippets create mode 100644 UltiSnips/sh.snippets create mode 100644 UltiSnips/snippets.snippets create mode 100644 UltiSnips/tcl.snippets create mode 100644 UltiSnips/tex.snippets create mode 100644 UltiSnips/texmath.snippets create mode 100644 UltiSnips/vim.snippets create mode 100644 UltiSnips/xhtml.snippets create mode 100644 UltiSnips/zsh.snippets diff --git a/AUTHORS b/AUTHORS index 1261dc82d..22a322905 100644 --- a/AUTHORS +++ b/AUTHORS @@ -38,3 +38,6 @@ Dmitry Dementev Travis Holton Chrisyue Erik Westrup + +TODO: add contributors from github.com/SirVer/Ultisnip having contributed to +github.com/SirVer/Ultisnip/UltiSnips/* files diff --git a/README.md b/README.md index c1cc3a64a..395dcc95d 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,57 @@ IMPORTANT: comment on: [What about merging whith Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114) -Snipmate Snippets -================= +Snipmate & UltiSnip Snippets +============================ This repository contains snippets files for various programming languages. -It was originally written for the the famous [snipMate][1] plugin for vim. -However today there are at least 3 plugins which can make use of this snippet repository: +It is community-maintained and many people have contributed snippet files and other +improvements already. -1) [snipMate][1] +Contents +======== -2) [Shougo's neosnippet][5] has a compatible mode allowing - to reuse most snippets. + snippets/*: snippets using snipmate format + UltiSnips/*: snippets using UltiSnips format -3) [ultisnip][6] (stable enough to be used, branch master previously snipmate-merge) - This code is subject to change. Take it as preview. That branch - has additional notes for Snipmate users. at the bottom. - In the long run ultisnip will have its own set of snippets, because it is - more powerful cause it supports nested snippets. +Snippet engines +=============== +There are different forks of snippet engines which allow the user to insert +sippets by typing the name of a snippet hitting the expansion mapping. + garbas/vim-snipmate [4]: + VimL, snipmate-snippets, engine sometimes behaves strange, supports + rewriting snippets on the fly (eg adding a second version with folding + markers) -It is community-maintained and many people have contributed snippet files and other -improvements already. Not sure whether it implements all features such as -guards - does anybody know? + MarcWeber/UltiSnips [6]: + python, snipmate-snippets and UltiSnips-snippets + + SirVer/ultisnips [7]: + python, UltiSnips-snippets + + github.com/Shougo/neosnippet [5]: + viml, has a compatible mode allowing to reuse most snipmate snippets ? + + XPTemplate: + totally different syntax, does not read snippets contained in this file, + but it is also very powerful + + ... there are some more, but they have less features which is why I don't + mention them here + +UltiSnips engine has additional features such as "nested snippets". + +Which one to use? If you have python give MarcWeber/UltiSnips a try because its +fast and supports all important features. You can prefer the UltiSnip versions +of the snippets by setting the "always_use_first_snippet" option to 1. + +If you have VimL only (vim without python support) your best option is using +garbas/vim-snipmate and cope with the minor bugs found in the engine. + +Historical notes +================ [vim-snipmate][1] was originally started by [Michael Sanders][2] who has now unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a @@ -50,6 +78,13 @@ Until further work is done on `vim-snipmate`, please don't add folding markers into snippets. `vim-snipmate` has some comments about how to patch all snippets on the fly adding those. +Because MarcWeber/UltiSnips [6] supports also snipmate-snippets there is no +need to duplicate all snippets - only those snippets who use advanced UltiSnips +features should be duplicated in UltiSnips (?) + +Currently all snippets from UltiSnips have been put into UltiSnips - some work +on merging should be done (dropping duplicates etc) + Authors ------- @@ -66,5 +101,6 @@ terms of the MIT license. [2]: http://github.com/msanders [3]: http://github.com/garbas [4]: http://github.com/garbas/vim-snipmate -[5]: https://github.com/Shougo/neosnippet -[6]: https://github.com/MarcWeber/UltiSnips/tree/snipmate-merge +[5]: http://github.com/Shougo/neosnippet +[6]: http://github.com/MarcWeber/UltiSnips +[7]: http://github.com/SirVer/ultisnips diff --git a/UltiSnips/README b/UltiSnips/README new file mode 100644 index 000000000..eafd0866b --- /dev/null +++ b/UltiSnips/README @@ -0,0 +1,21 @@ +This directory contains the main scripts that come bundled with UltiSnips. + +Standing On The Shoulders of Giants +=================================== + +The snippets have been collected from various other project which I want to +express my gratitude for. My main source for inspiration where the following +two projects: + + TextMate: http://svn.textmate.org/trunk/Bundles/ + SnipMate: http://code.google.com/p/snipmate/ + +All snippets from those sources were copied and cleaned up, so that they are + - not using shell script, only python (so they are cross platform compatible) + - not using any feature that UltiSnips doesn't offer + +UltiSnips has seen contributions by various individuals. Those contributions +have been merged into this collection seamlessly and without further comments. + +-- vim:ft=rst:nospell: + diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets new file mode 100644 index 000000000..8844e2813 --- /dev/null +++ b/UltiSnips/all.snippets @@ -0,0 +1,112 @@ +# This file contains snippets that are always defined. I personally +# have snippets for signatures and often needed texts + +############## +# NICE BOXES # +############## +global !p +import string, vim + +""" Maps a filetype to comment format used for boxes. +Automatically filled during usage""" +_commentDict = { } + +def _parse_comments(s): + """ Parses vim's comments option to extract comment format """ + i = iter(s.split(",")) + + rv = [] + try: + while True: + # get the flags and text of a comment part + flags,text = i.next().split(':', 1) + + if len(flags) == 0: + if len(text) == 1: + rv.append((text,text,text, "")) + # parse 3-part comment, but ignore those with O flag + elif flags[0] == 's' and 'O' not in flags: + ctriple = [] + indent = "" + + if flags[-1] in string.digits: + indent = " " * int(flags[-1]) + ctriple.append(text) + + flags,text = i.next().split(':', 1) + assert(flags[0] == 'm') + ctriple.append(text) + + flags,text = i.next().split(':', 1) + assert(flags[0] == 'e') + ctriple.append(text) + ctriple.append(indent) + + rv.append(ctriple) + + elif flags[0] == 'b': + if len(text) == 1: + rv.insert(0, (text,text,text, "")) + + except StopIteration: + return rv + +def _get_comment_format(): + """ Returns a 4-element tuple representing the comment format for + the current file. """ + + ft = vim.eval("&filetype") + # check if the comment dict has the format for the current file + if _commentDict.has_key(ft): + return _commentDict[ft] + + # otherwise parse vim's comments and add it for later use + commentformat = _parse_comments(vim.eval("&comments"))[0] + _commentDict[ft] = commentformat + + return commentformat + + +def make_box(twidth, bwidth = None): + if bwidth is None: + bwidth = twidth + 2 + b,m,e,i = _get_comment_format() + sline = b + m + bwidth*m + 2*m + nspaces = (bwidth - twidth)//2 + mlines = i + m + " " + " "*nspaces + mlinee = " " + " "*(bwidth-twidth-nspaces) + m + eline = i + 2*m + bwidth*m + m + e + return sline, mlines, mlinee, eline +endglobal + +snippet box "A nice box with the current comment symbol" b +`!p +box = make_box(len(t[1])) +snip.rv = box[0] + '\n' + box[1] +`${1:content}`!p +box = make_box(len(t[1])) +snip.rv = box[2] + '\n' + box[3]` +$0 +endsnippet + +snippet bbox "A nice box over the full width" b +`!p +box = make_box(len(t[1]), 71) +snip.rv = box[0] + '\n' + box[1] +`${1:content}`!p +box = make_box(len(t[1]), 71) +snip.rv = box[2] + '\n' + box[3]` +$0 +endsnippet + +########################## +# LOREM IPSUM GENERATORS # +########################## +snippet lorem "Lorem Ipsum - 50 Words" b +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod +tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At +vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, +no sea takimata sanctus est Lorem ipsum dolor sit amet. +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/bindzone.snippets b/UltiSnips/bindzone.snippets new file mode 100644 index 000000000..034ccdec9 --- /dev/null +++ b/UltiSnips/bindzone.snippets @@ -0,0 +1,27 @@ +global !p +def newsoa(): + import datetime + now = datetime.datetime.now() + # return standard SOA formatted serial for today + return now.strftime("%Y%m%d00") +endglobal + +snippet zone "Bootstrap a new Bind zonefile" b +$TTL 86400 +@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.( + `!p snip.rv = newsoa()`; serial + 21600; refresh every 6 hours + 3600; retry after one hour + 604800; expire after a week + 86400 ); minimum TTL of 1 day + + IN NS ns01.$1. + IN MX 10 mail.$1. + +ns01.$1 IN A +mail.$1 IN A +endsnippet + +snippet A "Insert A Record" b +${1:hostname} IN A ${2:ip} +endsnippet diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets new file mode 100644 index 000000000..062a36aeb --- /dev/null +++ b/UltiSnips/c.snippets @@ -0,0 +1,117 @@ +########################################################################### +# TextMate Snippets # +########################################################################### + +snippet def "#define ..." +#define ${1} +endsnippet + +snippet ifndef "#ifndef ... #define ... #endif" +#ifndef ${1/([A-Za-z0-9_]+).*/$1/} +#define ${1:SYMBOL} ${2:value} +#endif +endsnippet + +snippet #if "#if #endif" !b +#if ${1:0} +${VISUAL:code}$0 +#endif +endsnippet + +snippet inc "#include local header (inc)" +#include "${1:`!p snip.rv = snip.basename + '.h'`}" +endsnippet + +snippet Inc "#include <> (Inc)" +#include <${1:.h}> +endsnippet + +snippet mark "#pragma mark (mark)" +#if 0 +${1:#pragma mark - +}#pragma mark $2 +#endif + +$0 +endsnippet + +snippet main "main() (main)" +int main(int argc, char const *argv[]) +{ + ${0:/* code */} + return 0; +} +endsnippet + +snippet for "for int loop (fori)" +for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${0:/* code */} +} +endsnippet + +snippet enum "Enumeration" +enum ${1:name} { $0 }; +endsnippet + +snippet once "Include header once only guard" +#ifndef ${1:`!p +if not snip.c: + import random, string + name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper() + rand = ''.join(random.sample(string.ascii_letters+string.digits, 8)) + snip.rv = ('%s_%s' % (name,rand)).upper() +else: + snip.rv = snip.c`} +#define $1 + +${0} + +#endif /* end of include guard: $1 */ + +endsnippet + +snippet td "Typedef" +typedef ${1:int} ${2:MyCustomType}; +endsnippet + +snippet do "do...while loop (do)" +do { + ${0:/* code */} +} while(${1:/* condition */}); +endsnippet + +snippet fprintf "fprintf ..." +fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/} +endsnippet + +snippet if "if .. (if)" +if (${1:/* condition */}) +{ + ${0:/* code */} +} +endsnippet + +snippet ife "if .. else (ife)" +if (${1:/* condition */}) +{ + ${2:/* code */} +} +else +{ + ${3:/* else */} +} +endsnippet + +snippet printf "printf .. (printf)" +printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} +endsnippet + +snippet st "struct" +struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} +{ + ${0:/* data */} +}; +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets new file mode 100644 index 000000000..8f347f1fa --- /dev/null +++ b/UltiSnips/coffee.snippets @@ -0,0 +1,90 @@ +# From the TextMate bundle + +snippet fun "Function" b +${1:name} = (${2:args}) -> + ${0:# body...} +endsnippet + +snippet bfun "Function (bound)" b +${1:(${2:args}) }=> + ${0:# body...} +endsnippet + +snippet if "If" b +if ${1:condition} + ${0:# body...} +endsnippet + +snippet ife "If .. Else" b +if ${1:condition} + ${2:# body...} +else + ${3:# body...} +endsnippet + +snippet elif "Else if" b +else if ${1:condition} + ${0:# body...} +endsnippet + +snippet ifte "Ternary if" b +if ${1:condition} then ${2:value} else ${3:other} +endsnippet + +snippet unl "Unless" b +${1:action} unless ${2:condition} +endsnippet + +snippet fora "Array Comprehension" b +for ${1:name} in ${2:array} + ${0:# body...} +endsnippet + +snippet foro "Object Comprehension" b +for ${1:key}, ${2:value} of ${3:Object} + ${0:# body...} +endsnippet + +snippet forr "Range Comprehension (inclusive)" b +for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}} + ${0:# body...} +endsnippet + +snippet forrex "Range Comprehension (exclusive)" b +for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}} + ${0:# body...} +endsnippet + +snippet swi "Switch" b +switch ${1:object} + when ${2:value} + ${0:# body...} +endsnippet + +snippet cla "Class" b +class ${1:ClassName}${2: extends ${3:Ancestor}} + + ${4:constructor: (${5:args}) -> + ${6:# body...}} + $7 +endsnippet + +snippet try "Try .. Catch" b +try + $1 +catch ${2:error} + $3 +endsnippet + +snippet req "Require" b +${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'}) +endsnippet + +snippet # "Interpolated Code" +#{$1}$0 +endsnippet + +snippet log "Log" b +console.log ${1:"${2:msg}"} +endsnippet + diff --git a/UltiSnips/coffee_jasmine.snippets b/UltiSnips/coffee_jasmine.snippets new file mode 100644 index 000000000..47d1e6b53 --- /dev/null +++ b/UltiSnips/coffee_jasmine.snippets @@ -0,0 +1,163 @@ +# +# CoffeeScript versions -- adapted from the JS TextMate bundle + additions +# for some jasmine-jquery matchers +# +extends coffee + +snippet des "Describe (coffee)" b +describe '${1:description}', -> + $0 +endsnippet + +snippet it "it (coffee)" b +it '${1:description}', -> + $0 +endsnippet + +snippet bef "before each (coffee)" b +beforeEach -> + $0 +endsnippet + +snippet aft "after each (coffee)" b +afterEach -> + $0 +endsnippet + +snippet any "any (coffee)" b +jasmine.any($1) +endsnippet + +snippet ru "runs (coffee)" b +runs -> + $0 +endsnippet + +snippet wa "waits (coffee)" b +waits($1) +endsnippet + +snippet ex "expect (coffee)" b +expect(${1:target})$0 +endsnippet + +snippet ee "expect to equal (coffee)" b +expect(${1:target}).toEqual(${2:value}) +endsnippet + +snippet em "expect to match (coffee)" b +expect(${1:target}).toMatch(${2:pattern}) +endsnippet + +snippet eha "expect to have attribute (coffee)" b +expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'}) +endsnippet + +snippet et "expect to be truthy (coffee)" b +expect(${1:target}).toBeTruthy() +endsnippet + +snippet ef "expect to be falsy (coffee)" b +expect(${1:target}).toBeFalsy() +endsnippet + +snippet ed "expect to be defined (coffee)" b +expect(${1:target}).toBeDefined() +endsnippet + +snippet en "expect to be null (coffee)" b +expect(${1:target}).toBeNull() +endsnippet + +snippet ec "expect to contain (coffee)" b +expect(${1:target}).toContain(${2:value}) +endsnippet + +snippet ev "expect to be visible (coffee)" b +expect(${1:target}).toBeVisible() +endsnippet + +snippet eh "expect to be hidden (coffee)" b +expect(${1:target}).toBeHidden() +endsnippet + +snippet notx "expect not (coffee)" b +expect(${1:target}).not$0 +endsnippet + +snippet note "expect not to equal (coffee)" b +expect(${1:target}).not.toEqual(${2:value}) +endsnippet + +snippet notm "expect not to match (coffee)" b +expect(${1:target}).not.toMatch(${2:pattern}) +endsnippet + +snippet notha "expect to not have attribute (coffee)" b +expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'}) +endsnippet + +snippet nott "expect not to be truthy (coffee)" b +expect(${1:target}).not.toBeTruthy() +endsnippet + +snippet notf "expect not to be falsy (coffee)" b +expect(${1:target}).not.toBeFalsy() +endsnippet + +snippet notd "expect not to be defined (coffee)" b +expect(${1:target}).not.toBeDefined() +endsnippet + +snippet notn "expect not to be null (coffee)" b +expect(${1:target}).not.toBeNull() +endsnippet + +snippet notc "expect not to contain (coffee)" b +expect(${1:target}).not.toContain(${2:value}) +endsnippet + +snippet notv "expect not to be visible (coffee)" b +expect(${1:target}).not.toBeVisible() +endsnippet + +snippet noth "expect not to be hidden (coffee)" b +expect(${1:target}).not.toBeHidden() +endsnippet + +snippet s "spy on (coffee)" b +spyOn(${1:object}, "${2:method}")$0 +endsnippet + +snippet sr "spy on and return (coffee)" b +spyOn(${1:object}, "${2:method}").andReturn(${3:arguments}) +endsnippet + +snippet st "spy on and throw (coffee)" b +spyOn(${1:object}, "${2:method}").andThrow(${3:exception}) +endsnippet + +snippet sct "spy on and call through (coffee)" b +spyOn(${1:object}, "${2:method}").andCallThrough() +endsnippet + +snippet scf "spy on and call fake (coffee)" b +spyOn(${1:object}, "${2:method}").andCallFake(${3:function}) +endsnippet + +snippet esc "expect was called (coffee)" b +expect(${1:target}).wasCalled() +endsnippet + +snippet escw "expect was called with (coffee)" b +expect(${1:target}).wasCalledWith(${2:arguments}) +endsnippet + +snippet notsc "expect was not called (coffee)" b +expect(${1:target}).wasNotCalled() +endsnippet + +snippet noscw "expect was not called with (coffee)" b +expect(${1:target}).wasNotCalledWith(${2:arguments}) +endsnippet + diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets new file mode 100644 index 000000000..9d2eb868c --- /dev/null +++ b/UltiSnips/cpp.snippets @@ -0,0 +1,52 @@ +extends c + +########################################################################### +# TextMate Snippets # +########################################################################### +snippet beginend "$1.begin(), $1.end() (beginend)" +${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end() +endsnippet + +snippet cl "class .. (class)" +class ${1:`!p snip.rv = snip.basename or "name"`} +{ +public: + ${1/(\w+).*/$1/} (${2:arguments}); + virtual ~${1/(\w+).*/$1/} (); + +private: + ${0:/* data */} +}; +endsnippet + +snippet ns "namespace .. (namespace)" +namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} +{ + $0 +}${1/.+/ \/* /m}$1${1/.+/ *\/ /m} +endsnippet + +snippet readfile "read file (readF)" +std::vector v; +if (FILE *fp = fopen(${1:"filename"}, "r")) +{ + char buf[1024]; + while(size_t len = fread(buf, 1, sizeof(buf), fp)) + v.insert(v.end(), buf, buf + len); + fclose(fp); +} +endsnippet + +snippet map "std::map (map)" +std::map<${1:key}, ${2:value}> map$0; +endsnippet + +snippet vector "std::vector (v)" +std::vector<${1:char}> v$0; +endsnippet + +snippet tp "template (template)" +template +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/css.snippets b/UltiSnips/css.snippets new file mode 100644 index 000000000..d14d51c04 --- /dev/null +++ b/UltiSnips/css.snippets @@ -0,0 +1,405 @@ +########################################################################### +# Most of these came from TextMate # +########################################################################### + +snippet ! "!important CSS (!)" +${1:!important} +endsnippet + +snippet fixed "Fixed Position Bottom 100% wide IE6" +${2:bottom: auto;}top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-${1:THE HEIGHT OF THIS THING IN PIXELS})); +${3:left: expression(eval(document.documentElement.scrollLeft)); +}${4:width: expression(eval(document.documentElement.clientWidth));}$0 +endsnippet + +snippet background "background-attachment: scroll:fixed (background)" +background-attachment: ${1:scroll/fixed};$0 +endsnippet + +snippet background "background-color: color-hex (background)" +background-color: #${1:DDD};$0 +endsnippet + +snippet background "background-color: color-name (background)" +background-color: ${1:red};$0 +endsnippet + +snippet background "background-color: color-rgb (background)" +background-color: rgb(${1:255},${2:255},${3:255});$0 +endsnippet + +snippet background "background-color: transparent (background)" +background-color: transparent;$0 +endsnippet + +snippet background "background-image: none (background)" +background-image: none;$0 +endsnippet + +snippet background "background-image: url (background)" +background-image: url($1);$0 +endsnippet + +snippet background "background-position: position (background)" +background-position: ${1:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 +endsnippet + +snippet background "background-repeat: r:r-x:r-y:n-r (background)" +background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0 +endsnippet + +snippet background "background: color image repeat attachment position (background)" +background:${6: #${1:DDD}} url($2) ${3:repeat/repeat-x/repeat-y/no-repeat} ${4:scroll/fixed} ${5:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 +endsnippet + +snippet border "border-bottom-color: size style color (border)" +border-bottom-color: #${1:999};$0 +endsnippet + +snippet border "border-bottom-style: size style color (border)" +border-bottom-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-bottom-width: size style color (border)" +border-bottom-width: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-bottom: size style color (border)" +border-bottom: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-color: color (border)" +border-color: ${1:999};$0 +endsnippet + +snippet border "border-left-color: color (border)" +border-right-color: #${1:999};$0 +endsnippet + +snippet border "border-left-style: style (border)" +border-left-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-left-width: size (border)" +border-left-width: ${1:1}px +endsnippet + +snippet border "border-left: size style color (border)" +border-left: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-right-color: color (border)" +border-right-color: #${1:999};$0 +endsnippet + +snippet border "border-right-style: style (border)" +border-right-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-right-width: size (border)" +border-right-width: ${1:1}px +endsnippet + +snippet border "border-right: size style color (border)" +border-right: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-style: style (border)" +border-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-top-color: color (border)" +border-top-color: #${1:999};$0 +endsnippet + +snippet border "border-top-style: style (border)" +border-top-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-top-width: size (border)" +border-top-width: ${1:1}px +endsnippet + +snippet border "border-top: size style color (border)" +border-top: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-width: width (border)" +border-width: ${1:1px};$0 +endsnippet + +snippet border "border: size style color (border)" +border: ${1:1px} ${2:solid} #${3:999};$0 +endsnippet + +snippet clear "clear: value (clear)" +clear: ${1:left/right/both/none};$0 +endsnippet + +snippet color "color: color-hex (color)" +color: #${1:DDD};$0 +endsnippet + +snippet color "color: color-name (color)" +color: ${1:red};$0 +endsnippet + +snippet color "color: color-rgb (color)" +color: rgb(${1:255},${2:255},${3:255});$0 +endsnippet + +snippet cursor "cursor: type (cursor)" +cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0 +endsnippet + +snippet cursor "cursor: url (cursor)" +cursor: url($1);$0 +endsnippet + +snippet direction "direction: ltr|rtl (direction)" +direction: ${1:ltr|rtl};$0 +endsnippet + +snippet display "display: block (display)" +display: block;$0 +endsnippet + +snippet display "display: common-types (display)" +display: ${1:none/inline/block/list-item/run-in/compact/marker};$0 +endsnippet + +snippet display "display: inline (display)" +display: inline;$0 +endsnippet + +snippet display "display: table-types (display)" +display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0 +endsnippet + +snippet float "float: left:right:none (float)" +float: ${1:left/right/none};$0 +endsnippet + +snippet font "font-family: family (font)" +font-family: ${1:Arial, "MS Trebuchet"}, ${2:sans-}serif;$0 +endsnippet + +snippet font "font-size: size (font)" +font-size: ${1:100%};$0 +endsnippet + +snippet font "font-style: normal:italic:oblique (font)" +font-style: ${1:normal/italic/oblique};$0 +endsnippet + +snippet font "font-variant: normal:small-caps (font)" +font-variant: ${1:normal/small-caps};$0 +endsnippet + +snippet font "font-weight: weight (font)" +font-weight: ${1:normal/bold};$0 +endsnippet + +snippet font "font: style variant weight size:line-height font -family (font)" +font: ${1:normal/italic/oblique} ${2:normal/small-caps} ${3:normal/bold} ${4:1em/1.5em} ${5:Arial}, ${6:sans-}serif;$0 +endsnippet + +snippet font "font: size font (font)" +font: ${1:75%} ${2:"Lucida Grande", "Trebuchet MS", Verdana,} ${3:sans-}serif;$0 +endsnippet + +snippet letter "letter-spacing: length-em (letter)" +letter-spacing: $1em;$0 +endsnippet + +snippet letter "letter-spacing: length-px (letter)" +letter-spacing: $1px;$0 +endsnippet + +snippet list "list-style-image: url (list)" +list-style-image: url($1);$0 +endsnippet + +snippet list "list-style-position: pos (list)" +list-style-position: ${1:inside/outside};$0 +endsnippet + +snippet list "list-style-type: asian (list)" +list-style-type: ${1:cjk-ideographic/hiragana/katakana/hiragana-iroha/katakana-iroha};$0 +endsnippet + +snippet list "list-style-type: marker(list)" +list-style-type: ${1:none/disc/circle/square};$0 +endsnippet + +snippet list "list-style-type: numeric (list)" +list-style-type: ${1:decimal/decimal-leading-zero/zero};$0 +endsnippet + +snippet list "list-style-type: other (list)" +list-style-type: ${1:hebrew/armenian/georgian};$0 +endsnippet + +snippet list "list-style-type: roman-alpha-greek (list)" +list-style-type: ${1:lower-roman/upper-roman/lower-alpha/upper-alpha/lower-greek/lower-latin/upper-latin};$0 +endsnippet + +snippet list "list-style: type position image (list)" +list-style: ${1:none/disc/circle/square/decimal/zero} ${2:inside/outside} url($3);$0 +endsnippet + +snippet margin "margin-bottom: length (margin)" +margin-bottom: ${1:20px};$0 +endsnippet + +snippet margin "margin-left: length (margin)" +margin-left: ${1:20px};$0 +endsnippet + +snippet margin "margin-right: length (margin)" +margin-right: ${1:20px};$0 +endsnippet + +snippet margin "margin-top: length (margin)" +margin-top: ${1:20px};$0 +endsnippet + +snippet margin "margin: all (margin)" +margin: ${1:20px};$0 +endsnippet + +snippet margin "margin: T R B L (margin)" +margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 +endsnippet + +snippet margin "margin: V H (margin)" +margin: ${1:20px} ${2:0px};$0 +endsnippet + +snippet marker "marker-offset: auto (marker)" +marker-offset: auto;$0 +endsnippet + +snippet marker "marker-offset: length (marker)" +marker-offset: ${1:10px};$0 +endsnippet + +snippet overflow "overflow: type (overflow)" +overflow: ${1:visible/hidden/scroll/auto};$0 +endsnippet + +snippet padding "padding-bottom: length (margin)" +padding-bottom: ${1:20px};$0 +endsnippet + +snippet padding "padding-left: length (margin)" +padding-left: ${1:20px};$0 +endsnippet + +snippet padding "padding-right: length (margin)" +padding-right: ${1:20px};$0 +endsnippet + +snippet padding "padding-top: length (margin)" +padding-top: ${1:20px};$0 +endsnippet + +snippet padding "padding: T R B L (padding)" +padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 +endsnippet + +snippet padding "padding: V H (padding)" +padding: ${1:20px} ${2:0px};$0 +endsnippet + +snippet padding "padding: all (padding)" +padding: ${1:20px};$0 +endsnippet + +snippet position "position: type (position)" +position: ${1:static/relative/absolute/fixed};$0 +endsnippet + +snippet { "properties { } ( } )" +{ + /* $1 */ + $0 + +endsnippet + +snippet scrollbar "scrollbar" +scrollbar-base-color: ${1:#CCCCCC};${2: +scrollbar-arrow-color: ${3:#000000}; +scrollbar-track-color: ${4:#999999}; +scrollbar-3dlight-color: ${5:#EEEEEE}; +scrollbar-highlight-color: ${6:#FFFFFF}; +scrollbar-face-color: ${7:#CCCCCC}; +scrollbar-shadow-color: ${9:#999999}; +scrollbar-darkshadow-color: ${8:#666666};} +endsnippet + +snippet selection "selection" +$1::-moz-selection, +$1::selection { + color: ${2:inherit}; + background: ${3:inherit}; +} +endsnippet + +snippet text "text-align: left:center:right (txt)" +text-align: ${1:left/right/center/justify};$0 +endsnippet + +snippet text "text-decoration: none:underline:overline:line-through:blink (text)" +text-decoration: ${1:none/underline/overline/line-through/blink};$0 +endsnippet + +snippet text "text-indent: length (text)" +text-indent: ${1:10}px;$0 +endsnippet + +snippet text "text-shadow: color-hex x y blur (text)" +text-shadow: #${1:DDD} ${2:10px} ${3:10px} ${4:2px};$0 +endsnippet + +snippet text "text-shadow: color-rgb x y blur (text)" +text-shadow: rgb(${1:255},${2:255},${3:255}) ${4:10px} ${5:10px} ${6:2px};$0 +endsnippet + +snippet text "text-shadow: none (text)" +text-shadow: none;$0 +endsnippet + +snippet text "text-transform: capitalize:upper:lower (text)" +text-transform: ${1:capitalize/uppercase/lowercase};$0 +endsnippet + +snippet text "text-transform: none (text)" +text-transform: none;$0 +endsnippet + +snippet vertical "vertical-align: type (vertical)" +vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0 +endsnippet + +snippet visibility "visibility: type (visibility)" +visibility: ${1:visible/hidden/collapse};$0 +endsnippet + +snippet white "white-space: normal:pre:nowrap (white)" +white-space: ${1:normal/pre/nowrap};$0 +endsnippet + +snippet word "word-spacing: length (word)" +word-spacing: ${1:10px};$0 +endsnippet + +snippet word "word-spacing: normal (word)" +word-spacing: normal;$0 +endsnippet + +snippet z "z-index: index (z)" +z-index: $1;$0 +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/d.snippets b/UltiSnips/d.snippets new file mode 100644 index 000000000..8ed9b4170 --- /dev/null +++ b/UltiSnips/d.snippets @@ -0,0 +1,583 @@ +# Simple shortcuts + +snippet imp "import (imp)" b +import ${1:std.stdio}; +endsnippet + +snippet pimp "public import (pimp)" b +public import ${1:/*module*/}; +endsnippet + +snippet over "override (over)" b +override ${1:/*function*/} +endsnippet + +snippet al "alias (al)" +alias ${1:/*orig*/} ${2:/*alias*/}; +endsnippet + +snippet mixin "mixin (mixin)" b +mixin ${1:/*mixed_in*/} ${2:/*name*/}; +endsnippet + +snippet new "new (new)" +new ${1}(${2}); +endsnippet + +snippet scpn "@safe const pure nothrow (scpn)" +@safe const pure nothrow +endsnippet + +snippet spn "@safe pure nothrow (spn)" +@safe pure nothrow +endsnippet + +snippet cont "continue (cont)" +continue; +endsnippet + +snippet dis "@disable (dis)" b +@disable ${1:/*method*/}; +endsnippet + +snippet pub "public (pub)" b +public: + ${1:/*members*/} +endsnippet + +snippet priv "private (priv)" b +private: + ${1:/*members*/} +endsnippet + +snippet prot "protected (prot)" b +protected: + ${1:/*members*/} +endsnippet + +snippet pack "package (pack)" b +package: + ${1:/*members*/} +endsnippet + +snippet ret "return (ret)" +return ${1:/*value to return*/}; +endsnippet + +snippet auto "auto (auto)" b +auto ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet con "const (con)" b +const ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet siz "size_t (siz)" b +size_t ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet sup "super (sup)" b +super(${1:/*args*/}); +endsnippet + +# Phobos + +snippet tup "tuple (tup)" +tuple(${1:/*args*/}) +endsnippet + +snippet wr "writeln (wr)" +writeln(${1:/*args*/}); +endsnippet + +snippet to "to (to)" +to!(${1:/*type*/})(${2:/*arg*/}) +endsnippet + +snippet enf "enforce (enf)" b +enforce(${1:/*condition*/}, + new ${2}Exception(${3:/*args*/})); +endsnippet + +# Branches + +snippet if "if .. (if)" +if(${1:/*condition*/}) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet ife "if .. else (ife)" b +if(${1:/*condition*/}) +{ + ${2:/*code*/} +} +else +{ + ${3:/*else*/} +} +endsnippet + +snippet el "else (el)" b +else +{ + ${VISUAL}${1:/*code*/} +} +endsnippet + +snippet elif "else if (elif)" b +else if(${1:/*condition*/}) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet sw "switch (sw)" +switch(${1:/*var*/}) +{ + case ${2:/*value*/}: + ${3:/*code*/} + break; + case ${4:/*value*/}: + ${5:/*code*/} + break; + ${7:/*more cases*/} + default: + ${6:assert(false);} +} +endsnippet + +snippet fsw "final switch (fsw)" +switch(${1:/*var*/}) +{ + case ${2:/*value*/}: + ${3:/*code*/} + break; + case ${4:/*value*/}: + ${5:/*code*/} + break; + ${7:/*more cases*/} +} +endsnippet + +snippet case "case (case)" b +case ${1:/*value*/}: + ${2:/*code*/} + break; +endsnippet + +snippet ?: "ternary operator (?:)" +${1:/*condition*/} ? ${2:/*then*/} : ${3:/*else*/}$4 +endsnippet + +# Loops + +snippet do "do while (do)" b +do +{ + ${VISUAL}${2:/*code*/} +} while(${1:/*condition*/}); +endsnippet + +snippet wh "while (wh)" b +while(${1:/*condition*/}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +snippet for "for (for)" b +for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet forever "forever (forever)" b +for(;;) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet fore "foreach (fore)" +foreach(${1:/*elem*/}; ${2:/*range*/}) +{ + ${VISUAL}${3:/*code*/} +} +endsnippet + +snippet forif "foreach if (forif)" b +foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) +{ + ${VISUAL}${4:/*code*/} +} +endsnippet + +# Contracts +snippet in "in contract (in)" b +in +{ + assert(${1:/*condition*/}, "${2:error message}"); + ${3} +} +body +endsnippet + +snippet out "out contract (out)" b +out${1:(result)} +{ + assert(${2:/*condition*/}, "${3:error message}"); + ${4} +} +body +endsnippet + +snippet inv "invariant (inv)" b +invariant() +{ + assert(${1:/*condition*/}, "${2:error message}"); + ${3} +} +endsnippet + +# Functions (generic) + +snippet fun "function definition (fun)" +${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} +{ + ${VISUAL}${5:/*code*/} +} +endsnippet + +snippet void "void function definition (void)" +void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} +{ + ${VISUAL}${4:/*code*/} +} +endsnippet + +snippet this "ctor (this)" w +this(${1:/*args*/}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +snippet get "getter property (get)" ! +@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};} +endsnippet + +snippet set "setter property (set)" ! +@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;} +endsnippet + +# Functions (concrete) + +snippet main "Main" b +void main(string[] args) +{ + ${VISUAL}${0: /*code*/} +} +endsnippet + +# Mixins + +snippet signal "signal (signal)" b +mixin Signal!(${1:/*args*/}) ${2:/*name*/}; +endsnippet + +# Scope + +snippet scope "scope (scope)" b +scope(${1:exit}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +# With + +snippet with "with (with)" +with(${1}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +# Exception handling + +snippet try "try/catch (try)" b +try +{ + ${VISUAL}${1:/*code to try*/} +} +catch(${2}Exception e) +{ + ${3:/*handle exception*/} +} +endsnippet + +snippet tryf "try/catch/finally (tryf)" b +try +{ + ${VISUAL}${1:/*code to try*/} +} +catch(${2}Exception e) +{ + ${3:/*handle exception*/} +} +finally +{ + ${4:/*cleanup*/} +} +endsnippet + +snippet catch "catch (catch)" b +catch(${1}Exception e) +{ + ${2:/*handle exception*/} +} +endsnippet + +snippet thr "throw (thr)" +throw new ${1}Exception("${2}"); +endsnippet + + +# Type declarations + +snippet struct "struct (struct)" +struct ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet union "union (union)" +union ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet class "class (class)" +class ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet inter "interface (inter)" +interface ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet enum "enum (enum)" +enum ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + + +# Exception declarations + +snippet exc "exception declaration (exc)" b +/// ${3:/*documentation*/} +class ${1}Exception : ${2}Exception +{ + public this(string msg, string file = __FILE__, int line = __LINE__) + { + super(msg, file, line); + } +} +endsnippet + + +# Conditional compilation + +snippet version "version (version)" b +version(${1:/*version name*/}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +snippet debug "debug" b +debug +{ + ${VISUAL}${1:/*code*/} +} +endsnippet + + +# Templates + +snippet temp "template (temp)" b +template ${2:/*name*/}(${1:/*args*/}) +{ + ${3:/*code*/} +} +endsnippet + + +# Asserts + +snippet ass "assert (ass)" b +assert(${1:false}, "${2:TODO}"); + +endsnippet + + +# Unittests + +snippet unittest "unittest (unittest)" b +unittest +{ + ${1:/*code*/} +} +endsnippet + + +# Common member functions + +snippet opDis "opDispatch (opDis)" b +${1:/*return type*/} opDispatch(string s)() +{ + ${2:/*code*/}; +} +endsnippet + +snippet op= "opAssign (op=)" b +void opAssign(${1} rhs) ${2:@safe pure nothrow} +{ + ${2:/*code*/} +} +endsnippet + +snippet opCmp "opCmp (opCmp)" b +int opCmp(${1} rhs) @safe const pure nothrow +{ + ${2:/*code*/} +} +endsnippet + +snippet opApply "opApply (opApply)" b +int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg) +{ + int result = 0; + ${2:/*loop*/} + { + result = dg(${3:/*arg/s*/}); + if(result){break;} + } + return result; +} +endsnippet + +snippet toString "toString (toString)" b +string toString() @safe const pure nothrow +{ + ${1:/*code*/} +} +endsnippet + + +# Comments + + +snippet todo "TODO (todo)" ! +// TODO: ${1} +endsnippet + + + +# DDoc + +snippet doc "generic ddoc block (doc)" b +/// ${1:description} +/// +/// ${2:details} +endsnippet + +snippet fdoc "function ddoc block (fdoc)" b +/// ${1:description} +/// +/// ${2:Params: ${3:param} = ${4:param description} +/// ${5}} +/// +/// ${6:Returns: ${7:return value}} +/// +/// ${8:Throws: ${9}Exception ${10}} +endsnippet + +snippet Par "Params (Par)" +Params: ${1:param} = ${2:param description} +/// ${3} +endsnippet + +snippet Ret "Returns (Ret)" +Returns: ${1:return value/s} +endsnippet + +snippet Thr "Throws (Thr)" +Throws: ${1}Exception ${2} +endsnippet + +snippet Example "Examples (Example)" +Examples: +/// -------------------- +/// ${1:example code} +/// -------------------- +endsnippet + + +# License blocks + +snippet gpl "GPL (gpl)" b +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// Copyright (C) ${1:Author}, `!v strftime("%Y")` + +${2} +endsnippet + +snippet boost "Boost (boost)" b +// Copyright ${1:Author} `!v strftime("%Y")`. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +${2} +endsnippet + + +# New module + +snippet module "New module (module)" b +// Copyright ${1:Author} `!v strftime("%Y")`. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +module ${2}.`!v Filename('$1', 'name')`; + + +${3} +endsnippet diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets new file mode 100644 index 000000000..59b77c576 --- /dev/null +++ b/UltiSnips/django.snippets @@ -0,0 +1,236 @@ +# Generic Tags +snippet % +{% ${1} %}${2} +endsnippet + +snippet %% +{% ${1:tag_name} %} + ${2} +{% end$1 %} +endsnippet + +snippet { +{{ ${1} }}${2} +endsnippet + +# Template Tags + +snippet autoescape +{% autoescape ${1:off} %} + ${2} +{% endautoescape %} +endsnippet + +snippet block +{% block ${1} %} + ${2} +{% endblock %} +endsnippet + +snippet # +{# ${1:comment} #} +endsnippet + +snippet comment +{% comment %} + ${1} +{% endcomment %} +endsnippet + +snippet cycle +{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} +endsnippet + +snippet debug +{% debug %} +endsnippet + +snippet extends +{% extends "${1:base.html}" %} +endsnippet + +snippet filter +{% filter ${1} %} + ${2} +{% endfilter %} +endsnippet + +snippet firstof +{% firstof ${1} %} +endsnippet + +snippet for +{% for ${1} in ${2} %} + ${3} +{% endfor %} +endsnippet + +snippet empty +{% empty %} + ${1} +endsnippet + +snippet if +{% if ${1} %} + ${2} +{% endif %} +endsnippet + +snippet else +{% else %} + ${1} +endsnippet + +snippet ifchanged +{% ifchanged %}${1}{% endifchanged %} +endsnippet + +snippet ifequal +{% ifequal ${1} ${2} %} + ${3} +{% endifequal %} +endsnippet + +snippet ifnotequal +{% ifnotequal ${1} ${2} %} + ${3} +{% endifnotequal %} +endsnippet + +snippet include +{% include "${1}" %} +endsnippet + +snippet load +{% load ${1} %} +endsnippet + +snippet now +{% now "${1:jS F Y H:i}" %} +endsnippet + +snippet regroup +{% regroup ${1} by ${2} as ${3} %} +endsnippet + +snippet spaceless +{% spaceless %}${1}{% endspaceless %} +endsnippet + +snippet ssi +{% ssi ${1} %} +endsnippet + +snippet trans +{% trans "${1:string}" %} +endsnippet + +snippet url +{% url ${1} as ${2} %} +endsnippet + +snippet widthratio +{% widthratio ${1:this_value} ${2:max_value} ${3:100} %} +endsnippet + +snippet with +{% with ${1} as ${2} %} +endsnippet + +# Template Filters + +# Note: Since SnipMate can't determine which template filter you are +# expanding without the "|" character, these do not add the "|" +# character. These save a few keystrokes still. + +# Note: Template tags that take no arguments are not implemented. + +snippet add +add:"${1}" +endsnippet + +snippet center +center:"${1}" +endsnippet + +snippet cut +cut:"${1}" +endsnippet + +snippet date +date:"${1}" +endsnippet + +snippet default +default:"${1}" +endsnippet + +snippet defaultifnone +default_if_none:"${1}" +endsnippet + +snippet dictsort +dictsort:"${1}" +endsnippet + +snippet dictsortrev +dictsortreversed:"${1}" +endsnippet + +snippet divisibleby +divisibleby:"${1}" +endsnippet + +snippet floatformat +floatformat:"${1}" +endsnippet + +snippet getdigit +get_digit:"${1}" +endsnippet + +snippet join +join:"${1}" +endsnippet + +snippet lengthis +length_is:"${1}" +endsnippet + +snippet pluralize +pluralize:"${1}" +endsnippet + +snippet removetags +removetags:"${1}" +endsnippet + +snippet slice +slice:"${1}" +endsnippet + +snippet stringformat +stringformat:"${1}" +endsnippet + +snippet time +time:"${1}" +endsnippet + +snippet truncatewords +truncatewords:${1} +endsnippet + +snippet truncatewordshtml +truncatewords_html:${1} +endsnippet + +snippet urlizetrunc +urlizetrunc:${1} +endsnippet + +snippet wordwrap +wordwrap:${1} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/erlang.snippets b/UltiSnips/erlang.snippets new file mode 100644 index 000000000..782316261 --- /dev/null +++ b/UltiSnips/erlang.snippets @@ -0,0 +1,98 @@ +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### + +snippet pat "Case:Receive:Try Clause" +${1:pattern}${2: when ${3:guard}} ->; + ${4:body} +endsnippet + +snippet beh "Behaviour Directive" +-behaviour (${1:behaviour}). +endsnippet + +snippet case "Case Expression" +case ${1:expression} of + ${2:pattern}${3: when ${4:guard}} -> + ${5:body} +end +endsnippet + +snippet def "Define Directive" +-define (${1:macro}${2: (${3:param})}, ${4:body}). +endsnippet + +snippet exp "Export Directive" +-export ([${1:function}/${2:arity}]). +endsnippet + +snippet fun "Fun Expression" +fun + (${1:pattern})${2: when ${3:guard}} -> + ${4:body} +end +endsnippet + +snippet fu "Function" +${1:function} (${2:param})${3: when ${4:guard}} -> + ${5:body} +endsnippet + +snippet if "If Expression" +if + ${1:guard} -> + ${2:body} +end +endsnippet + +snippet ifdef "Ifdef Directive" +-ifdef (${1:macro}). +endsnippet + +snippet ifndef "Ifndef Directive" +-ifndef (${1:macro}). +endsnippet + +snippet imp "Import Directive" +-import (${1:module}, [${2:function}/${3:arity}]). +endsnippet + +snippet inc "Include Directive" +-include ("${1:file}"). +endsnippet + +snippet mod "Module Directive" +-module (${1:`!p snip.rv = snip.basename or "module"`}). +endsnippet + +snippet rcv "Receive Expression" +receive +${1: ${2:pattern}${3: when ${4:guard}} -> + ${5:body}} +${6:after + ${7:expression} -> + ${8:body}} +end +endsnippet + +snippet rec "Record Directive" +-record (${1:record}, {${2:field}${3: = ${4:value}}}). +endsnippet + +snippet try "Try Expression" +try${1: ${2:expression}${3: of + ${4:pattern}${5: when ${6:guard}} -> + ${7:body}}} +${8:catch + ${9:pattern}${10: when ${11:guard}} -> + ${12:body}} +${13:after + ${14:body}} +end +endsnippet + +snippet undef "Undef Directive" +-undef (${1:macro}). +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/eruby.snippets b/UltiSnips/eruby.snippets new file mode 100644 index 000000000..1fdcfc167 --- /dev/null +++ b/UltiSnips/eruby.snippets @@ -0,0 +1,279 @@ +# TextMate added these variables to cope with changes in ERB handling +# in different versions of Rails -- for instance, Rails 3 automatically +# strips whitespace so that it's no longer necessary to use a form like +# <% end -%>, but if you're still maintaining Rails 2 projects, you +# can't omit the minus sign and get the same behavior. +# +# The following regex replace substitutes the function below for the +# TextMate variable references after the snippets are converted: +# +# /\v\$\{(TM_RAILS_TEMPLATE_([^_]+)_RUBY_([^_\s]+))\}/`!p textmate_var('\1', snip)`/g +# +global !p +def textmate_var(var, snip): + lookup = dict( + TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '), + TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'), + TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', ' %>'), + TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'), + TM_RAILS_TEMPLATE_END_RUBY_BLOCK = 'end' + ) + + snip.rv = lookup[var] + return +endglobal + + +########################################################################### +# GENERATED FROM get_tm_snippets.py + REGEX REPLACE # +########################################################################### + +snippet fi "<%= Fixtures.identify(:symbol) %>" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`Fixtures.identify(:${1:name})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`$0 +endsnippet + +snippet ft "form_tag" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet end "end (ERB)" +<% end -%> +endsnippet + +snippet for "for loop (ERB)" +<% if !${1:list}.blank? %> + <% for ${2:item} in ${1} %> + $3 + <% end %> +<% else %> + $4 +<% end %> + +endsnippet + +snippet ffcb "form_for check_box" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffff "form_for file_field 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffhf "form_for hidden_field 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffl "form_for label 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffpf "form_for password_field 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffrb "form_for radio_box 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffs "form_for submit 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffta "form_for text_area 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet fftf "form_for text_field 2" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet fields "fields_for" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet f. "f_fields_for (nff)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`f.fields_for :${1:attribute} do |${2:f}|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet f. "f.checkbox" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.file_field" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.hidden_field" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.label" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.password_field" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.radio_box" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.submit" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.text_area" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.text_field" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffe "form_for with errors" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet ff "form_for" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet ist "image_submit_tag" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, :id => "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, :name => "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, :class => "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, :disabled => ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet it "image_tag" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, :title => "${5:title}"}${6:, :class => "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet layout "layout" +layout "${1:template_name}"${2:${3:, :only => ${4:[:${5:action}, :${6:action}]}}${7:, :except => ${8:[:${9:action}, :${10:action}]}}} +endsnippet + +snippet jit "javascript_include_tag" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lia "link_to (action)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet liai "link_to (action, id)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:edit}", :id => ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lic "link_to (controller)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lica "link_to (controller, action)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet licai "link_to (controller, action, id)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:edit}", :id => ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet linpp "link_to (nested path plural)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:${10}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet linp "link_to (nested path)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lipp "link_to (path plural)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${4:model}s_path}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lip "link_to (path)" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:${12}})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lim "link_to model" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:model}.${2:name}, ${3:${4:$1}_path(${14:$1})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet hide "page.hide (*ids)" +page.hide ${1:"${2:id(s)}"} +endsnippet + +snippet ins "page.insert_html (position, id, partial)" +page.insert_html :${1:top}, ${2:"${3:id}"}, :${4:partial => "${5:template}"} +endsnippet + +snippet rep "page.replace (id, partial)" +page.replace ${1:"${2:id}"}, :${3:partial => "${4:template}"} +endsnippet + +snippet reph "page.replace_html (id, partial)" +page.replace_html ${1:"${2:id}"}, :${3:partial => "${4:template}"} +endsnippet + +snippet show "page.show (*ids)" +page.show ${1:"${2:id(s)}"} +endsnippet + +snippet tog "page.toggle (*ids)" +page.toggle ${1:"${2:id(s)}"} +endsnippet + +snippet vis "page.visual_effect (effect, id)" +page.visual_effect :${1:toggle_slide}, ${2:"${3:DOM ID}"} +endsnippet + +snippet rp "render (partial) (rp)" +render :partial => "${1:item}" +endsnippet + +snippet rpc "render (partial,collection) (rpc)" +render :partial => "${1:item}", :collection => ${2:@$1s} +endsnippet + +snippet rpl "render (partial,locals) (rpl)" +render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}$0 } +endsnippet + +snippet rpo "render (partial,object) (rpo)" +render :partial => "${1:item}", :object => ${2:@$1} +endsnippet + +snippet rps "render (partial,status) (rps)" +render :partial => "${1:item}", :status => ${2:500} +endsnippet + +snippet slt "stylesheet_link_tag" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet st "submit_tag" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet else "else (ERB)" +<% else %> + +endsnippet + +snippet if "if (ERB)" +<% if ${1:condition} %>$0 +endsnippet + +snippet lf "link_to_function" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets new file mode 100644 index 000000000..ea46931ba --- /dev/null +++ b/UltiSnips/go.snippets @@ -0,0 +1,107 @@ +# Snippets for Go + +# when to abbriviate and when not? +# b doesn't work here, because it ignores whitespace +# optional local name? +snippet /^import/ "Import declaration" r +import ( + "${1:package}" +) +endsnippet + +snippet /^package/ "Package declaration" r +// Package $1 provides ... +package ${1:main} +endsnippet + +# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle +snippet /^cons/ "Constants declaration" r +const ( + ${1:constant}${2/(.+)/ /}${2:type} = ${0:value} +) +endsnippet + +snippet /^con/ "Constant declaration" r +const ${1:name}${2/(.+)/ /}${2:type} = ${0:value} +endsnippet + +snippet iota "Iota constant generator" b +const ( + ${1:constant}${2/(.+)/ /}${2:type} = iota +) +endsnippet + +# statements +snippet for "For loop" !b +for ${1:condition}${1/(.+)/ /}{ + ${0:${VISUAL}} +} +endsnippet + +snippet forr "For range loop" !b +for ${2:name} := range ${1:collection} { + ${0:${VISUAL}} +} +endsnippet + +snippet if "If statement" !b +if ${1:condition}${1/(.+)/ /}{ + ${0:${VISUAL}} +} +endsnippet + +snippet switch "Switch statement" !b +switch ${1:expression}${1/(.+)/ /}{ +case${0} +} +endsnippet + +snippet case "Case clause" !b +case ${1:condition}: + ${0:${VISUAL}} +endsnippet + +snippet default "Default clause" !b +default: + ${0:${VISUAL}} +endsnippet + +# functions +snippet /^main/ "Main function" r +func main() { + ${0:${VISUAL}} +} +endsnippet + +snippet /^meth/ "Method" r +func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { + ${0:${VISUAL}} +} +endsnippet + +snippet func "Function" b +func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { + ${0:${VISUAL}} +} +endsnippet + +# types and variables +snippet map "Map type" !b +map[${1:keytype}]${2:valtype} +endsnippet + +snippet : "Variable declaration :=" !b +${1:name} := ${0:value} +endsnippet + +snippet var "Variable declaration" !b +var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} +endsnippet + +snippet vars "Variables declaration" !b +var ( + ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } +) +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/haskell.snippets b/UltiSnips/haskell.snippets new file mode 100644 index 000000000..eb7b2c62e --- /dev/null +++ b/UltiSnips/haskell.snippets @@ -0,0 +1,61 @@ +snippet if "if ... then ... else ..." +if ${1:condition} + then ${2:expression} + else ${3:expression} +endsnippet + +snippet case "case ... of ..." +case ${1:expression} of + ${2:pattern} -> ${3:expression} + ${4:pattern} -> ${5:expression} +endsnippet + +snippet :: "Type signature" +${1:name} :: ${2:Type} -> ${3:Type} +endsnippet + +snippet => "Type constraint" +(${1:Class} ${2:Type var}) => ${3:$2} +endsnippet + +snippet def "Function definition" +${1:name} :: ${2:Type} -> ${3:Type} +endsnippet + +snippet def[] "Function definition for list patterns" +${1:name} :: [${2:Type}] -> ${3:Type} +$1 [] = ${4:undefined} +$1 ${5:(x:xs)} = ${6:undefined} +endsnippet + +snippet = "Function clause" +${1:name} ${2:pattern} = ${3:undefined} +endsnippet + +snippet 2= "Function clause" +${1:name} ${2:pattern} = ${3:undefined} +$1 ${4:pattern} = ${5:undefined} +endsnippet + +snippet 3= "Function clause" +${1:name} ${2:pattern} = ${3:undefined} +$1 ${4:pattern} = ${5:undefined} +$1 ${6:pattern} = ${7:undefined} +endsnippet + +snippet | "Guard" +| ${1:predicate} = ${2:undefined} +endsnippet + +snippet \ "Lambda expression" +\ ${1:pattern} -> ${2:expression} +endsnippet + +snippet [|] "List comprehension" +[${3:foo }$1 | ${1:x} <- ${2:xs} ] +endsnippet + +snippet let "let ... in ..." +let ${1:name} = ${2:expression} +in ${3:expression} +endsnippet diff --git a/UltiSnips/help.snippets b/UltiSnips/help.snippets new file mode 100644 index 000000000..bd0bb12fb --- /dev/null +++ b/UltiSnips/help.snippets @@ -0,0 +1,30 @@ +# Snippets for VIM Help Files + +global !p +def sec_title(snip, t): + file_start = snip.fn.split('.')[0] + sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') + return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) +endglobal + +snippet sec "Section marker" b +============================================================================== +${1:SECTION}`!p snip.rv = sec_title(snip, t)` + +$0 +endsnippet + +snippet ssec "Sub section marker" b +${1:Subsection}`!p snip.rv = sec_title(snip, t) +snip += "-"*len(t[1])` + +$0 +endsnippet + +snippet sssec "Subsub Section marker" b +${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)` + +$0 +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets new file mode 100644 index 000000000..bb0747890 --- /dev/null +++ b/UltiSnips/html.snippets @@ -0,0 +1,297 @@ +########################################################################### +# TextMate Snippets # +########################################################################### + +global !p +def x(snip): + if snip.ft.startswith("x"): + snip.rv = '/' + else: + snip.rv = "" +endglobal + +############ +# Doctypes # +############ +snippet doctype "DocType XHTML 1.0 Strict" b + + +endsnippet + +snippet doctype "DocType XHTML 1.0 Transitional" b + + +endsnippet + +snippet doctype "DocType XHTML 1.1" b + + +endsnippet + +snippet doctype "HTML - 4.0 Transitional (doctype)" b + + +endsnippet + +snippet doctype "HTML - 5.0 (doctype)" b + + +endsnippet + +############# +# Shortcuts # +############# +snippet down "Down (down)" +↓ +endsnippet + +snippet enter "Enter (enter)" +⌅ +endsnippet + +snippet escape "Escape (escape)" +⎋ +endsnippet + +snippet shift "Shift (shift)" +⇧ +endsnippet + +snippet tab "Tab (tab)" +⇥ +endsnippet + +snippet up "Up (up)" +↑ +endsnippet + +snippet return "Return (return)" +↩ +endsnippet + +snippet right "Right (right)" +→ +endsnippet + +snippet left "Left (left)" +← +endsnippet + +snippet option "Option (option)" +⌥ +endsnippet + +####################### +# Conditional inserts # +####################### +snippet ! "IE Conditional Comment: Internet Explorer 5_0 only" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 5_5 only" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 5_x" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 6 and below" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 6 only" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer 7+" +$0 +endsnippet + +snippet ! "IE Conditional Comment: Internet Explorer" +$0 +endsnippet + +snippet ! "IE Conditional Comment: NOT Internet Explorer" +${1: IE Conditional Comment: NOT Internet Explorer }$0 +endsnippet + +############# +# HTML TAGS # +############# +snippet input "Input with Label" + + +endsnippet + +snippet input "XHTML " + +endsnippet + + +snippet opt "Option" +${3:$2} +endsnippet + +snippet select "Select Box" + +endsnippet + + +snippet textarea "XHTML +endsnippet + +snippet mailto "XHTML " +${3:email me} +endsnippet + +snippet base "XHTML " + +endsnippet + +snippet body "XHTML " + + $0 + +endsnippet + +snippet div "XHTML
" + + $0 +
+endsnippet + +snippet form "XHTML
" + + $0 + +

+
+endsnippet + +snippet h1 "XHTML

" +

${1}

+endsnippet + +snippet head "XHTML " + + + ${1:`!p snip.rv = snip.basename or "Page Title"`} + $0 + +endsnippet + +snippet link "XHTML " + +endsnippet + +snippet meta "XHTML " + +endsnippet + +snippet scriptsrc "XHTML +endsnippet + +snippet script "XHTML +endsnippet + +snippet style "XHTML +endsnippet + +snippet table "XHTML " +
+ + +
${5:Header}
${0:Data}
+endsnippet + +snippet a "Link" +${4:Anchor Text} +endsnippet + +snippet p "paragraph" +

$0

+endsnippet + +snippet li "list item" +
  • +endsnippet + +snippet ul "unordered list" +
      +$0 +
    +endsnippet + +snippet td "table cell" +$0 +endsnippet + +snippet tr "table row" +$0 +endsnippet + +snippet title "XHTML " +<title>${1:`!p snip.rv = snip.basename or "Page Title"`} +endsnippet + +snippet fieldset "Fieldset" +
    + $1 + + $0 +
    +endsnippet + +snippet movie "Embed QT movie (movie)" b + + + + + + +endsnippet + +snippet html5 "HTML5 Template" + + + + ${1} + + + +
    + ${2} +
    +
    + ${4} +
    + + +endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets new file mode 100644 index 000000000..9df5f7884 --- /dev/null +++ b/UltiSnips/htmldjango.snippets @@ -0,0 +1 @@ +extends html, django diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets new file mode 100644 index 000000000..6e1b3ffe3 --- /dev/null +++ b/UltiSnips/java.snippets @@ -0,0 +1,212 @@ +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### + +# Many of the snippets here use a global option called +# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline +# before '{' braces. + +global !p +def nl(snip): + if snip.opt("g:ultisnips_java_brace_style", "") == "nl": + snip += "" + else: + snip.rv += " " +endglobal + +snippet ab "abstract" b +abstract +endsnippet + +snippet as "assert" b +assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0 +endsnippet + +snippet br "break" +break; + +endsnippet + +snippet cs "case" b +case $1: + $2 +$0 +endsnippet + +snippet ca "catch" b +catch (${1:Exception} ${2:e})`!p nl(snip)`{ + $0 +} +endsnippet + +snippet cl "class" b +class ${1:`!p +snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{ + $0 +} +endsnippet + +snippet cos "constant string" b +static public final String ${1:var} = "$2";$0 +endsnippet + +snippet co "constant" b +static public final ${1:String} ${2:var} = $3;$0 +endsnippet + +snippet de "default" b +default: + $0 +endsnippet + +snippet elif "else if" b +else if ($1)`!p nl(snip)`{ + $0 +} +endsnippet + +snippet /el(se)?/ "else" br +else`!p nl(snip)`{ + $0 +} +endsnippet + +snippet fi "final" b +final +endsnippet + +snippet fore "for (each)" b +for ($1 : $2)`!p nl(snip)`{ + $0 +} +endsnippet + +snippet for "for" b +for ($1; $2; $3)`!p nl(snip)`{ + $0 +} +endsnippet + +snippet if "if" b +if ($1)`!p nl(snip)`{ + $0 +} +endsnippet + +snippet imt "import junit_framework_TestCase;" b +import junit.framework.TestCase; +$0 +endsnippet + +snippet im "import" b +import +endsnippet + +snippet in "interface" b +interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }{ + $0 +} +endsnippet + +snippet j.b "java_beans_" i +java.beans. +endsnippet + +snippet j.i "java_io" i +java.io. +endsnippet + +snippet j.m "java_math" i +java.math. +endsnippet + +snippet j.n "java_net_" i +java.net. +endsnippet + +snippet j.u "java_util_" i +java.util. +endsnippet + +snippet main "method (main)" b +public static void main(String[] args)`!p nl(snip)`{ + $0 +} +endsnippet + +snippet m "method" b +${1:void} ${2:method}($3) ${4:throws $5 }{ + $0 +} + +endsnippet + +snippet pa "package" b +package +endsnippet + +snippet p "print" b +System.out.print($1);$0 +endsnippet + +snippet pl "println" b +System.out.println($1);$0 +endsnippet + +snippet pr "private" b +private +endsnippet + +snippet po "protected" b +protected +endsnippet + +snippet pu "public" b +public +endsnippet + +snippet re "return" b +return +endsnippet + +snippet st "static" +static +endsnippet + +snippet sw "switch" b +switch ($1)`!p nl(snip)`{ + $0 +} +endsnippet + +snippet sy "synchronized" +synchronized +endsnippet + +snippet tc "test case" +public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCase}`!p nl(snip)`{ + $0 +} +endsnippet + +snippet t "test" b +public void test${1:Name}() throws Exception`!p nl(snip)`{ + $0 +} +endsnippet + +snippet th "throw" b +throw $0 +endsnippet + +snippet v "variable" b +${1:String} ${2:var}${3: = ${0:null}}; +endsnippet + +snippet wh "while" b +while ($1)`!p nl(snip)`{ + $0 +} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets new file mode 100644 index 000000000..e4e7f7ab6 --- /dev/null +++ b/UltiSnips/javascript.snippets @@ -0,0 +1,65 @@ +########################################################################### +# TextMate Snippets # +########################################################################### +snippet get "Get Elements" +getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') +endsnippet + +snippet '':f "object method string" +'${1:${2:#thing}:${3:click}}': function(element){ + $0 +}${10:,} +endsnippet + +snippet :f "Object Method" +${1:method_name}: function(${3:attribute}){ + $0 +}${10:,} +endsnippet + +snippet :, "Object Value JS" +${1:value_name}:${0:value}, +endsnippet + +snippet : "Object key key: 'value'" +${1:key}: ${2:"${3:value}"}${4:, } +endsnippet + +snippet proto "Prototype (proto)" +${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{ + ${0:// body...} +}; + +endsnippet + +snippet for "for (...) {...} (faster)" +for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){ + ${3:$1[$2]}$0 +}; +endsnippet + +snippet for "for (...) {...}" +for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) { + ${3:$1[$2]}$0 +}; +endsnippet + +snippet fun "function (fun)" +function ${1:function_name} (${2:argument}) { + ${0:// body...} +} +endsnippet + +snippet ife "if ___ else" +if (${1:true}) {$0} else{}; +endsnippet + +snippet if "if" +if (${1:true}) {$0}; +endsnippet + +snippet timeout "setTimeout function" +setTimeout(function() {$0}${2:}, ${1:10}); +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/javascript_jasmine.snippets b/UltiSnips/javascript_jasmine.snippets new file mode 100644 index 000000000..49e38a35d --- /dev/null +++ b/UltiSnips/javascript_jasmine.snippets @@ -0,0 +1,168 @@ +# +# JavaScript versions -- from the TextMate bundle + some additions +# for jasmine-jquery matchers +# +extends javascript + +snippet des "Describe (js)" b +describe('${1:description}', function() { + $0 +}); +endsnippet + +snippet it "it (js)" b +it('${1:description}', function() { + $0 +}); +endsnippet + +snippet bef "before each (js)" b +beforeEach(function() { + $0 +}); +endsnippet + +snippet aft "after each (js)" b +afterEach(function() { + $0 +}); +endsnippet + +snippet any "any (js)" b +jasmine.any($1) +endsnippet + +snippet ru "runs (js)" b +runs(function() { + $0 +}); +endsnippet + +snippet wa "waits (js)" b +waits($1); +endsnippet + +snippet ex "expect (js)" b +expect(${1:target})$0; +endsnippet + +snippet ee "expect to equal (js)" b +expect(${1:target}).toEqual(${2:value}); +endsnippet + +snippet em "expect to match (js)" b +expect(${1:target}).toMatch(${2:pattern}); +endsnippet + +snippet eha "expect to have attribute (js)" b +expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet et "expect to be truthy (js)" b +expect(${1:target}).toBeTruthy(); +endsnippet + +snippet ef "expect to be falsy (js)" b +expect(${1:target}).toBeFalsy(); +endsnippet + +snippet ed "expect to be defined (js)" b +expect(${1:target}).toBeDefined(); +endsnippet + +snippet en "expect to be null (js)" b +expect(${1:target}).toBeNull(); +endsnippet + +snippet ec "expect to contain (js)" b +expect(${1:target}).toContain(${2:value}); +endsnippet + +snippet ev "expect to be visible (js)" b +expect(${1:target}).toBeVisible(); +endsnippet + +snippet eh "expect to be hidden (js)" b +expect(${1:target}).toBeHidden(); +endsnippet + +snippet notx "expect not (js)" b +expect(${1:target}).not$0; +endsnippet + +snippet note "expect not to equal (js)" b +expect(${1:target}).not.toEqual(${2:value}); +endsnippet + +snippet notm "expect not to match (js)" b +expect(${1:target}).not.toMatch(${2:pattern}); +endsnippet + +snippet notha "expect to not have attribute (js)" b +expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet nott "expect not to be truthy (js)" b +expect(${1:target}).not.toBeTruthy(); +endsnippet + +snippet notf "expect not to be falsy (js)" b +expect(${1:target}).not.toBeFalsy(); +endsnippet + +snippet notd "expect not to be defined (js)" b +expect(${1:target}).not.toBeDefined(); +endsnippet + +snippet notn "expect not to be null (js)" b +expect(${1:target}).not.toBeNull(); +endsnippet + +snippet notc "expect not to contain (js)" b +expect(${1:target}).not.toContain(${2:value}); +endsnippet + +snippet notv "expect not to be visible (js)" b +expect(${1:target}).not.toBeVisible(); +endsnippet + +snippet noth "expect not to be hidden (js)" b +expect(${1:target}).not.toBeHidden(); +endsnippet + +snippet s "spy on (js)" b +spyOn(${1:object}, '${2:method}')$0; +endsnippet + +snippet sr "spy on and return (js)" b +spyOn(${1:object}, '${2:method}').andReturn(${3:arguments}); +endsnippet + +snippet st "spy on and throw (js)" b +spyOn(${1:object}, '${2:method}').andThrow(${3:exception}); +endsnippet + +snippet sct "spy on and call through (js)" b +spyOn(${1:object}, '${2:method}').andCallThrough(); +endsnippet + +snippet scf "spy on and call fake (js)" b +spyOn(${1:object}, '${2:method}').andCallFake(${3:function}); +endsnippet + +snippet esc "expect was called (js)" b +expect(${1:target}).wasCalled(); +endsnippet + +snippet escw "expect was called with (js)" b +expect(${1:target}).wasCalledWith(${2:arguments}); +endsnippet + +snippet notsc "expect was not called (js)" b +expect(${1:target}).wasNotCalled(); +endsnippet + +snippet noscw "expect was not called with (js)" b +expect(${1:target}).wasNotCalledWith(${2:arguments}); +endsnippet + diff --git a/UltiSnips/jinja2.snippets b/UltiSnips/jinja2.snippets new file mode 100644 index 000000000..6fef6edfa --- /dev/null +++ b/UltiSnips/jinja2.snippets @@ -0,0 +1,209 @@ + +# http://jinja.pocoo.org/ + +# jinja2 is a full featured template engine for Python. It has full +# unicode support, an optional integrated sandboxed execution +# environment, widely used and BSD licensed. + +# possible extends: +#extends html + + +snippet block "block" b +{% block ${1:name} %} + $2 +{% endblock $1 %} +endsnippet + + +snippet {{ "variable" b +{{ $1 }} +endsnippet + + +snippet {# "comment" b +{# $1 #} +endsnippet + + +snippet # "comment" b +{# $1 #} +endsnippet + + +snippet raw "escaped block" b +{% raw %} + $1 +{% endraw %} +endsnippet + + +snippet extends "extends" b +{% extends "${1:template}" %} +endsnippet + + +snippet include "include" b +{% include "${1:template}" %} +endsnippet + + +snippet import "import" b +{% import "${1:template}" %} +endsnippet + + +snippet from "from/import/as" b +{% from "${1:template}" import ${2:name}${3: as ${4:$2}} %} +endsnippet + + +snippet filter "filter" b +{% filter ${1:filter} %} + $2 +{% endfilter %} +endsnippet + + +# Being able to quickly remove the whole 'else' block seems faster to me than +# choosing between 'for' and 'for/else' snippets from the menu. +# snippet for "for" b +# {% for ${1:item} in ${2:sequence} %} +# $3${4: +# {% else %} +# $5} +# {% endfor %} +# endsnippet + + +snippet for "for" b +{% for ${1:item} in ${2:sequence} %} + $3 +{% endfor %} +endsnippet + + +snippet for "for/else" b +{% for ${1:item} in ${2:sequence} %} + $3 +{% else %} + $4 +{% endfor %} +endsnippet + + +snippet if "if" b +{% if ${1:expr} %} + $2 +{% endif %} +endsnippet + + +snippet if "if/else" b +{% if ${1:expr} %} + $2 +{% else %} + $3 +{% endif %} +endsnippet + + +snippet if "if/elif/else" b +{% if ${1:expr} %} + $2 +{% elif %} + $3 +{% else %} + $4 +{% endif %} +endsnippet + + +snippet macro "macro" b +{% macro ${1:name}(${2:args}) %} + $3 +{% endmacro %} +endsnippet + + +snippet call "call" b +{% call ${1:name}(${2:args}) %} + $3 +{% endcall %} +endsnippet + + +snippet set "set" b +{% set ${1:name} = ${2:'value'} %} +endsnippet + + +snippet trans "translation" b +{% trans %} + $1 +{% endtrans %} +endsnippet + + +snippet with "with" b +{% with %} + $1 +{% endwith %} +endsnippet + + +snippet autoescape "autoescape" b +{% autoescape ${1:true} %} + $2 +{% endautoescape %} +endsnippet + +# Filters +# @todo: expand only when snippet is preceeded by a | + +snippet batch "batch items" w +batch(linecount=$1, fill_with=${2:None}) +endsnippet + + +snippet dictsort "sort and yield (key, value) pairs" w +dictsort(case_sensitive=${1:False}, by=${2:'key'}) +endsnippet + + +snippet round "round number" w +round(precision=${1:0}, method=${2:'common|ceil|floor'}) +endsnippet + + +snippet urlize "convert plain-text url to " w +urlize(trim_url_limit=${1:None}, nofollow=${2:False}) +endsnippet + + +snippet wordwrap "wordwrap" w +wordwrap(width=${1:79}, break_long_words=${2:True}) +endsnippet + + +snippet truncate "truncate" w +truncate(lenght=${1:79}, killwords=${2:False}, end=${3:'...''}) +endsnippet + + +snippet sum "sum of sequence of numbers + start" w +sum(attribute=${1:None}, start=${2:0}) +endsnippet + + +snippet sort "sort an iterable" w +sort(reverse=${1:False}, case_sensitive=${2:False}, attribute=${3:None}) +endsnippet + + +snippet indent "indent" w +indent(width=${1:4}, indentfirst=${2:False}) +endsnippet + + +# vim:ft=snippets: diff --git a/UltiSnips/json.snippets b/UltiSnips/json.snippets new file mode 100644 index 000000000..81e65611d --- /dev/null +++ b/UltiSnips/json.snippets @@ -0,0 +1,19 @@ +snippet s "String" b +"${1:key}": "${0:value}", +endsnippet + +snippet n "number" b +"${1:key}": ${0:value}, +endsnippet + +snippet a "Array" b +[ + ${VISUAL}$0 +], +endsnippet +snippet o "Object" b +{ + ${VISUAL}$0 +}, +endsnippet + diff --git a/UltiSnips/lua.snippets b/UltiSnips/lua.snippets new file mode 100644 index 000000000..1b82a245b --- /dev/null +++ b/UltiSnips/lua.snippets @@ -0,0 +1,37 @@ +################################# +# Snippets for the Lua language # +################################# +snippet #! "Shebang header" b +#!/usr/bin/env lua +$0 +endsnippet + +snippet !fun(ction)?! "New function" br +function ${1:new_function}(${2:args}) + $0 +end +endsnippet + +snippet forp "pair for loop" b +for ${1:name},${2:val} in pairs(${3:table_name}) do + $0 +end +endsnippet + +snippet fori "ipair for foop" b +for ${1:idx},${2:val} in ipairs(${3:table_name}) do + $0 +end +endsnippet + +snippet for "numeric for loop" b +for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do + $0 +end +endsnippet + +snippet local "local x = 1" +local ${1:x} = ${0:1} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/mako.snippets b/UltiSnips/mako.snippets new file mode 100644 index 000000000..92a7be38a --- /dev/null +++ b/UltiSnips/mako.snippets @@ -0,0 +1,90 @@ +################# +# From snipmate # +################# +snippet def "definition" b +<%def name="${1:name}"> + ${2:} + +endsnippet + +snippet call "call" b +<%call expr="${1:name}"> + ${2:} + +endsnippet + +snippet doc "doc" b +<%doc> + ${1:} + +endsnippet + +snippet text "text" b +<%text> + ${1:} + +endsnippet + +snippet for "for" b +% for ${1:i} in ${2:iter}: + ${3:} +% endfor +endsnippet + +snippet if "if " b +% if ${1:condition}: + ${2:} +% endif +endsnippet + +snippet if "if/else" b +% if ${1:condition}: + ${2:} +% else: + ${3:} +% endif +endsnippet + +snippet try "try" b +% try: + ${1:} +% except${2:}: + ${3:pass} +% endtry +endsnippet + +snippet wh "wh" b +% while ${1:}: + ${2:} +% endwhile +endsnippet + +snippet $ "$" i +${${1:}} +endsnippet + +snippet <% "<%" b +<% ${1:} %> +endsnippet + +snippet +endsnippet + +snippet inherit "inherit" b +<%inherit file="${1:filename}" /> +endsnippet + +snippet include "include" b +<%include file="${1:filename}" /> +endsnippet + +snippet namespace "namespace" b +<%namespace file="${1:name}" /> +endsnippet + +snippet page "page" b +<%page args="${1:}" /> +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/markdown.snippets b/UltiSnips/markdown.snippets new file mode 100644 index 000000000..c3189b8a1 --- /dev/null +++ b/UltiSnips/markdown.snippets @@ -0,0 +1,44 @@ +########################################################################### +# SNIPPETS for MARKDOWN # +########################################################################### + +########################### +# Sections and Paragraphs # +########################### +snippet sec "Section" b +# ${1:Section Name} # +$0 +endsnippet + +snippet ssec "Sub Section" b +## ${1:Section Name} ## +$0 +endsnippet + +snippet sssec "SubSub Section" b +### ${1:Section Name} ### +$0 +endsnippet + +snippet par "Paragraph" b +#### ${1:Paragraph Name} #### +$0 +endsnippet + +snippet spar "Paragraph" b +##### ${1:Paragraph Name} ##### +$0 +endsnippet + +################ +# Common stuff # +################ +snippet link "Link to something" +[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0 +endsnippet + +snippet img "Image" +![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/objc.snippets b/UltiSnips/objc.snippets new file mode 100644 index 000000000..0c6766417 --- /dev/null +++ b/UltiSnips/objc.snippets @@ -0,0 +1,270 @@ +########################################################################### +# TextMate Snippets # +########################################################################### + +snippet imp "#import (imp)" b +#import "${1:`!p snip.rv = re.sub(r'\..*$', '.h', fn)`}" +endsnippet + +snippet Imp "#import <> (Imp)" +#import <${1:Cocoa/Cocoa.h}> +endsnippet + +snippet cl "020 Class (objc)" +@interface ${1:`!p +if len(fn): + snip.rv = re.sub(r'\..*$', '', fn) +else: + snip.rv = "object" +`} : ${2:NSObject} +{ +} +@end + +@implementation $1 +- (id)init +{ + if((self = [super init])) + {$0 + } + return self; +} +@end +endsnippet + +snippet array "NSArray (array)" +NSMutableArray *${1:array} = [NSMutableArray array]; +endsnippet + +snippet dict "NSDictionary (dict)" +NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary]; +endsnippet + +snippet forarray "for NSArray loop (forarray)" +unsigned int ${1:object}Count = [${2:array} count]; + +for(unsigned int index = 0; index < $1Count; index += 1) +{ + ${3:id} $1 = [$2 objectAtIndex:index]; + $0 +} +endsnippet + +snippet objacc "Object Accessors (objacc)" +- (${1:id})${2:thing} +{ + return $2; +} + +- (void)set${2/./\u$0/}:($1)aValue +{ + $0${1/( \*)?$/(?1:$1: )/}old${2/./\u$0/} = $2; + $2 = [aValue retain]; + [old${2/./\u$0/} release]; +} +endsnippet + +snippet sel "@selector" +@selector(${1:method}:) +endsnippet + +snippet cdacc "CoreData Accessors Implementation" +- (${1:id})${2:attribute} +{ + [self willAccessValueForKey:@"$2"]; + $1 value = [self primitiveValueForKey:@"$2"]; + [self didAccessValueForKey:@"$2"]; + return value; +} + +- (void)set${2/./\u$0/}:($1)aValue +{ + [self willChangeValueForKey:@"$2"]; + [self setPrimitiveValue:aValue forKey:@"$2"]; + [self didChangeValueForKey:@"$2"]; +} +endsnippet + +snippet delegate "Delegate Responds to Selector" +if([${1:[self delegate]} respondsToSelector:@selector(${2:selfDidSomething:})]) + [$1 ${3:${2/((^\s*([A-Za-z0-9_]*:)\s*)|(:\s*$)|(:\s*))/(?2:$2self :\:<>)(?4::)(?5: :)/g}}]; + +endsnippet + +snippet thread "Detach New NSThread" +[NSThread detachNewThreadSelector:@selector(${1:method}:) toTarget:${2:aTarget} withObject:${3:anArgument}] +endsnippet + +snippet ibo "IBOutlet (ibo)" +IBOutlet ${1:NSSomeClass} *${2:${1/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}}; +endsnippet + +snippet I "Initialize Implementation (I)" ++ (void)initialize +{ + [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: + $0@"value", @"key", + nil]]; +} +endsnippet + +snippet bind "Key:value binding (bind)" +bind:@"${1:binding}" toObject:${2:observableController} withKeyPath:@"${3:keyPath}" options:${4:nil} +endsnippet + +snippet arracc "LoD array (arracc)" +- (void)addObjectTo${1:Things}:(${2:id})anObject +{ + [${3:${1/./\l$0/}} addObject:anObject]; +} + +- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i +{ + [$3 insertObject:anObject atIndex:i]; +} + +- ($2)objectIn$1AtIndex:(unsigned int)i +{ + return [$3 objectAtIndex:i]; +} + +- (unsigned int)indexOfObjectIn$1:($2)anObject +{ + return [$3 indexOfObject:anObject]; +} + +- (void)removeObjectFrom$1AtIndex:(unsigned int)i +{ + [$3 removeObjectAtIndex:i]; +} + +- (unsigned int)countOf$1 +{ + return [$3 count]; +} + +- (NSArray *${1/./\l$0/} +{ + return $3; +} + +- (void)set$1:(NSArray *)new$1 +{ + [$3 setArray:new$1]; +} +endsnippet + +snippet arracc "LoD array interface (arracc)" +- (void)addObjectTo${1:Things}:(${2:id})anObject; +- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i; +- ($2)objectIn$1AtIndex:(unsigned int)i; +- (unsigned int)indexOfObjectIn$1:($2)anObject; +- (void)removeObjectFrom$1AtIndex:(unsigned int)i; +- (unsigned int)countOf$1; +- (NSArray *)${1/./\l$0/}; +- (void)set$1:(NSArray *)new$1; +endsnippet + +snippet focus "Lock Focus" +[self lockFocus]; +$0 +[self unlockFocus]; +endsnippet + +snippet pool "NSAutoreleasePool (pool)" +NSAutoreleasePool *pool = [NSAutoreleasePool new]; +$0 +[pool drain]; +endsnippet + +snippet log "NSLog (log) 2" +NSLog(@"$1"${1/[^%]*(%)?.*/(?1:, :\);)/}$2${1/[^%]*(%)?.*/(?1:\);)/} +endsnippet + +snippet alert "NSRunAlertPanel (alert)" +int choice = NSRunAlertPanel(@"${1:Something important!}", @"${2:Something important just happend, and now I need to ask you, do you want to continue?}", @"${3:Continue}", @"${4:Cancel}", nil); +if(choice == NSAlertDefaultReturn) // "$3" +{ + $0; +} +else if(choice == NSAlertAlternateReturn) // "$4" +{ + +} +endsnippet + +snippet format "NSString stringWithFormat (format)" +[NSString stringWithFormat:@"$1", $2]$0 +endsnippet + +snippet objacc "Object Accessors Interface (objacc)" +- (${1:id})${2:thing}; +- (void)set${2/./\u$0/}:($1)aValue; +endsnippet + +snippet prop "Property" +@property (${1/^(e)$|.*/(?1:r)/}${1:r}${1/^(?:(r)|(e)|(c)|(a))$|.*/(?1:etain)(?2:adonly)(?3:opy)(?4:ssign)/}) ${2:NSSomeClass}$ *${3:${2/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}}; +endsnippet + +snippet getprefs "Read from defaults (getprefs)" +[[NSUserDefaults standardUserDefaults] objectForKey:${1:key}]; +endsnippet + +snippet obs "Register for Notification" +[[NSNotificationCenter defaultCenter] addObserver:${1:self} selector:@selector(${3:${2/^([A-Z]{2})?(.+?)(Notification)?$/\l$2/}}:) name:${2:NSWindowDidBecomeMainNotification} object:${4:nil}]; +endsnippet + +snippet responds "Responds to Selector" +if ([${1:self} respondsToSelector:@selector(${2:someSelector:})]) +{ + [$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}]; +} +endsnippet + +snippet gsave "Save and Restore Graphics Context (gsave)" +[NSGraphicsContext saveGraphicsState]; +$0 +[NSGraphicsContext restoreGraphicsState]; + +endsnippet + +snippet acc "Scalar Accessors (acc)" +- (${1:unsigned int})${2:thing} +{ + return ${3:$2}; +} + +- (void)set${2/./\u$0/}:(${1:unsigned int})new${2/./\u$0/} +{ + $3 = new${2/./\u$0/}; +} +endsnippet + +snippet acc "Scalar Accessors Interface (acc)" +- (${1:unsigned int})${2:thing}; +- (void)set${2/./\u$0/}:($1)new${2/./\u$0/}; +endsnippet + +snippet stracc "String Accessors (stracc)" +- (NSString *)${1:thing} +{ + return ${2:$1}; +} + +- (void)set${1/.*/\u$0/}:(NSString *)/})${3:a${1/.*/\u$0/}} +{ + $3 = [$3 copy]; + [$2 release]; + $2 = $3; +} +endsnippet + +snippet syn "Synthesize" +@synthesize ${1:property}; +endsnippet + +snippet setprefs "Write to defaults (setprefs)" +[[NSUserDefaults standardUserDefaults] setObject:${1:object} forKey:${2:key}]; +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/perl.snippets b/UltiSnips/perl.snippets new file mode 100644 index 000000000..6a9e8f9d1 --- /dev/null +++ b/UltiSnips/perl.snippets @@ -0,0 +1,127 @@ +########################################################################### +# TextMate Snippets # +########################################################################### +snippet ife "Conditional if..else (ife)" +if ($1) { + ${2:# body...} +} else { + ${3:# else...} +} + +endsnippet + +snippet ifee "Conditional if..elsif..else (ifee)" +if ($1) { + ${2:# body...} +} elsif ($3) { + ${4:# elsif...} +} else { + ${5:# else...} +} + +endsnippet + +snippet xunless "Conditional one-line (unless)" +${1:expression} unless ${2:condition}; + +endsnippet + +snippet xif "Conditional one-line (xif)" +${1:expression} if ${2:condition}; + +endsnippet + +snippet sub "Function (sub)" +sub ${1:function_name} { + ${2:# body...} +} + +endsnippet + +snippet xfore "Loop one-line (xforeach)" +${1:expression} foreach @${2:array}; + +endsnippet + +snippet xwhile "Loop one-line (xwhile)" +${1:expression} while ${2:condition}; + +endsnippet + +snippet test "Test" +#!/usr/bin/perl -w + +use strict; +use Test::More tests => ${1:1}; +use ${2:ModuleName}; + +ok(${3:assertion}); + +endsnippet + +snippet class "class" +package ${1:ClassName}; + +${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new { + my $class = shift; + $class = ref $class if ref $class; + my $self = bless {}, $class; + $self; +} + +1; + +endsnippet + +snippet eval "eval" +eval { + ${1:# do something risky...} +}; +if ($@) { + ${2:# handle failure...} +} + +endsnippet + +snippet for "for" +for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) { + ${3:# body...} +} + +endsnippet + +snippet fore "foreach" +foreach ${1:my $${2:x}} (@${3:array}) { + ${4:# body...} +} + +endsnippet + +snippet if "if" +if ($1) { + ${2:# body...} +} + +endsnippet + +snippet slurp "slurp" +my $${1:var}; +{ local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = ; close FILE } + +endsnippet + +snippet unless "unless" +unless ($1) { + ${2:# body...} +} + +endsnippet + +snippet while "while" +while ($1) { + ${2:# body...} +} + +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets new file mode 100644 index 000000000..40461d293 --- /dev/null +++ b/UltiSnips/php.snippets @@ -0,0 +1,258 @@ +## Snippets from SnipMate, taken from +## https://github.com/scrooloose/snipmate-snippets.git + +snippet array "array" +$${1:arrayName} = array('${2}' => ${3});${4} +endsnippet + +snippet def "def" +define('${1}'${2});${3} +endsnippet + +snippet do "do" +do { + ${2:// code... } +} while (${1:/* condition */});" +endsnippet + +snippet doc_f "doc_f" +/** + * $2 + * @return ${4:void} + * @author ${5:`!v g:snips_author`} + **/ +${1:public }function ${2:someFunc}(${3}) +{${6} +} +endsnippet + +snippet doc_i "doc_i" +/** + * $1 + * @package ${2:default} + * @author ${3:`!v g:snips_author`} + **/ +interface ${1:someClass} +{${4} +} // END interface $1" +endsnippet + +snippet else "else" +else { + ${1:// code...} +} +endsnippet + +snippet for "for" +for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { + ${4:// code...} +} +endsnippet + +snippet foreachk "foreachk" +foreach ($${1:variable} as $${2:key} => $${3:value}){ + ${4:// code...} +} +endsnippet + +snippet get "get" +$_GET['${1}']${2} +endsnippet + +snippet if "if" +if (${1:/* condition */}) { + ${2:// code...} +} +endsnippet + +snippet inc "inc" +include '${1:file}';${2} +endsnippet + +snippet log "log" +error_log(var_export(${1}, true));${2} +endsnippet + +snippet post "post" +$_POST['${1}']${2} +endsnippet + +snippet req1 "req1" +require_once '${1:file}';${2} +endsnippet + +snippet session "session" +$_SESSION['${1}']${2} +endsnippet + +snippet t "t" +$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} +endsnippet + +snippet var "var" +var_export(${1});${2} +endsnippet + +snippet getter "PHP Class Getter" !b +/* + * Getter for $1 + */ +public function get${1/\w+\s*/\u$0/}() +{ + return $this->$1;$2 +} +$4 +endsnippet + +snippet setter "PHP Class Setter" !b +/* + * Setter for $1 + */ +public function set${1/\w+\s*/\u$0/}($$1) +{ + $this->$1 = $$1;$3 + ${4:return $this;} +} +$0 +endsnippet + +snippet gs "PHP Class Getter Setter" !b +protected $$1 + +/* + * Getter for $1 + */ +public function get${1/\w+\s*/\u$0/}() +{ + return $this->$1;$2 +} + +/* + * Setter for $1 + */ +public function set${1/\w+\s*/\u$0/}($$1) +{ + $this->$1 = $$1;$3 + ${4:return $this;} +} +$0 +endsnippet + +snippet pub "Public function" !b +public function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pro "Protected function" !b +protected function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pri "Private function" !b +private function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pubs "Public static function" !b +public static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pros "Protected static function" !b +protected static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pris "Private static function" !b +private static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet fu "Function snip" !b +function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet +# :vim:ft=snippets + +snippet fore "Foreach loop" +foreach ($${1:variable} as $${3:value}){ + ${VISUAL}${4} +} +$0 +endsnippet + +snippet new "New class instance" !b +$$1 = new $1($2); +$0 +endsnippet + + +snippet ife "if else" +if (${1:/* condition */}) { + ${2:// code...} +} else { + ${3:// code...} +} +$0 +endsnippet + + +snippet class "Class declaration template" !b +/** + * Class ${1:`!p snip.rv=snip.fn.capitalize().split('.')[0]`} + * @author $2 + */ +class $1 +{ + public function ${3:__construct}(${4:$options}) + { + ${4:// code} + } +} +$0 +endsnippet + +snippet pr "Dumb debug helper in HTML" +echo '
    ' . var_export($1, 1) . '
    ';$0 +endsnippet + +snippet pc "Dumb debug helper in cli" +var_export($1);$0 +endsnippet + +# Symfony 2 based snippets +snippet sfa "Symfony 2 Controller action" +/** +* @Route("/${1:route_name}", name="$1") +* @Template() +*/ +public function $1Action($2) +{ + $3 + return ${4:array();}$0 +} +endsnippet + +# :vim:ft=snippets: + diff --git a/UltiSnips/puppet.snippets b/UltiSnips/puppet.snippets new file mode 100644 index 000000000..68ae0fe44 --- /dev/null +++ b/UltiSnips/puppet.snippets @@ -0,0 +1,78 @@ +# Snippets for Puppet + +snippet /^class/ "Class declaration" r +class ${1:name} { + ${0:# body} +} +endsnippet + +snippet File "Defaults for file" b +File { + owner => ${1:username}, + group => ${2:groupname}, +} +endsnippet + +# Resource types +snippet package "Package resource type" b +package { "${1:name}": + ensure => ${2:installed}, +} +endsnippet + +snippet file "File resource type" b +file { "${1:name}": + source => "puppet://${2:path}", + mode => ${3:mode}, +endsnippet + +snippet group "Group resource type" b +group { "${1:groupname}": + ensure => ${3:present}, + gid => ${2:gid}, +endsnippet + +snippet user "user resource type" b +group { "${1:username}": + ensure => ${2:present}, + uid => ${3:uid}, + gid => ${4:gid}, + comment => ${5:gecos}, + home => ${6:homedirectory}, + managehome => false, + require => Group["${7:group"], +endsnippet + +snippet exec "Exec resource type" b +exec { "${1:command}": + refreshonly => true, +} +endsnippet + +snippet cron "Cron resource type" b +cron { "${1:name}": + user => ${2:user}, + command => "${3:command}", + minute => ${3:minute}, + hour => ${4:hour}, +} +endsnippet + +snippet mount "Mount resource type" b +mount { "${1:path}": + device => "${2:/dev}", + fstype => "${3:filesystem}", + ensure => mounted, + options => "rw,errors=remount-ro", +} +endsnippet + +snippet service "Service resource type" b +service { "${1:name}": + hasstatus => true, + enable => true, + ensure => running, +} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets new file mode 100644 index 000000000..a770d2a98 --- /dev/null +++ b/UltiSnips/python.snippets @@ -0,0 +1,468 @@ +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### + +#! header +snippet #! "Shebang header for python scripts" b +#!/usr/bin/env python +# encoding: utf-8 +$0 +endsnippet + +snippet ifmain "ifmain" b +if __name__ == '__main__': + ${1:main()}$0 +endsnippet + + +########## +# COMMON # +########## + +# The smart def and smart class snippets use a global option called +# "g:ultisnips_python_style" which, if set to "doxygen" will use doxygen +# style comments in docstrings. + +global !p + +NORMAL = 0x1 +DOXYGEN = 0x2 +SPHINX = 0x3 + +def get_args(arglist): + args = [arg.split('=')[0].strip() for arg in arglist.split(',') if arg] + args = [arg for arg in args if arg and arg != "self"] + + return args + + +def get_style(snip): + style = snip.opt("g:ultisnips_python_style", "normal") + + if style == "doxygen": return DOXYGEN + elif style == "sphinx": return SPHINX + else: return NORMAL + + +def format_arg(arg, style): + if style == DOXYGEN: + return "@param %s @todo" % arg + elif style == SPHINX: + return ":param %s: @todo" % arg + elif style == NORMAL: + return ":%s: @todo" % arg + + +def format_return(style): + if style == DOXYGEN: + return "@return: @todo" + elif style in (NORMAL, SPHINX): + return ":returns: @todo" + + +def write_docstring_args(args, snip): + if not args: + snip.rv += ' """' + return + + snip.rv += '\n' + snip.mkline('', indent='') + + style = get_style(snip) + + for arg in args: + snip += format_arg(arg, style) + + +def write_init_body(args, parents, snip): + parents = [p.strip() for p in parents.split(",")] + parents = [p for p in parents if p != 'object'] + + for p in parents: + snip += p + ".__init__(self)" + + if parents: + snip.rv += '\n' + snip.mkline('', indent='') + + for arg in args: + snip += "self._%s = %s" % (arg, arg) + + +def write_slots_args(args, snip): + args = ['"%s"' % arg for arg in args] + snip += '__slots__ = (%s,)' % ', '.join(args) + +endglobal + +######################################## +# Class & Special Method Name Snippets # +######################################## + +snippet class "class with docstrings" b +class ${1:MyClass}(${2:object}): + """${3:Docstring for $1 }""" + + def __init__(self$4): + """${5:@todo: to be defined}`!p +snip.rv = "" +snip >> 2 + +args = get_args(t[4]) + +write_docstring_args(args, snip) +if args: + snip.rv += '\n' + snip.mkline('', indent='') + snip += '"""' + +write_init_body(args, t[2], snip) +` + $0 +endsnippet + + +snippet slotclass "class with slots and docstrings" b +class ${1:MyClass}(${2:object}): + """${3:Docstring for $1 }""" +`!p +snip >> 1 +args = get_args(t[4]) +write_slots_args(args, snip) +` + + def __init__(self$4): + """${5:@todo: to be defined}`!p +snip.rv = "" +snip >> 2 + +args = get_args(t[4]) + +write_docstring_args(args, snip) +if args: + snip.rv += '\n' + snip.mkline('', indent='') + snip += '"""' + +write_init_body(args, t[2], snip) +` + $0 +endsnippet + + +snippet contain "methods for emulating a container type" b +def __len__(self): + ${1:pass} + +def __getitem__(self, key): + ${2:pass} + +def __setitem__(self, key, value): + ${3:pass} + +def __delitem__(self, key): + ${4:pass} + +def __iter__(self): + ${5:pass} + +def __reversed__(self): + ${6:pass} + +def __contains__(self, item): + ${7:pass} +endsnippet + + +snippet context "context manager methods" b +def __enter__(self): + ${1:pass} + +def __exit__(self, exc_type, exc_value, traceback): + ${2:pass} +endsnippet + + +snippet attr "methods for customizing attribute access" b +def __getattr__(self, name): + ${1:pass} + +def __setattr__(self, name, value): + ${2:pass} + +def __delattr__(self, name): + ${3:pass} +endsnippet + + +snippet desc "methods implementing descriptors" b +def __get__(self, instance, owner): + ${1:pass} + +def __set__(self, instance, value): + ${2:pass} + +def __delete__(self, instance): + ${3:pass} +endsnippet + + +snippet cmp "methods implementing rich comparison" +def __eq__(self, other): + ${1:pass} + +def __ne__(self, other): + ${2:pass} + +def __lt__(self, other): + ${3:pass} + +def __le__(self, other): + ${4:pass} + +def __gt__(self, other): + ${5:pass} + +def __ge__(self, other): + ${6:pass} + +def __cmp__(self, other): + ${7:pass} +endsnippet + + +snippet repr "methods implementing string representation" +def __repr__(self): + ${1:pass} + +def __str__(self): + ${2:pass} + +def __unicode__(self): + ${3:pass} +endsnippet + + +# note: reflected operands and augmented arithmeitc assignements have been +# intentionally ommited to reduce verbosity. +snippet numeric "methods for emulating a numeric type" b +def __add__(self, other): + ${1:pass} + +def __sub__(self, other): + ${2:pass} + +def __mul__(self, other): + ${3:pass} + +def __div__(self, other): + ${4:pass} + +def __truediv__(self, other): + ${5:pass} + +def __floordiv__(self, other): + ${6:pass} + + +def __mod__(self, other): + ${7:pass} + +def __divmod__(self, other): + ${8:pass} + +def __pow__(self, other): + ${9:pass} + + +def __lshift__(self, other): + ${10:pass} + +def __rshift__(self, other): + ${11:pass} + +def __and__(self, other): + ${12:pass} + +def __xor__(self, other): + ${13:pass} + +def __or__(self, other): + ${14:pass} + + +def __neg__(self): + ${15:pass} + +def __pos__(self): + ${16:pass} + +def __abs__(self): + ${17:pass} + +def __invert__(self): + ${18:pass} + + +def __complex__(self): + ${19:pass} + +def __int__(self): + ${20:pass} + +def __long__(self): + ${21:pass} + +def __float__(self): + ${22:pass} + + +def __oct__(self): + ${22:pass} + +def __hex__(self): + ${23:pass} + + +def __index__(self): + ${24:pass} + +def __coerce__(self, other): + ${25:pass} +endsnippet + +snippet def "function with docstrings" b +def ${1:function}(`!p +if snip.indent: + snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}): + """${4:@todo: Docstring for $1}`!p +snip.rv = "" +snip >> 1 + +args = get_args(t[2]) +if args: + write_docstring_args(args, snip) + +style = get_style(snip) +snip += format_return(style) +snip.rv += '\n' + snip.mkline('', indent='') +snip += '"""' ` + ${0:pass} +endsnippet + + +# doesn't expand when there is a word in front +snippet /(^|(?<=\W))\./ "self." r +self. +endsnippet + +snippet from "from module import name" b +from ${1:module} import ${2:Stuff} +endsnippet + + +############## +# PROPERTIES # +############## +snippet roprop "Read Only Property" b +@property +def ${1:property}(self): + ${2:return self._$1}$0 +endsnippet + +snippet rwprop "Read write property" b +def ${1:property}(): + ${2/.+/(?0:""")/}${2:The RW property $1}`!p if t[2]: + snip.rv += '"""' + snip >> 1 + snip += "" +else: + snip.rv = ""`def fget(self): + return self._$1$0 + def fset(self, value): + self._$1 = value + return locals() +$1 = property(**$1()) +endsnippet + + +########################## +# Try / Except / Finally # +########################## +snippet try "Try / Except" b +try: + ${1:pass} +except ${2:Exception}, ${3:e}: + ${4:raise $3} +endsnippet + +snippet try "Try / Except / Else" b +try: + ${1:pass} +except ${2:Exception}, ${3:e}: + ${4:raise $3} +else: + ${5:pass} +endsnippet + +snippet try "Try / Except / Finally" b +try: + ${1:pass} +except ${2:Exception}, ${3:e}: + ${4:raise $3} +finally: + ${5:pass} +endsnippet + +snippet try "Try / Except / Else / Finally" b +try: + ${1:pass} +except${2: ${3:Exception}, ${4:e}}: + ${5:raise} +else: + ${6:pass} +finally: + ${7:pass} +endsnippet + + +##################### +# Assertions & Tests # +##################### + +snippet pdb "Set PDB breakpoint" b +import pdb; pdb.set_trace() +endsnippet + +snippet ae "Assert equal" b +self.assertEqual(${1:first},${2:second}) +endsnippet + +snippet at "Assert True" b +self.assertTrue(${0:exp}) +endsnippet + +snippet af "Assert False" b +self.assertFalse(${1:expression}) +endsnippet + +snippet aae "Assert almost equal" b +self.assertAlmostEqual(${1:first},${2:second}) +endsnippet + +snippet ar "Assert raises" b +self.assertRaises(${1:exception}, ${2:func}${3/.+/, /}${3:arguments}) +endsnippet + + +snippet testcase "pyunit testcase" b +class Test${1:Class}(${2:unittest.TestCase}): + """${3:Test case docstring}""" + + def setUp(self): + ${4:pass} + + def tearDown(self): + ${5:pass} + + def test_${6:name}(self): + ${7:pass} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/rails.snippets b/UltiSnips/rails.snippets new file mode 100644 index 000000000..9e0e29f88 --- /dev/null +++ b/UltiSnips/rails.snippets @@ -0,0 +1,906 @@ +########################################################################### +# GENERATED FROM get_tm_snippets.py # +########################################################################### + +snippet anaf "accepts_nested_attributes_for" +accepts_nested_attributes_for :${1:association_name}${2:${3:, :allow_destroy => true}${4:, :reject_if => proc \{ |obj| ${5:obj.blank?} \}}} + +endsnippet + +snippet tcbi "Create binary column" +t.binary :${1:title}${2:, :limit => ${3:2}.megabytes} +$0 +endsnippet + +snippet tcb "Create boolean column" +t.boolean :${1:title} +$0 +endsnippet + +snippet cla "Create controller class" +class ${1:Model}Controller < ApplicationController + before_filter :find_${2:model} + + $0 + + private + def find_${2} + @$2 = ${3:$1}.find(params[:id]) if params[:id] + end +end +endsnippet + +snippet tcda "Create date column" +t.date :${1:title} +$0 +endsnippet + +snippet tcdt "Create datetime column" +t.datetime :${1:title} +$0 +endsnippet + +snippet tcd "Create decimal column" +t.decimal :${1:title}${2:${3:, :precision => ${4:10}}${5:, :scale => ${6:2}}} +$0 +endsnippet + +snippet tcf "Create float column" +t.float :${1:title} +$0 +endsnippet + +snippet cla "Create functional test class" +require 'test_helper' + +class ${1:Model}ControllerTest < ActionController::TestCase + test$0 +end + +endsnippet + +snippet tci "Create integer column" +t.integer :${1:title} +$0 +endsnippet + +snippet tcl "Create lock_version column" +t.integer :lock_version, :null => false, :default => 0 +$0 +endsnippet + +# FIXME: handling literal bracket pair inside of nested tab groups? +snippet tcr "Create references column" +t.references :${1:taggable}${2:, :polymorphic => ${3:{ :default => '${4:Photo}' \}}} +$0 +endsnippet + +snippet resources "Create resources controller class" +class ${1:Model}sController < ApplicationController + before_filter :find_${1/./\l$0/}, :only => [:show, :edit, :update, :destroy] + + # GET /${1/./\l$0/}s + # GET /${1/./\l$0/}s.xml + def index + @${1/./\l$0/}s = ${1:Model}.all + + respond_to do |wants| + wants.html # index.html.erb + wants.xml { render :xml => @${1/./\l$0/}s } + end + end + + # GET /${1/./\l$0/}s/1 + # GET /${1/./\l$0/}s/1.xml + def show + respond_to do |wants| + wants.html # show.html.erb + wants.xml { render :xml => @${1/./\l$0/} } + end + end + + # GET /${1/./\l$0/}s/new + # GET /${1/./\l$0/}s/new.xml + def new + @${1/./\l$0/} = ${1:Model}.new + + respond_to do |wants| + wants.html # new.html.erb + wants.xml { render :xml => @${1/./\l$0/} } + end + end + + # GET /${1/./\l$0/}s/1/edit + def edit + end + + # POST /${1/./\l$0/}s + # POST /${1/./\l$0/}s.xml + def create + @${1/./\l$0/} = ${1:Model}.new(params[:${1/./\l$0/}]) + + respond_to do |wants| + if @${1/./\l$0/}.save + flash[:notice] = '${1:Model} was successfully created.' + wants.html { redirect_to(@${1/./\l$0/}) } + wants.xml { render :xml => @${1/./\l$0/}, :status => :created, :location => @${1/./\l$0/} } + else + wants.html { render :action => "new" } + wants.xml { render :xml => @${1/./\l$0/}.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /${1/./\l$0/}s/1 + # PUT /${1/./\l$0/}s/1.xml + def update + respond_to do |wants| + if @${1/./\l$0/}.update_attributes(params[:${1/./\l$0/}]) + flash[:notice] = '${1:Model} was successfully updated.' + wants.html { redirect_to(@${1/./\l$0/}) } + wants.xml { head :ok } + else + wants.html { render :action => "edit" } + wants.xml { render :xml => @${1/./\l$0/}.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /${1/./\l$0/}s/1 + # DELETE /${1/./\l$0/}s/1.xml + def destroy + @${1/./\l$0/}.destroy + + respond_to do |wants| + wants.html { redirect_to(${1/./\l$0/}s_url) } + wants.xml { head :ok } + end + end + + private + def find_${1/./\l$0/} + @${1/./\l$0/} = ${1:Model}.find(params[:id]) + end + +end + +endsnippet + +snippet tcs "Create string column" +t.string :${1:title} +$0 +endsnippet + +snippet tct "Create text column" +t.text :${1:title} +$0 +endsnippet + +snippet tcti "Create time column" +t.time :${1:title} +$0 +endsnippet + +snippet tcts "Create timestamp column" +t.timestamp :${1:title} +$0 +endsnippet + +snippet tctss "Create timestamps columns" +t.timestamps +$0 +endsnippet + +snippet mcol "Migration Create Column (mcc)" +t.column ${1:title}, :${2:string} +$0 +endsnippet + +snippet mccc "Migration Create Column Continue (mccc)" +t.column ${1:title}, :${2:string} +mccc$0 +endsnippet + +snippet mtab "Migration Drop Create Table (mdct)" +drop_table :${1:table}${2: [press tab twice to generate create_table]} +endsnippet + +snippet mcol "Migration Remove and Add Column (mrac)" +remove_column :${1:table}, :${2:column}${3: [press tab twice to generate add_column]} +endsnippet + +snippet rdb "RAILS_DEFAULT_LOGGER.debug (rdb)" +RAILS_DEFAULT_LOGGER.debug "${1:message}"$0 +endsnippet + +snippet tre "Table column(s) rename" +t.rename(:${1:old_column_name}, :${2:new_column_name}) +$0 +endsnippet + +snippet art "Test Assert Redirected To (art)" +assert_redirected_to ${2::action => "${1:index}"} +endsnippet + +snippet asre "Test Assert Response (are)" +assert_response :${1:success}, @response.body$0 +endsnippet + +snippet aftc "after_create" +after_create +endsnippet + +snippet aftd "after_destroy" +after_destroy +endsnippet + +snippet afts "after_save" +after_save +endsnippet + +snippet aftu "after_update" +after_update +endsnippet + +snippet aftv "after_validation" +after_validation +endsnippet + +snippet aftvoc "after_validation_on_create" +after_validation_on_create +endsnippet + +snippet aftvou "after_validation_on_update" +after_validation_on_update +endsnippet + +snippet asg "assert(var = assigns(:var))" +assert(${1:var} = assigns(:${1}), "Cannot find @${1}") +$0 +endsnippet + +snippet asd "assert_difference" +assert_difference "${1:Model}.${2:count}", ${3:1} do + $0 +end +endsnippet + +snippet asnd "assert_no_difference" +assert_no_difference "${1:Model}.${2:count}" do + $0 +end +endsnippet + +snippet artnpp "assert_redirected_to (nested path plural)" +assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:${2}})} +endsnippet + +snippet artnp "assert_redirected_to (nested path)" +assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})} +endsnippet + +snippet artpp "assert_redirected_to (path plural)" +assert_redirected_to ${10:${2:model}s_path} +endsnippet + +snippet artp "assert_redirected_to (path)" +assert_redirected_to ${2:${12:model}_path(${13:@}${14:${12}})} +endsnippet + +snippet asrj "assert_rjs" +assert_rjs :${1:replace}, ${2:"${3:dom id}"} +endsnippet + +snippet ass "assert_select" +assert_select '${1:path}'${2:, :${3:text} => ${4:'${5:inner_html}'}}${6: do + $0 +end} +endsnippet + +snippet befc "before_create" +before_create +endsnippet + +snippet befd "before_destroy" +before_destroy +endsnippet + +snippet befs "before_save" +before_save +endsnippet + +snippet befu "before_update" +before_update +endsnippet + +snippet befv "before_validation" +before_validation +endsnippet + +snippet befvoc "before_validation_on_create" +before_validation_on_create +endsnippet + +snippet befvou "before_validation_on_update" +before_validation_on_update +endsnippet + +snippet bt "belongs_to (bt)" +belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"} +endsnippet + +snippet crw "cattr_accessor" +cattr_accessor :${0:attr_names} +endsnippet + +snippet defcreate "def create - resource" +def create + @${1:model} = ${2:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}.new(params[:$1]) + $0 + respond_to do |wants| + if @$1.save + flash[:notice] = '$2 was successfully created.' + wants.html { redirect_to(@$1) } + wants.xml { render :xml => @$1, :status => :created, :location => @$1 } + else + wants.html { render :action => "new" } + wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } + end + end +end + +endsnippet + +snippet test "test do..end" +test "${1:something interesting}" do + $0 +end +endsnippet + +snippet deftg "def get request" +def test_should_get_${1:action} + ${2:@${3:model} = ${4:$3s}(:${5:fixture_name}) + }get :${1}${6:, :id => @$3.to_param} + assert_response :success + $0 +end +endsnippet + +snippet deftp "def post request" +def test_should_post_${1:action} + ${3:@$2 = ${4:$2s}(:${5:fixture_name}) + }post :${1}${6:, :id => @$2.to_param}, :${2:model} => { $0 } + assert_response :redirect + +end +endsnippet + +snippet fina "find(:all)" +find(:all${1:, :conditions => ['${2:${3:field} = ?}', ${5:true}]}) +endsnippet + +snippet finf "find(:first)" +find(:first${1:, :conditions => ['${2:${3:field} = ?}', ${5:true}]}) +endsnippet + +snippet fini "find(id)" +find(${1:id}) +endsnippet + +snippet fine "find_each" +find_each(${1::conditions => {:${2:field} => ${3:true}\}}) do |${4:${TM_CURRENT_WORD/(\w+)\./\L$1/g}}| + $0 +end +endsnippet + +snippet finb "find_in_batches" +find_in_batches(${1::conditions => {:${2:field} => ${3:true}\}}) do |${4:${TM_CURRENT_WORD/(\w+)\./\L$1/g}}s| + $4s.each do |$4| + $0 + end +end +endsnippet + +snippet habtm "has_and_belongs_to_many (habtm)" +has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:${1}_id}"} +endsnippet + +snippet hm "has_many (hm)" +has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"} +endsnippet + +snippet hmt "has_many (through)" +has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:${2}_table_foreign_key_to_${1}_table}} +endsnippet + +snippet hmd "has_many :dependent => :destroy" +has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0 +endsnippet + +snippet ho "has_one (ho)" +has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"} +endsnippet + +snippet logd "logger.debug" +${1:Rails.}logger.debug { "${1:message}" }$0 +endsnippet + +snippet loge "logger.error" +logger.error { "${1:message}" }$0 +endsnippet + +snippet logf "logger.fatal" +logger.fatal { "${1:message}" }$0 +endsnippet + +snippet logi "logger.info" +logger.info { "${1:message}" }$0 +endsnippet + +snippet logw "logger.warn" +logger.warn { "${1:message}" }$0 +endsnippet + +snippet mp "map(&:sym_proc)" +map(&:${1:id}) +endsnippet + +snippet mapca "map.catch_all" +${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}" + +endsnippet + +snippet map "map.named_route" +${1:map}.${2:connect} '${3::controller/:action/:id}' +endsnippet + +snippet mapr "map.resource" +${1:map}.resource :${2:resource}${10: do |${11:$2}| + $0 +end} +endsnippet + +snippet maprs "map.resources" +${1:map}.resources :${2:resource}${10: do |${11:$2}| + $0 +end} +endsnippet + +snippet mapwo "map.with_options" +${1:map}.with_options :${2:controller} => '${3:thing}' do |${4:$3}| + $0 +end + +endsnippet + +snippet mrw "mattr_accessor" +mattr_accessor :${0:attr_names} +endsnippet + +snippet ncl "named_scope lambda" +named_scope :name, lambda { |${1:param}| { :conditions => ${3:['${4:${5:field} = ?}', ${6:$1}]} } } + +endsnippet + +snippet nc "named_scope" +named_scope :name${1:, :joins => :${2:table}}, :conditions => ${3:['${4:${5:field} = ?}', ${6:true}]} + +endsnippet + +snippet dscope "default_scope" +default_scope ${1:order(${2:'${3:created_at DESC}'})} +endsnippet + +snippet flash "flash[...]" +flash[:${1:notice}] = "${2:Successfully created...}"$0 +endsnippet + +snippet rea "redirect_to (action)" +redirect_to :action => "${1:index}" +endsnippet + +snippet reai "redirect_to (action, id)" +redirect_to :action => "${1:show}", :id => ${0:@item} +endsnippet + +snippet rec "redirect_to (controller)" +redirect_to :controller => "${1:items}" +endsnippet + +snippet reca "redirect_to (controller, action)" +redirect_to :controller => "${1:items}", :action => "${2:list}" +endsnippet + +snippet recai "redirect_to (controller, action, id)" +redirect_to :controller => "${1:items}", :action => "${2:show}", :id => ${0:@item} +endsnippet + +snippet renpp "redirect_to (nested path plural)" +redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:${10}})}) +endsnippet + +snippet renp "redirect_to (nested path)" +redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}) +endsnippet + +snippet repp "redirect_to (path plural)" +redirect_to(${2:${10:model}s_path}) +endsnippet + +snippet rep "redirect_to (path)" +redirect_to(${2:${12:model}_path(${13:@}${14:${12}})}) +endsnippet + +snippet reb "redirect_to :back" +redirect_to :back +endsnippet + +snippet ra "render (action)... (ra)" +render :action => "${1:action}" +endsnippet + +snippet ral "render (action,layout) (ral)" +render :action => "${1:action}", :layout => "${2:layoutname}" +endsnippet + +snippet rf "render (file) (rf)" +render :file => "${1:filepath}" +endsnippet + +snippet rfu "render (file,use_full_path) (rfu)" +render :file => "${1:filepath}", :use_full_path => ${2:false} +endsnippet + +snippet ri "render (inline) (ri)" +render :inline => "${1:<%= 'hello' %>}" +endsnippet + +snippet ril "render (inline,locals) (ril)" +render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"$4 } +endsnippet + +snippet rit "render (inline,type) (rit)" +render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml} +endsnippet + +snippet rl "render (layout) (rl)" +render :layout => "${1:layoutname}" +endsnippet + +snippet rn "render (nothing) (rn)" +render :nothing => ${1:true} +endsnippet + +snippet rns "render (nothing,status) (rns)" +render :nothing => ${1:true}, :status => ${2:401} +endsnippet + +snippet rt "render (text) (rt)" +render :text => "${1:text to render...}" +endsnippet + +snippet rtl "render (text,layout) (rtl)" +render :text => "${1:text to render...}", :layout => "${2:layoutname}" +endsnippet + +snippet rtlt "render (text,layout => true) (rtlt)" +render :text => "${1:text to render...}", :layout => ${2:true} +endsnippet + +snippet rts "render (text,status) (rts)" +render :text => "${1:text to render...}", :status => ${2:401} +endsnippet + +snippet ru "render (update)" +render :update do |${2:page}| + $2.$0 +end +endsnippet + +snippet rest "respond_to" +respond_to do |wants| + wants.${1:html}${2: { $0 \}} +end +endsnippet + +snippet resw "respond_with" +respond_with(${1:@${2:model}})${3: do |format| + format.${4:html} { $0 \} +end} +endsnippet + +# FIXME +snippet returning "returning do |variable| ... end" +returning ${1:variable} do${2/(^(?\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1: |)/}${2:v}${2/(^(?\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g)*,?\s*$)|.*/(?1:|)/} + $0 +end +endsnippet + +snippet t. "t.binary (tcbi)" +t.binary :${1:title}${2:, :limit => ${3:2}.megabytes} +t.$0 +endsnippet + +snippet t. "t.boolean (tcb)" +t.boolean :${1:title} +t.$0 +endsnippet + +snippet t. "t.date (tcda)" +t.date :${1:title} +t.$0 +endsnippet + +snippet t. "t.datetime (tcdt)" +t.datetime :${1:title} +t.$0 +endsnippet + +snippet t. "t.decimal (tcd)" +t.decimal :${1:title}${2:${3:, :precision => ${4:10}}${5:, :scale => ${6:2}}} +t.$0 +endsnippet + +snippet t. "t.float (tcf)" +t.float :${1:title} +t.$0 +endsnippet + +snippet t. "t.integer (tci)" +t.integer :${1:title} +t.$0 +endsnippet + +snippet t. "t.lock_version (tcl)" +t.integer :lock_version, :null => false, :default => 0 +t.$0 +endsnippet + +snippet t. "t.references (tcr)" +t.references :${1:taggable}${2:, :polymorphic => ${3:{ :default => '${4:Photo}' \}}} +t.$0 +endsnippet + +snippet t. "t.rename (tre)" +t.rename(:${1:old_column_name}, :${2:new_column_name}) +t.$0 +endsnippet + +snippet t. "t.string (tcs)" +t.string :${1:title} +t.$0 +endsnippet + +snippet t. "t.text (tct)" +t.text :${1:title} +t.$0 +endsnippet + +snippet t. "t.time (tcti)" +t.time :${1:title} +t.$0 +endsnippet + +snippet t. "t.timestamp (tcts)" +t.timestamp :${1:title} +t.$0 +endsnippet + +snippet t. "t.timestamps (tctss)" +t.timestamps +t.$0 +endsnippet + +snippet vaoif "validates_acceptance_of if" +validates_acceptance_of :${1:terms}${2:${3:, :accept => "${4:1}"}${5:, :message => "${6:You must accept the terms of service}"}}, :if => proc { |obj| ${7:obj.condition?} }} +endsnippet + +snippet vao "validates_acceptance_of" +validates_acceptance_of :${1:terms}${2:${3:, :accept => "${4:1}"}${5:, :message => "${6:You must accept the terms of service}"}} +endsnippet + +snippet va "validates_associated (va)" +validates_associated :${1:attribute}${2:, :on => :${3:create}} +endsnippet + +snippet vaif "validates_associated if (vaif)" +validates_associated :${1:attribute}${2:, :on => :${3:create}, :if => proc { |obj| ${5:obj.condition?} }} +endsnippet + +snippet vc "validates_confirmation_of (vc)" +validates_confirmation_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:should match confirmation}"} +endsnippet + +snippet vcif "validates_confirmation_of if (vcif)" +validates_confirmation_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:should match confirmation}", :if => proc { |obj| ${5:obj.condition?} }} +endsnippet + +snippet ve "validates_exclusion_of (ve)" +validates_exclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not allowed}"} +endsnippet + +snippet veif "validates_exclusion_of if (veif)" +validates_exclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not allowed}"}, :if => proc { |obj| ${7:obj.condition?} }} +endsnippet + +snippet vfif "validates_format_of if" +validates_format_of :${1:attribute}, :with => /${2:^[${3:\w\d}]+\$}/${4:, :on => :${5:create}, :message => "${6:is invalid}"}, :if => proc { |obj| ${7:obj.condition?} }} +endsnippet + +snippet vf "validates_format_of" +validates_format_of :${1:attribute}, :with => /${2:^[${3:\w\d}]+\$}/${4:, :on => :${5:create}, :message => "${6:is invalid}"} +endsnippet + +snippet viif "validates_inclusion_of if" +validates_inclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not included in the list}"}, :if => proc { |obj| ${7:obj.condition?} }} +endsnippet + +snippet vi "validates_inclusion_of" +validates_inclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not included in the list}"} +endsnippet + +snippet vl "validates_length_of (vl)" +validates_length_of :${1:attribute}, :within => ${2:3..20}${3:, :on => :${4:create}, :message => "${5:must be present}"} +endsnippet + +snippet vlif "validates_length_of if" +validates_length_of :${1:attribute}, :within => ${2:3..20}${3:, :on => :${4:create}, :message => "${5:must be present}"}, :if => proc { |obj| ${6:obj.condition?} }} +endsnippet + +snippet vnif "validates_numericality_of if" +validates_numericality_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:is not a number}"}, :if => proc { |obj| ${5:obj.condition?} }} +endsnippet + +snippet vn "validates_numericality_of" +validates_numericality_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:is not a number}"} +endsnippet + +snippet vp "validates_presence_of (vp)" +validates_presence_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:can't be blank}"} +endsnippet + +snippet vpif "validates_presence_of if (vpif) 2" +validates_presence_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:can't be blank}"}, :if => proc { |obj| ${5:obj.condition?} }} +endsnippet + +snippet vu "validates_uniqueness_of (vu)" +validates_uniqueness_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:must be unique}"} +endsnippet + +snippet vuif "validates_uniqueness_of if (vuif)" +validates_uniqueness_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:must be unique}", :if => proc { |obj| ${6:obj.condition?} }} +endsnippet + +snippet verify "verify -- render" +verify :only => [:$1], :method => :post, :render => {:status => 500, :text => "use HTTP-POST"} + +endsnippet + +snippet verify "verify -- redirect" +verify :only => [:$1], :session => :user, :params => :id, :redirect_to => {:action => '${2:index}'} + +endsnippet + +snippet wants "wants_format" +wants.${1:js|xml|html}${2: { $0 \}} +endsnippet + +snippet xdelete "xhr delete" +xhr :delete, :${1:destroy}, :id => ${2:1}$0 +endsnippet + +snippet xget "xhr get" +xhr :get, :${1:show}${2:, :id => ${3:1}}$0 +endsnippet + +snippet xpost "xhr post" +xhr :post, :${1:create}, :${2:object} => { $3 } +endsnippet + +snippet xput "xhr put" +xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { $4 }$0 +endsnippet + +snippet finl "find(:last)" +find(:last${1:, :conditions => ['${2:${3:field} = ?}', ${5:true}]}) +endsnippet + +snippet sweeper "Create sweeper class" +class ${1:Model}Sweeper < ActionController::Caching::Sweeper + observe ${1:Model} + + def after_save(${1/./\l$0/}) + expire_cache(${1/./\l$0/}) + end + + def after_destroy(${1/./\l$0/}) + expire_cache(${1/./\l$0/}) + end + + private + + def expire_cache(${1/./\l$0/}) + ${0:expire_page ${1/./\l$0/}s_path + expire_page ${1/./\l$0/}_path(${1/./\l$0/})} + end + +end +endsnippet + +snippet col "collection routes" +collection do + ${1:get :${2:action}} + ${3:put :${4:action}} + ${5:post :${6:action}} + ${7:delete :${8:action}} +end +endsnippet + +snippet format "format (respond_with)" +format.${1:html|xml|json|js|any} { $0 } +endsnippet + +snippet gem "gem" +gem '${1:name}'${2:${3:, "${4:1.0}"}${5:${6:, :require => ${7:"${8:$1}"}}${9:, :group => :${10:test}}}} +endsnippet + +snippet gemg "gem :git" +gem '${1:paperclip}', :git => "${2:git://github.com/thoughtbot/paperclip.git}"${3:, :branch => "${4:rails3}"} +endsnippet + +snippet match "match" +match '${1:${2::controller}${3:/${4::action}${5:/${6::id}${7:(.:format)}}}}'${8: => '${9:$2}#${10:$4}'${11:, :as => :${12:$10}}} +endsnippet + +snippet member "member routes" +member do + ${1:get :${2:action}} + ${3:put :${4:action}} + ${5:post :${6:action}} + ${7:delete :${8:action}} +end +endsnippet + +snippet res "resources" +resources :${1:posts}${2: do + $3 +end} +endsnippet + +snippet scope "scope" +scope :${1:name}, ${2:joins(:${3:table}).}where(${4:'${5:$3.${6:field}} = ?', ${7:'${8:value}'}}) +endsnippet + +snippet scopel "scope lambda" +scope :${1:name}, lambda { |${2:param}| ${3:where(${4::${5:field} => ${6:"${7:value}"}})} } +endsnippet + +snippet scopee "scope with extension" +scope :${1:name}, ${2:where(${3::${4:field} => ${5:'${6:value}'}})} do + def ${7:method_name} + $0 + end +end +endsnippet + +snippet sb "scoped_by" +scoped_by_${1:attribute}(${2:id}) +endsnippet + +snippet setup "setup do..end" +setup do + $0 +end +endsnippet + +snippet trans "Translation snippet" +I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}${3}', :default => "${1:some_text}"${4})${5:$0} +endsnippet + +snippet route_spec +it 'routes to #${1:action}' do + ${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})${6} +end +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets new file mode 100644 index 000000000..717451015 --- /dev/null +++ b/UltiSnips/rst.snippets @@ -0,0 +1,61 @@ + + +########################################################################### +# General Stuff # +########################################################################### +snippet part "Part" b +`!p snip.rv = len(t[1])*'#'` +${1:Part name} +`!p snip.rv = len(t[1])*'#'` + +$0 +endsnippet + +snippet sec "Section" b +${1:Section name} +`!p snip.rv = len(t[1])*'='` + +$0 +endsnippet + +snippet ssec "Subsection" b +${1:Section name} +`!p snip.rv = len(t[1])*'-'` + +$0 +endsnippet + +snippet sssec "Subsubsection" b +${1:Section name} +`!p snip.rv = len(t[1])*'^'` + +$0 +endsnippet + +snippet chap "Chapter" b +`!p snip.rv = len(t[1])*'*'` +${1:Chapter name} +`!p snip.rv = len(t[1])*'*'` + +$0 +endsnippet + +snippet para "Paragraph" b +${1:Paragraph name} +`!p snip.rv = len(t[1])*'"'` + +$0 +endsnippet + +########################################################################### +# More Specialized Stuff. # +########################################################################### +snippet cb "Code Block" b +.. code-block:: ${1:lua} + + ${2:code} + +$0 +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/ruby.snippets b/UltiSnips/ruby.snippets new file mode 100644 index 000000000..63365890d --- /dev/null +++ b/UltiSnips/ruby.snippets @@ -0,0 +1,568 @@ +snippet "^#!" "#!/usr/bin/env ruby" r +#!/usr/bin/env ruby +$0 +endsnippet + + +snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r +# encoding: UTF-8 +$0 +endsnippet + + + +snippet If " if " +${1:command} if ${0:expression} +endsnippet + + + +snippet Unless " unless " +${1:command} unless ${0:expression} +endsnippet + + + +snippet if "if ... end" +if ${1:condition} + ${2:# TODO} +end +endsnippet + + + +snippet ife "if ... else ... end" +if ${1:condition} + ${2:# TODO} +else + ${3:# TODO} +end +endsnippet + + + +snippet ifee "if ... elseif ... else ... end" +if ${1:condition} + ${2:# TODO} +elsif ${3:condition} + ${4:# TODO} +else + ${0:# TODO} +end +endsnippet + + + +snippet unless "unless ... end" +unless ${1:condition} + ${0:# TODO} +end +endsnippet + + + +snippet unlesse "unless ... else ... end" +unless ${1:condition} + ${2:# TODO} +else + ${0:# TODO} +end +endsnippet + + + +snippet unlesee "unless ... elseif ... else ... end" +unless ${1:condition} + ${2:# TODO} +elsif ${3:condition} + ${4:# TODO} +else + ${0:# TODO} +end +endsnippet + + + +snippet "\b(de)?f" "def ..." r +def ${1:function_name}${2: ${3:*args}} + ${0:# TODO} +end +endsnippet + + + +snippet defi "def initialize ..." +def initialize${1: ${2:*args}} + ${0:# TODO} +end +endsnippet + + + +snippet defr "def ... rescue ..." +def ${1:function_name}${2: ${3:*args}} + ${4:# TODO} +rescue + ${0:# TODO} +end +endsnippet + + + +snippet For "(..).each { || }" +(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} } +endsnippet + + + +snippet for "(..).each do || end" +(${1:from}..${2:to}).each do |${3:i}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Merge!" ".merge!() { |,,| }" r +`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) { |${2:key},${3:oldval},${4:newval}| ${5:block} } +endsnippet + + + +snippet "(\S+)\.merge!" ".merge!() do |,,| end" r +`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) do |${2:key},${3:oldval},${4:newval}| + ${0:block} +end +endsnippet + + + +snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |,| }" r +`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} } +endsnippet + + + +snippet "(\S+)\.del(ete)?_?if" ".delete_if do |,| end" r +`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Keep_?if" ".keep_if { |,| }" r +`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} } +endsnippet + + + +snippet "(\S+)\.keep_?if" ".keep_if do ,| end" r +`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Reject" ".reject { |,| }" r +`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} } +endsnippet + + + +snippet "(\S+)\.reject" ".reject do ,| end" r +`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Select" ".select { || }" r +`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} } +endsnippet + + + +snippet "(\S+)\.select" ".select do || end" r +`!p snip.rv=match.group(1)`.select do |${1:item}| + ${0:block} +end +endsnippet + + + +snippet "(\S+)\.Sort" ".sort { |
    ,| }" r +`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} } +endsnippet + + + +snippet "(\S+)\.sort" ".sort do |,| end" r +`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Each_?k(ey)?" ".each_key { || }" r +`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} } +endsnippet + + + +snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| end" r +`!p snip.rv=match.group(1)`.each_key do |${1:key}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Each_?val(ue)?" ".each_value { || }" r +`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} } +endsnippet + + + +snippet "(\S+)\.each_?val(ue)?" ".each_value do || end" r +`!p snip.rv=match.group(1)`.each_value do |${1:value}| + ${0:# TODO} +end +endsnippet + + + +snippet Each ".each { || }" +${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} } +endsnippet + + + +snippet each ".each do || end" +${1:elements}.each do |${2:${1/s$//}}| + ${0:# TODO} +end +endsnippet + + + +snippet each_?s(lice)? ".each_slice(n) do |slice| end" +each_slice(${1:2}) do |${2:slice}| + ${0:# TODO} +end +endsnippet + + + +snippet Each_?s(lice)? ".each_slice(n) { |slice| }" +each_slice(${1:2}) { |${2:slice}| ${3:# TODO} } +endsnippet + + + + +snippet "(\S+)\.Map" ".map { || }" r +`!p snip.rv=match.group(1)`.map { |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`}| ${2:# TODO} } +endsnippet + + + +snippet "(\S+)\.map" ".map do || end" r +`!p snip.rv=match.group(1)`.map do |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { || }" r +`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`}| ${2:# TODO} } +endsnippet + + + +snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do || end" r +`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.Each" ".each { || }" r +`!p snip.rv=match.group(1)`.each { |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`}| ${2:# TODO} } +endsnippet + + + +snippet "(\S+)\.each" ".each do || end" r +`!p snip.rv=match.group(1)`.each do |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`}| + ${0:# TODO} +end +endsnippet + + + + +snippet "(\S+)\.Each_w(ith)?_?i(ndex)?" ".each_with_index { |,| }" r +`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`},${2:i}| ${3:# TODO} }$0 +endsnippet + + + +snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |,| end" r +`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p +element_name = match.group(1).lstrip('$@') +ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) +try: + wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1)) + snip.rv = wmatch.group(1).lower() +except: + snip.rv = 'element' +`},${2:i}| + ${0:# TODO} +end +endsnippet + + + + +snippet "(\S+)\.Each_?p(air)?" ".each_pair { |,| }" r +`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} } +endsnippet + + + +snippet "(\S+)\.each_?p(air)?" ".each_pair do |,| end" r +`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}| + ${0:# TODO} +end +endsnippet + + + +snippet "(\S+)\.sub" ".sub() { }" r +`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} } +endsnippet + + + +snippet "(\S+)\.gsub" ".gsub() { }" r +`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} } +endsnippet + + + +snippet "(\S+)\.index" ".index { |item| }" r +`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} } +endsnippet + + + +snippet "(\S+)\.Index" ".index do |item| ... end" r +`!p snip.rv=match.group(1)`.index do |${1:item}| + ${0:block} +end +endsnippet + + + +snippet do "do || ... end" i +do ${1:|${2:key}|} + $0 +end +endsnippet + + + +snippet Do "do ... end" i +do + $0 +end +endsnippet + + +snippet until "until ... end" +until ${1:expression} + ${0:# TODO} +end +endsnippet + + + +snippet Until "begin ... end until " +begin + ${0:# TODO} +end until ${1:expression} +endsnippet + + + +snippet while "while ... end" +while ${1:expression} + ${0:# TODO} +end +endsnippet + + + +snippet While "begin ... end while " +begin + ${0:# TODO} +end while ${1:expression} +endsnippet + + + +snippet "\b(r|attr)" "attr_reader :" r +attr_reader :${0:attr_names} +endsnippet + + + +snippet "\b(w|attr)" "attr_writer :" r +attr_writer :${0:attr_names} +endsnippet + + + +snippet "\b(rw|attr)" "attr_accessor :" r +attr_accessor :${0:attr_names} +endsnippet + + + +snippet begin "begin ... rescue ... end" +begin + ${1:# TODO} +rescue + ${0:# TODO} +end +endsnippet + + + +snippet begin "begin ... rescue ... else ... ensure ... end" +begin + ${1:# Raise exception} +rescue Exception => e + puts e.message + puts e.backtrace.inspect + ${2:# Rescue} +else + ${3:# other exception} +ensure + ${0:# always excute} +end +endsnippet + + + +snippet rescue +rescue Exception => e + puts e.message + puts e.backtrace.inspect + ${0:# Rescue} +endsnippet + + + +snippet "\b(case|sw(itch)?)" "case when ... end" r +case ${1:variable} +when ${2:expression} +$0 +end +endsnippet + + + +snippet alias "alias : :" +alias :${1:new_name} :${2:old_name} +endsnippet + + + +snippet class "class def initialize ... end end" +class ${1:class_name} + def initialize ${2:*args} + $0 + end +end +endsnippet + + + +snippet module "module" +module ${1:module_name} + $0 +end +endsnippet + + + +snippet ### +=begin + $0 +=end +endsnippet + +# vim: set ts=2 sw=2 expandtab: diff --git a/UltiSnips/sh.snippets b/UltiSnips/sh.snippets new file mode 100644 index 000000000..915c0df9a --- /dev/null +++ b/UltiSnips/sh.snippets @@ -0,0 +1,88 @@ +global !p +import vim + +# Tests for the existence of a variable declared by Vim's filetype detection +# suggesting the type of shell script of the current file +def testShell(scope, shell): + return vim.eval("exists('" + scope + ":is_" + shell + "')") + +# Loops over the possible variables, checking for global variables +# first since they indicate an override by the user. +def getShell(): + for scope in ["g", "b"]: + for shell in ["bash", "sh", "kornshell"]: + if testShell(scope, shell) == "1": + if shell == "kornshell": + return "ksh" + return shell + return "sh" +endglobal + +########################################################################### +# TextMate Snippets # +########################################################################### +snippet #! +`!p snip.rv = '#!/bin/' + getShell() + "\n\n" ` +endsnippet + +snippet !env "#!/usr/bin/env (!env)" +`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" ` +endsnippet + +snippet temp "Tempfile" +${1:TMPFILE}="$(mktemp -t ${2:`!p +snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled" +`})" +${3:${4/(.+)/trap "/}${4:rm -f '$${1/.*\s//}'}${4/(.+)/" 0 # EXIT\n/}${5/(.+)/trap "/}${5:rm -f '$${1/.*\s//}'; exit 1}${5/(.+)/" 2 # INT\n/}${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'; exit 1}${6/(.+)/" 1 15 # HUP TERM\n/}} + +endsnippet + +snippet case "case .. esac (case)" +case ${1:word} in + ${2:pattern} ) + $0;; +esac +endsnippet + +snippet elif "elif .. (elif)" +elif ${2:[[ ${1:condition} ]]}; then + ${0:#statements} +endsnippet + +snippet for "for ... done (for)" +for (( i = 0; i < ${1:10}; i++ )); do + ${0:#statements} +done +endsnippet + +snippet forin "for ... in ... done (forin)" +for ${1:i}${2/.+/ in /}${2:words}; do + ${0:#statements} +done +endsnippet + +snippet here "here document (here)" +<<-${2:'${1:TOKEN}'} + $0 +${1/['"`](.+)['"`]/$1/} +endsnippet + +snippet if "if ... then (if)" +if ${2:[[ ${1:condition} ]]}; then + ${0:#statements} +fi +endsnippet + +snippet until "until ... (done)" +until ${2:[[ ${1:condition} ]]}; do + ${0:#statements} +done +endsnippet + +snippet while "while ... (done)" +while ${2:[[ ${1:condition} ]]}; do + ${0:#statements} +done +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/snippets.snippets b/UltiSnips/snippets.snippets new file mode 100644 index 000000000..414f350ee --- /dev/null +++ b/UltiSnips/snippets.snippets @@ -0,0 +1,23 @@ +######################### +# SNIPPETS for SNIPPETS # +######################### + +# We use a little hack so that the snippet is expanded +# and parsed correctly +snippet snip "Snippet definition" ! +`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b} +$0 +`!p snip.rv = "endsnippet"` +endsnippet + +snippet global "Global snippet" ! +`!p snip.rv = "global"` !p +$0 +`!p snip.rv = "endglobal"` +endsnippet + +snippet vis "${VISUAL}" i +\$\{VISUAL${1:${2:default}${3:/transform/}}\} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/tcl.snippets b/UltiSnips/tcl.snippets new file mode 100644 index 000000000..2cb1f347d --- /dev/null +++ b/UltiSnips/tcl.snippets @@ -0,0 +1,50 @@ +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### +snippet for "for... (for)" b +for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} { + ${4} +} + +endsnippet + +snippet foreach "foreach... (foreach)" +foreach ${1:var} ${2:\$list} { + ${3} +} + +endsnippet + +snippet if "if... (if)" b +if {${1:condition}} { + ${2} +} + +endsnippet + +snippet proc "proc... (proc)" b +proc ${1:name} {${2:args}} \ +{ + ${3} +} + +endsnippet + +snippet switch "switch... (switch)" b +switch ${1:-exact} -- ${2:\$var} { + ${3:match} { + ${4} + } + default {${5}} +} + +endsnippet + +snippet while "while... (while)" b +while {${1:condition}} { + ${2} +} + +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets new file mode 100644 index 000000000..d6e62fce9 --- /dev/null +++ b/UltiSnips/tex.snippets @@ -0,0 +1,125 @@ +extends texmath + +########################################################################### +# LATEX SNIPPETS # +########################################################################### + +snippet r "\ref{}" w +\ref{$1} +endsnippet + +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### + +################# +# GENERAL STUFF # +################# +snippet "b(egin)?" "begin{} / end{}" br +\begin{${1:something}} + ${0:${VISUAL}} +\end{$1} +endsnippet + +#################### +# TABULARS, ARRAYS # +#################### + +snippet tab +\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} +$0${2/((?<=.)c|l|r)|./(?1: & )/g} +\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} +endsnippet + +######################## +# ENUM, DESCR, ITEMIZE # +######################## +snippet enum "Enumerate" b +\begin{enumerate} + \item $0 +\end{enumerate} +endsnippet + +snippet item "Itemize" b +\begin{itemize} + \item $0 +\end{itemize} +endsnippet + +snippet desc "Description" b +\begin{description} + \item[$1] $0 +\end{description} +endsnippet + +##################################### +# SECTIONS, CHAPTERS AND THERE LIKE # +##################################### + +snippet part "Part" b +\part{${1:part name}} +\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/g}}} + +${0} + +% part $2 (end) +endsnippet + +snippet cha "Chapter" b +\chapter{${1:chapter name}} +\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} + +${0} + +% chapter $2 (end) +endsnippet + +snippet sec "Section" b +\section{${1:section name}} +\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} + +${0} + +% section $2 (end) +endsnippet + + +snippet sub "Subsection" b +\subsection{${1:subsection name}} +\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} + +${0} + +% subsection $2 (end) +endsnippet + +snippet ssub "Subsubsection" b +\subsubsection{${1:subsubsection name}} +\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} + +${0} + +% subsubsection $2 (end) + +endsnippet + +snippet par "Paragraph" b +\paragraph{${1:paragraph name}} +\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} + +${0} + +% paragraph $2 (end) +endsnippet + + +snippet subp "Subparagraph" b +\subparagraph{${1:subparagraph name}} +\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} + +${0} + +% subparagraph $2 (end) +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/texmath.snippets b/UltiSnips/texmath.snippets new file mode 100644 index 000000000..03589f0f2 --- /dev/null +++ b/UltiSnips/texmath.snippets @@ -0,0 +1,54 @@ +############## +# MATH STUFF # +############## +snippet eq "Equation" b +\begin{equation} + $0 +\end{equation} +endsnippet + +snippet eqnn "Equation without number" b +\begin{equation*} + $0 +\end{equation*} +endsnippet + +snippet eqa "Equation array" b +\begin{eqnarray} + $1 & $2 & $0 +\end{eqnarray} +endsnippet + +snippet eqann "Equation array without numbers" b +\begin{eqnarray*} + $1 & $2 & $0 +\end{eqnarray*} + +endsnippet +snippet frac "Fraction" w +\frac{${1:${VISUAL:nom}}}{${2:denom}} +endsnippet + +snippet mat "Smart Matrix" +\begin{${1:p/b/v/V/B/small}matrix} + $0 +\end{$1matrix} +endsnippet + +snippet lr( "left( right)" w +\left( ${1:${VISUAL}} \right) +endsnippet + +snippet lr| "left| right|" w +\left| ${1:${VISUAL}} \right| +endsnippet + +snippet lr{ "left\{ right\}" w +\left\\{ ${1:${VISUAL}} \right\\} +endsnippet + +snippet lr[ "left[ right]" w +\left[ ${1:${VISUAL}} \right] +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets new file mode 100644 index 000000000..f4c37f079 --- /dev/null +++ b/UltiSnips/vim.snippets @@ -0,0 +1,58 @@ +########################################################################### +# SnipMate Snippets # +########################################################################### +snippet header +" File: ${1:`!v expand('%:t')`} +" Author: ${2:`!v g:snips_author`} +" Description: ${3} +${4:" Last Modified: `!v strftime("%B %d, %Y")`} + +$0 +endsnippet + +snippet gvar "Global / configuration variable" +if !exists("g:${1:MyUltraImportantVar}") + let g:$1 = ${2:"${3:}"} +endif +endsnippet + +snippet guard +if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} + finish +endif +let $1 = 1${3} +endsnippet + +snippet f +fun ${1:function_name}(${2}) + ${3:" code} +endf +endsnippet + +snippet for +for ${1:needle} in ${2:haystack} + ${3:" code} +endfor +endsnippet + +snippet wh +while ${1:condition} + ${2:" code} +endw +endsnippet + +snippet if +if ${1:condition} + ${2:" code} +endif +endsnippet + +snippet ife +if ${1:condition} + ${2} +else + ${3} +endif +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/xhtml.snippets b/UltiSnips/xhtml.snippets new file mode 100644 index 000000000..cc31dbc73 --- /dev/null +++ b/UltiSnips/xhtml.snippets @@ -0,0 +1 @@ +extends html diff --git a/UltiSnips/zsh.snippets b/UltiSnips/zsh.snippets new file mode 100644 index 000000000..18a2989ee --- /dev/null +++ b/UltiSnips/zsh.snippets @@ -0,0 +1,13 @@ +extends sh + +snippet #! "shebang" ! +#!/bin/zsh + +endsnippet + +snippet !env "#!/usr/bin/env (!env)" ! +#!/usr/bin/env zsh + +endsnippet + +# vim:ft=snippets: From dfe410306b8cc3e4cc6ae277e9060268a4cec4d8 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 17 Mar 2013 20:46:38 +0100 Subject: [PATCH 0023/1587] merge changes from pull/179 --- snippets/ruby.snippets | 3 +++ snippets/sh.snippets | 3 +++ 2 files changed, 6 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index ccb3968ac..1a77d397a 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -922,6 +922,9 @@ snippet itp ${2} snippet its its(:${1:method}) { should ${2} } +snippet itsn + its(:${1:method}) { should_not ${2} } + snippet desc describe ${1:class_name} do ${2} diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 9a48eb514..b07362081 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -81,3 +81,6 @@ snippet getopt done shift $(($OPTIND-1)) + +snippet root + if [ $(id -u) -ne 0 ]; then exec sudo $0; fi From da5894a87cbd797a1f4811a764f7348dee87c9cc Mon Sep 17 00:00:00 2001 From: mockturtl Date: Mon, 3 Dec 2012 07:35:56 -0500 Subject: [PATCH 0024/1587] fix FSF address Per http://www.gnu.org/licenses/gpl-howto.html. --- snippets/_.snippets | 9 +++------ snippets/c.snippets | 3 +-- snippets/go.snippets | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index d553449d0..cb51536c3 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -26,8 +26,7 @@ snippet GPL2 GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this program; if not, see . ${3} snippet LGPL2 @@ -45,8 +44,7 @@ snippet LGPL2 GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this library; if not, see . ${3} snippet GPL3 @@ -82,8 +80,7 @@ snippet LGPL3 GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this library; if not, see . ${3} snippet BSD2 diff --git a/snippets/c.snippets b/snippets/c.snippets index c476de4ab..bf8a8fc93 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -226,8 +226,7 @@ snippet gpl * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, see . * * Copyright (C) ${1:Author}, `strftime("%Y")` */ diff --git a/snippets/go.snippets b/snippets/go.snippets index d02aa8fdf..77d7ea0b7 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -53,8 +53,7 @@ snippet gpl * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, see . * * Copyright (C) ${1:Author}, `strftime("%Y")` */ From 7238147272683441d55e9b6d1e163a63f6e3e966 Mon Sep 17 00:00:00 2001 From: indi <1334@shadowproject.net> Date: Tue, 22 Jan 2013 18:20:04 +0100 Subject: [PATCH 0025/1587] add reqr to expand to require_relative --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 1a77d397a..a9b45ad49 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -28,6 +28,8 @@ snippet beg snippet req require require "${1}"${2} +snippet reqr + require_relative "${1}"${2} snippet # # => snippet end From e9904d0845111f24ae435512c910d33b0ed7131d Mon Sep 17 00:00:00 2001 From: Jens Hoepken Date: Tue, 19 Mar 2013 23:13:26 +0100 Subject: [PATCH 0026/1587] Initial commit for OpenFOAM snippets --- snippets/openfoam.snippets | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 snippets/openfoam.snippets diff --git a/snippets/openfoam.snippets b/snippets/openfoam.snippets new file mode 100644 index 000000000..ff690cca2 --- /dev/null +++ b/snippets/openfoam.snippets @@ -0,0 +1,53 @@ +# 0/* +snippet fv + type fixedValue; + value uniform ${1}; +snippet zg + type zeroGradient; +snippet sym + type symmetryPlane; +# system/controlDict +snippet forces + forces + { + type forces; + functionObjectLibs ("libforces.so"); + enabled true; + outputControl ${1:timeStep}; + outputInterval ${2:1}; + patches (${3}); + log ${4:true}; + CofR (${5:0 0 0}); + } +# system/fvSolution +# solvers +snippet gamg + ${1:p} + { + solver GAMG; + tolerance 1e-${2:6}; + relTol ${3:0.0}; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } +snippet pbicg + ${1:U} + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-${2:6}; + relTol ${3:0.0}; + } +# PIMPLE +snippet pimple + PIMPLE + { + nOuterCorrectors ${1:outer}; + nCorrectors ${2:inner}; + nNonOrthogonalCorrectors ${3:nonOrtho}; + pRefCell ${4:cell}; + pRefValue ${5:value for $4}; + } From 62ac466722eefadff15eb259258763ea7688a0fa Mon Sep 17 00:00:00 2001 From: Pirogov Evgenij Date: Sun, 24 Mar 2013 00:09:49 +0200 Subject: [PATCH 0027/1587] Turn = into := --- snippets/go.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 77d7ea0b7..c64db91f9 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -116,7 +116,7 @@ snippet ie ${4} # for loop snippet fo - for ${2:i} = 0; $2 < ${1:count}; $2${3:++} { + for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { ${4:/* code */} } ${5} From eb7fccc55864a976fe7c942c76c8439b29334f0c Mon Sep 17 00:00:00 2001 From: Joey Curtin Date: Sat, 30 Mar 2013 11:08:09 -0400 Subject: [PATCH 0028/1587] added email and github to python.snippte-docs --- snippets/python.snippets | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index 508a51b0a..9cb21135b 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -6,11 +6,13 @@ snippet from from ${1:package} import ${2:module} # Module Docstring snippet docs - ''' + """ File: ${1:`Filename('$1.py', 'foo.py')`} - Author: ${2:`g:snips_author`} - Description: ${3} - ''' + Author: `g:snips_author` + Email: `g:snips_email` + Github: `g:snips_github` + Description: ${2} + """ snippet wh while ${1:condition}: ${2:# TODO: write code...} From 93a06c235ac892974d0acf1c0a227b7227f43855 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 2 Apr 2013 22:00:55 +0200 Subject: [PATCH 0029/1587] adding ocaml /xml snippets from UltiSnips --- UltiSnips/ocaml.snippets | 172 +++++++++++++++++++++++++++++++++++++++ UltiSnips/xml.snippets | 9 ++ 2 files changed, 181 insertions(+) create mode 100644 UltiSnips/ocaml.snippets create mode 100644 UltiSnips/xml.snippets diff --git a/UltiSnips/ocaml.snippets b/UltiSnips/ocaml.snippets new file mode 100644 index 000000000..8aefef3a0 --- /dev/null +++ b/UltiSnips/ocaml.snippets @@ -0,0 +1,172 @@ +snippet rs "raise" b +raise (${1:Not_found}) +endsnippet + +snippet open "open" +let open ${1:module} in +${2:e} +endsnippet + +snippet try "try" +try ${1:e} +with ${2:Not_found} -> ${3:()} +endsnippet + +snippet ref "ref" +let ${1:name} = ref ${2:val} in +${3:e} +endsnippet + +snippet matchl "pattern match on a list" +match ${1:list} with +| [] -> ${2:()} +| x::xs -> ${3:()} +endsnippet + +snippet matcho "pattern match on an option type" +match ${1:x} with +| Some(${2:y}) -> ${3:()} +| None -> ${4:()} +endsnippet + +snippet fun "anonymous function" +(fun ${1:x} -> ${2:x}) +endsnippet + +snippet cc "commment" +(* ${1:comment} *) +endsnippet + +snippet let "let .. in binding" +let ${1:x} = ${2:v} in +${3:e} +endsnippet + +snippet lr "let rec" +let rec ${1:f} = + ${2:expr} +endsnippet + +snippet if "if" +if ${1:(* condition *)} then + ${2:(* A *)} +else + ${3:(* B *)} +endsnippet + +snippet If "If" +if ${1:(* condition *)} then + ${2:(* A *)} +endsnippet + +snippet while "while" +while ${1:(* condition *)} do + ${2:(* A *)} +done +endsnippet + +snippet for "for" +for ${1:i} = ${2:1} to ${3:10} do + ${4:(* BODY *)} +done +endsnippet + +snippet match "match" +match ${1:(* e1 *)} with +| ${2:p} -> ${3:e2} +endsnippet + +snippet Match "match" +match ${1:(* e1 *)} with +| ${2:p} -> ${3:e2} +endsnippet + +snippet class "class" +class ${1:name} = object + ${2:methods} +end +endsnippet + +snippet obj "obj" +object + ${2:methods} +end +endsnippet + +snippet Obj "object" +object (self) + ${2:methods} +end +endsnippet + +snippet {{ "object functional update" +{< ${1:x} = ${2:y} >} +endsnippet + +snippet beg "beg" +begin + ${1:block} +end +endsnippet + +snippet ml "module instantiantion with functor" +module ${1:Mod} = ${2:Functor}(${3:Arg}) +endsnippet + +snippet mod "module - no signature" +module ${1:(* Name *)} = struct + ${2:(* BODY *)} +end +endsnippet + +snippet Mod "module with signature" +module ${1:(* Name *)} : ${2:(* SIG *)} = struct + ${3:(* BODY *)} +end +endsnippet + +snippet sig "anonymous signature" +sig + ${2:(* BODY *)} +end +endsnippet + +snippet sigf "functor signature or anonymous functor" +functor (${1:Arg} : ${2:ARG}) -> ${3:(* BODY *)} +endsnippet + +snippet func "define functor - no signature" +module ${1:M} (${2:Arg} : ${3:ARG}) = struct + ${4:(* BODY *)} +end +endsnippet + +snippet Func "define functor - with signature" +module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct + ${5:(* BODY *)} +end +endsnippet + +snippet mot "Declare module signature" +module type ${1:(* Name *)} = sig + ${2:(* BODY *)} +end +endsnippet + +snippet module "Module with anonymous signature" +module ${1:(* Name *)} : sig + ${2:(* SIGNATURE *)} +end = struct + ${3:(* BODY *)} +end +endsnippet + +snippet oo "odoc" +(** ${1:odoc} *) +endsnippet + +snippet qt "inline qtest" +(*$T ${1:name} + ${2:test} +*) +endsnippet diff --git a/UltiSnips/xml.snippets b/UltiSnips/xml.snippets new file mode 100644 index 000000000..80b017cea --- /dev/null +++ b/UltiSnips/xml.snippets @@ -0,0 +1,9 @@ +snippet t "Simple tag" b +<${1:tag}> + ${2:content} + +endsnippet + +snippet ti "Inline tag" b +<${1:tag}>${2:content} +endsnippet From ef8fa2b97e63ef95b8e48a58a10ea1aad0c791a9 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 2 Apr 2013 22:10:32 +0200 Subject: [PATCH 0030/1587] MarcWeber's UltiSnips does no longer understand extends, drop it. See its Quickstart.txt file BUG [1] --- UltiSnips/cpp.snippets | 2 -- UltiSnips/tex.snippets | 1 - UltiSnips/xhtml.snippets | 1 - UltiSnips/zsh.snippets | 2 -- 4 files changed, 6 deletions(-) diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index 9d2eb868c..6999c1f97 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -1,5 +1,3 @@ -extends c - ########################################################################### # TextMate Snippets # ########################################################################### diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index d6e62fce9..97ea8a82e 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -1,4 +1,3 @@ -extends texmath ########################################################################### # LATEX SNIPPETS # diff --git a/UltiSnips/xhtml.snippets b/UltiSnips/xhtml.snippets index cc31dbc73..e69de29bb 100644 --- a/UltiSnips/xhtml.snippets +++ b/UltiSnips/xhtml.snippets @@ -1 +0,0 @@ -extends html diff --git a/UltiSnips/zsh.snippets b/UltiSnips/zsh.snippets index 18a2989ee..803945970 100644 --- a/UltiSnips/zsh.snippets +++ b/UltiSnips/zsh.snippets @@ -1,5 +1,3 @@ -extends sh - snippet #! "shebang" ! #!/bin/zsh From 73cab09e6a30fc25a3d0d042925a9f6f9b5f69ef Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 4 Apr 2013 04:45:37 +0200 Subject: [PATCH 0031/1587] talk about additional snippet repositories --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 395dcc95d..d812b9412 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,13 @@ of the snippets by setting the "always_use_first_snippet" option to 1. If you have VimL only (vim without python support) your best option is using garbas/vim-snipmate and cope with the minor bugs found in the engine. +Related repositories +==================== +github.com/garbas/vim-snipmate -> README lists additional repositories +containing snipmate-snippets + +This list should eventually be moved here now + Historical notes ================ From a5990defd738c02902a0170177d403e065c45270 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 4 Apr 2013 04:55:39 +0200 Subject: [PATCH 0032/1587] actually moving the repository list --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d812b9412..17a73739e 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,15 @@ garbas/vim-snipmate and cope with the minor bugs found in the engine. Related repositories ==================== -github.com/garbas/vim-snipmate -> README lists additional repositories -containing snipmate-snippets +We also encourage people to maintain sets of snippets for particular use cases +so that all users can benefit from them. People can list their snippet repositories here: -This list should eventually be moved here now + * https://github.com/rbonvall/snipmate-snippets-bib (snippets for BibTeX files) + * https://github.com/sudar/vim-arduino-snippets (snippets for Arduino files) + * https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML) + * https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml) + +Installation using VAM: "github:rbonvall/snipmate-snippets-bib" Historical notes ================ From 3fa45cda70ac9b9fcc1685e2091292d1a5347e03 Mon Sep 17 00:00:00 2001 From: Yu Huanbo Date: Sun, 7 Apr 2013 19:05:25 +0800 Subject: [PATCH 0033/1587] add `nc`(namespace and class) for php http://knplabs.com/blog/boost-your-productivity-with-sf2-and-vim --- snippets/php.snippets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index e861a5be9..513ee9b60 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -222,6 +222,13 @@ snippet class ${8:// code...} } } +snippet nc + namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`}; + + ${2:abstract }class ${3:`Filename()`} + { + ${4} + } # define(...) snippet def define('${1}'${2});${3} From d052a7d891d07d2a638dc96ded412fa6c0c73f57 Mon Sep 17 00:00:00 2001 From: Yu Huanbo Date: Sun, 7 Apr 2013 19:05:25 +0800 Subject: [PATCH 0034/1587] add `nc`(namespace and class) for php http://knplabs.com/blog/boost-your-productivity-with-sf2-and-vim --- snippets/php.snippets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index e861a5be9..513ee9b60 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -222,6 +222,13 @@ snippet class ${8:// code...} } } +snippet nc + namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`}; + + ${2:abstract }class ${3:`Filename()`} + { + ${4} + } # define(...) snippet def define('${1}'${2});${3} From 4962bca954c2ad89e3f8626c4c2c78270e02066d Mon Sep 17 00:00:00 2001 From: ALX-Liu-Xiao Date: Wed, 10 Apr 2013 00:39:52 +0800 Subject: [PATCH 0035/1587] Fix c.snippets:else There is no ${2} in snippet el, but insteaded is a ${3}. Change 3 to 2; --- snippets/c.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/c.snippets b/snippets/c.snippets index bf8a8fc93..de6d6a933 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -59,7 +59,7 @@ snippet if snippet el else { ${1} - }${3} + }${2} # else if snippet elif else if (${1:/* condition */}) { From 755b3a816a2f2ba910e20bac839ae1c2b2374b02 Mon Sep 17 00:00:00 2001 From: linduxed Date: Wed, 10 Apr 2013 17:44:53 +0200 Subject: [PATCH 0036/1587] Added missing line to WTFPL snippet. --- snippets/_.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/_.snippets b/snippets/_.snippets index cb51536c3..857598483 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -235,3 +235,5 @@ snippet WTFPL DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. From 6ade12ac150ac41d9d955488e712d456d7d14a38 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Fri, 12 Apr 2013 01:16:52 +0000 Subject: [PATCH 0037/1587] Changed method snippet --- snippets/php.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 31ebdfa83..614bbbc7e 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -46,9 +46,9 @@ snippet f } # method snippet m - ${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar}) + ${1:protected} function ${2:foo}() { - ${7} + ${3} } # setter method snippet sm From 41644d72e5cc29845acf34ec5bc98b72db1adedf Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Fri, 12 Apr 2013 01:18:57 +0000 Subject: [PATCH 0038/1587] Whitespace cleanup --- snippets/php.snippets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 614bbbc7e..6be149568 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -51,7 +51,7 @@ snippet m ${3} } # setter method -snippet sm +snippet sm /** * Sets the value of ${1:foo} * @@ -104,7 +104,7 @@ snippet S $_SERVER['${1:variable}']${2} snippet SS $_SESSION['${1:variable}']${2} - + # the following are old ones snippet inc include '${1:file}';${2} @@ -205,7 +205,7 @@ snippet doc_h * @copyright ${4:$2}, `strftime('%d %B, %Y')` * @package ${5:default} */ - + # Interface snippet interface /** @@ -344,8 +344,8 @@ snippet vd snippet vdd var_dump(${1}); die(${2:}); snippet http_redirect - header ("HTTP/1.1 301 Moved Permanently"); - header ("Location: ".URL); + header ("HTTP/1.1 301 Moved Permanently"); + header ("Location: ".URL); exit(); # Getters & Setters snippet gs @@ -375,7 +375,7 @@ snippet gs snippet ags /** * ${1:description} - * + * * @${7} */ ${2:protected} $${3:foo}; From 95b1a81d6ea334002b3af263acf616feac6ef598 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Fri, 12 Apr 2013 01:20:42 +0000 Subject: [PATCH 0039/1587] Changed class snippet --- snippets/php.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 6be149568..6ca1f582c 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -28,9 +28,9 @@ snippet use use ${1:Foo\Bar\Baz}; ${2} snippet c - ${1:abstract }class ${2:`Filename()`} + class ${1:`Filename()`} { - ${3} + ${2} } snippet i interface ${1:`Filename()`} From 613f3c1b258907c713d6c6baa7b4aef197825e13 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Fri, 12 Apr 2013 02:46:37 +0000 Subject: [PATCH 0040/1587] Added array_map() snippet --- snippets/php.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 6ca1f582c..3e5a9becd 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -394,3 +394,8 @@ snippet rett return true; snippet retf return false; +snippet am + array_map(function($${1:v}) { + ${3} + return $$1; + }, $${2:foo}); From 2c858bb724c3cec61094f26f3ccf5bf28a8da8bb Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Fri, 12 Apr 2013 02:50:15 +0000 Subject: [PATCH 0041/1587] Added return array placeholder --- snippets/php.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 3e5a9becd..f8a406ff0 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -395,7 +395,7 @@ snippet rett snippet retf return false; snippet am - array_map(function($${1:v}) { + $${1:foo} = array_map(function($${2:v}) { ${3} - return $$1; - }, $${2:foo}); + return $$2; + }, $$1); From 8ec2e4ce7aab2fd84826d13dd6af9e4dc5453e46 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Fri, 12 Apr 2013 02:57:14 +0000 Subject: [PATCH 0042/1587] Added array_walk snippet --- snippets/php.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index f8a406ff0..793c2a572 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -399,3 +399,7 @@ snippet am ${3} return $$2; }, $$1); +snippet aw + array_walk($${1:foo}, function(&$${2:v}, $${3:k}) { + $$2 = ${4}; + }); From c9336b759af5f21a8ff82a678bfa967168869bb6 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Sat, 13 Apr 2013 15:57:44 +0000 Subject: [PATCH 0043/1587] Added snippet for to print wa variable to a file --- snippets/php.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 793c2a572..5ca502de8 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -343,6 +343,8 @@ snippet vd var_dump(${1}); snippet vdd var_dump(${1}); die(${2:}); +snippet vdf + error_log(print_r($${1:foo}, true), 3, '${2:/tmp/debug.log}');${3} snippet http_redirect header ("HTTP/1.1 301 Moved Permanently"); header ("Location: ".URL); From 17f194c2047b81a6646b55c8361bdd9d9e2b492e Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 16 Apr 2013 14:08:14 +0800 Subject: [PATCH 0044/1587] Fix issues in eruby.snippets --- UltiSnips/eruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/eruby.snippets b/UltiSnips/eruby.snippets index 1fdcfc167..c6b201eae 100644 --- a/UltiSnips/eruby.snippets +++ b/UltiSnips/eruby.snippets @@ -14,9 +14,9 @@ def textmate_var(var, snip): lookup = dict( TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '), TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'), - TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', ' %>'), + TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '), TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'), - TM_RAILS_TEMPLATE_END_RUBY_BLOCK = 'end' + TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>' ) snip.rv = lookup[var] From 42168b1c1711551800100c6b9b7e42b86edacc75 Mon Sep 17 00:00:00 2001 From: Nicklasos Date: Wed, 17 Apr 2013 00:44:48 +0300 Subject: [PATCH 0045/1587] Update php.snippets Add php template snippets. --- snippets/php.snippets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 513ee9b60..d803e663b 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -9,6 +9,18 @@ snippet +snippet ?= + +snippet ? + +snippet ?f + + ${3} + +snippet ?i + + ${2} + snippet ns namespace ${1:Foo\Bar\Baz}; ${2} From b66dd896e1f07489c0bfc98f3d8de9a7043312a7 Mon Sep 17 00:00:00 2001 From: Nicklasos Date: Wed, 17 Apr 2013 00:52:43 +0300 Subject: [PATCH 0046/1587] Update php.snippets --- snippets/php.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index d803e663b..31ebdfa83 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -14,11 +14,11 @@ snippet ?= snippet ? snippet ?f - + ${3} snippet ?i - + ${2} snippet ns From 5525e94d09e7b3a6344de356ed3f8591ba10edc2 Mon Sep 17 00:00:00 2001 From: Honza Pokorny Date: Tue, 23 Apr 2013 09:57:09 -0300 Subject: [PATCH 0047/1587] Add @gorodinskiy as the scala maintainer --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 17a73739e..6846edb23 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Snipmate & UltiSnip Snippets This repository contains snippets files for various programming languages. -It is community-maintained and many people have contributed snippet files and other -improvements already. +It is community-maintained and many people have contributed snippet files and +other improvements already. Contents ======== @@ -82,6 +82,7 @@ to maintain snippets for a language, please get in touch. * Markdown - [honza](http://github.com/honza) * Ruby - [taq](http://github.com/taq) * PHP - [chrisyue](http://github.com/chrisyue) +* Scala - [gorodinskiy](https://github.com/gorodinskiy) Contributing notes ------------------ From 4e4c7f48cf35a9e3f9c2a30a0ffe28e8f06b50c0 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Thu, 25 Apr 2013 14:30:58 -0300 Subject: [PATCH 0048/1587] Fix missing = on some eruby snippets. --- snippets/eruby.snippets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index f96ca8462..592e490bd 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -50,15 +50,15 @@ snippet cs snippet ct <%= content_tag '${1:DIV}', ${2:content}${3:,options} %> snippet ff - <% form_for @${1:model} do |f| %> + <%= form_for @${1:model} do |f| %> ${2} <% end %> snippet ffcb <%= ${1:f}.check_box :${2:attribute} %> snippet ffe <% error_messages_for :${1:model} %> - - <% form_for @${2:model} do |f| %> + + <%= form_for @${2:model} do |f| %> ${3} <% end %> snippet ffff @@ -78,7 +78,7 @@ snippet ffta snippet fftf <%= ${1:f}.text_field :${2:attribute} %> snippet fields - <% fields_for :${1:model}, @$1 do |${2:f}| %> + <%= fields_for :${1:model}, @$1 do |${2:f}| %> ${3} <% end %> snippet i18 From f81901d027d56455fea6b4bdb72f1c81b1496f7d Mon Sep 17 00:00:00 2001 From: Konstantin Gorodinskiy Date: Thu, 25 Apr 2013 22:59:03 +0400 Subject: [PATCH 0049/1587] fix for comments in coffeescript snippets for snipmate --- snippets/coffee.snippets | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index 83b77ebab..11c82e7db 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -6,33 +6,33 @@ snippet forindo # Array comprehension snippet fora for ${1:name} in ${2:array} - ${3:// body...} + ${3:# body...} # Object comprehension snippet foro for ${1:key}, ${2:value} of ${3:object} - ${4:// body...} + ${4:# body...} # Range comprehension (inclusive) snippet forr for ${1:name} in [${2:start}..${3:finish}] - ${4:// body...} + ${4:# body...} snippet forrb for ${1:name} in [${2:start}..${3:finish}] by ${4:step} - ${5:// body...} + ${5:# body...} # Range comprehension (exclusive) snippet forrex for ${1:name} in [${2:start}...${3:finish}] - ${4:// body...} + ${4:# body...} snippet forrexb for ${1:name} in [${2:start}...${3:finish}] by ${4:step} - ${5:// body...} + ${5:# body...} # Function snippet fun (${1:args}) -> - ${2:// body...} + ${2:# body...} # Function (bound) snippet bfun (${1:args}) => - ${2:// body...} + ${2:# body...} # Class snippet cla class .. class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} @@ -55,17 +55,17 @@ snippet cla class .. extends .. constructor: .. # If snippet if if ${1:condition} - ${2:// body...} + ${2:# body...} # If __ Else snippet ife if ${1:condition} - ${2:// body...} + ${2:# body...} else - ${3:// body...} + ${3:# body...} # Else if snippet elif else if ${1:condition} - ${2:// body...} + ${2:# body...} # Ternary If snippet ifte if ${1:condition} then ${2:value} else ${3:other} @@ -76,7 +76,7 @@ snippet unl snippet swi switch ${1:object} when ${2:value} - ${3:// body...} + ${3:# body...} # Log snippet log From 339128057027bb7595beb9971d4e335b92df1fa8 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 28 Apr 2013 15:47:48 -0300 Subject: [PATCH 0050/1587] Refactor snippet to create new collumn in a migration(mccc -> mnc) --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index a9b45ad49..802b6edd5 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -890,8 +890,8 @@ snippet mrnc rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name} snippet mcc change_column :${1:table}, :${2:column}, :${3:type} -snippet mccc - t.column :${1:title}, :${2:string} +snippet mnc + t.${1:string} :${2:title}${3:, null: false}${4} snippet mct create_table :${1:table_name} do |t| t.column :${2:name}, :${3:type} From 76f2ff8337577bb8ffa2698769e96b0dc45be328 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 28 Apr 2013 15:50:34 -0300 Subject: [PATCH 0051/1587] Remove empty column in mct snippet --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 802b6edd5..efb707568 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -894,7 +894,7 @@ snippet mnc t.${1:string} :${2:title}${3:, null: false}${4} snippet mct create_table :${1:table_name} do |t| - t.column :${2:name}, :${3:type} + ${2} end snippet migration class ${1:class_name} < ActiveRecord::Migration From 0312e12c29ba6946b9c203b758824ce071a6b0d2 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 28 Apr 2013 15:51:55 -0300 Subject: [PATCH 0052/1587] Refactor old migration creation snippet and an alternative one --- snippets/ruby.snippets | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index efb707568..fdf479a2b 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -896,16 +896,21 @@ snippet mct create_table :${1:table_name} do |t| ${2} end -snippet migration +snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end class ${1:class_name} < ActiveRecord::Migration - def self.up + def up ${2} end - def self.down + def down + end + end +snippet migration class .. < ActiveRecord::Migration .. def change .. end + class ${1:class_name} < ActiveRecord::Migration + def change + ${2} end end - snippet trc t.remove :${1:column} snippet tre @@ -913,7 +918,6 @@ snippet tre ${3} snippet tref t.references :${1:model} - #rspec snippet it it "${1:spec_name}" do From 5edc9786e497fafc9f9ff4151db4d1e59aacb269 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 29 Apr 2013 20:15:42 +0200 Subject: [PATCH 0053/1587] document how version differences could be coped with --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 6846edb23..0cd0f90d6 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,33 @@ Historical notes unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a [fork][4] of the project in hopes of improving the existing code base. +Versions / dialects / .. +======================== +There are some issues, such as newer language versions may require other +snippets than older. If this exists we currently recommend doing this: + +add snippets/ruby.snippets (common snippets) +add snippets/ruby-1.8.snippets (1.8 only) +add snippets/ruby-1.9.snippets (1.9 only) + +then configure github.com/garbas/vim-snipmate this way: + + let g:snipMate = {} + let g:snipMate.scope_aliases = {} + let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9' + +or github.com/MarcWeber/UltiSnips this way: + + + let g:UltiSnips = {} + + let g:UltiSnips.snipmate_ft_filter = { + \ 'default' : {'filetypes': ["FILETYPE"] }, + \ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] }, + + +If it happens that you work on a project requiring ruby-1.8 snippets instead, +consider using vim-addon-local-vimrc and override the filetypes. Language maintainers -------------------- @@ -76,6 +103,11 @@ Language maintainers No one can really be proficient in all programming languages. If you would like to maintain snippets for a language, please get in touch. +Notes: People are interested in snippets - and their interest may stop again +at will. So its ok if people maintain a language only for a short period of +time - or jump in and get things done - don't let the flow stop :) +vim-snippets is not like the "linux kernel". + * Python - [honza](http://github.com/honza) * Javascript - [honza](http://github.com/honza) * HTML Django - [honza](http://github.com/honza) From c4d45b83f1f877f85e153425eefded4bd0af450e Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 29 Apr 2013 22:40:16 +0200 Subject: [PATCH 0054/1587] what about libraries? postfixes may do it --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 0cd0f90d6..720c58b3b 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,14 @@ or github.com/MarcWeber/UltiSnips this way: If it happens that you work on a project requiring ruby-1.8 snippets instead, consider using vim-addon-local-vimrc and override the filetypes. +Well - of course it may not make sense to create a new file for each +ruby-library-version triplet. Sometimes postfixing a name such as + + migrate_lib_20_down + migrate_lib_20_up + +will do it then if syntax has changed. + Language maintainers -------------------- From c89448fcada3a9bdca2ac3f22c7ac9491cce14b4 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Thu, 2 May 2013 10:09:31 -0300 Subject: [PATCH 0055/1587] Add ruby snippet btp for polymorphic belongs_to --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index fdf479a2b..2bcc9de8e 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -589,6 +589,8 @@ snippet bf before_filter :${1:method} snippet bt belongs_to :${1:association} +snippet btp + belongs_to :${1:association}, :polymorphic => true${2} snippet crw cattr_accessor :${1:attr_names} snippet defcreate From d01c475b297d9dfd693bc0321ad47dcdf1608418 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Fri, 3 May 2013 10:26:29 -0300 Subject: [PATCH 0056/1587] Add let! and remove brackets from let. The user must choose which block syntax to be used. --- snippets/ruby.snippets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 2bcc9de8e..aa7627277 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -950,7 +950,9 @@ snippet aft ${2} end snippet let - let(:${1:method}) { ${2} } + let(:${1:object}) ${2:block} +snippet let! + let!(:${1:object}) ${2:block} snippet subj subject { ${1} } snippet spec From 53e003901e7088bfaea78cf75f4b978ea48a674b Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 5 May 2013 22:13:24 +0200 Subject: [PATCH 0057/1587] advertise git based wiki - either it will be a success - or it will fail - anyway I want to know soon --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 720c58b3b..41f199733 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,12 @@ so that all users can benefit from them. People can list their snippet reposito Installation using VAM: "github:rbonvall/snipmate-snippets-bib" + +## If you believe in the success of vim-snipmate +then you may also want to have a look at [vim-git-wiki](github.com/MarcWeber/vim-git-wiki) +If you contribute to this git based wiki editable by Vim we have a chance +making it official ot www.vim.org. + Historical notes ================ From 6d8d34442d2482647f21762dd3e4d50fd2a406f9 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 5 May 2013 22:08:07 -0300 Subject: [PATCH 0058/1587] Update README.md Fix link to vim-git-wiki and minor typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41f199733..1c9497851 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ Installation using VAM: "github:rbonvall/snipmate-snippets-bib" ## If you believe in the success of vim-snipmate -then you may also want to have a look at [vim-git-wiki](github.com/MarcWeber/vim-git-wiki) +then you may also want to have a look at [vim-git-wiki](http://github.com/MarcWeber/vim-git-wiki). If you contribute to this git based wiki editable by Vim we have a chance -making it official ot www.vim.org. +of making it official at www.vim.org. Historical notes ================ From 38cb74198d194dbdda85c6579050db6afb079dd8 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Mon, 13 May 2013 10:32:32 -0300 Subject: [PATCH 0059/1587] Add ruby snippet for accepts_nested_attributes_for --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index aa7627277..95b6fa96e 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -967,3 +967,5 @@ snippet shared shared_examples "${1:shared examples name}" ${2} snippet itb it_behaves_like "${1:shared examples name}"${2} +snippet ana + accepts_nested_attributes_for :${1:association} From 5dd73100c7d5e82af66908e61feac5f2c05612f0 Mon Sep 17 00:00:00 2001 From: mwcz Date: Thu, 18 Apr 2013 23:30:40 -0400 Subject: [PATCH 0060/1587] add datetime snippet --- snippets/_.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/_.snippets b/snippets/_.snippets index cb51536c3..c11539faf 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -9,6 +9,8 @@ snippet ddate `strftime("%B %d, %Y")` snippet time `strftime("%H:%M")` +snippet datetime + `strftime("%Y-%m-%d %H:%M")` snippet lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. snippet GPL2 From 645a99fe240bb17a872bc6ede9a6cdcef2246f41 Mon Sep 17 00:00:00 2001 From: mwcz Date: Mon, 13 May 2013 11:19:05 -0400 Subject: [PATCH 0061/1587] add snippets for property descriptors --- snippets/javascript.snippets | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 2901587f0..801968fcd 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -161,3 +161,40 @@ snippet obj F.prototype = o; return new F(); } +# Define multiple properties +snippet props + var ${1:my_object} = Object.defineProperties( + ${2:new Object()}, + { + ${3:property} : { + get : function $1_$3_getter() { + // getter code + }, + set : function $1_$3_setter(value) { + // setter code + }, + value : ${4:value}, + writeable : ${5:boolean}, + enumerable : ${6:boolean}, + configurable : ${7:boolean} + } + } + ); +# Define single property +snippet prop + Object.defineProperty( + ${1:object}, + "${2:property}", + { + get : function $1_$2_getter() { + // getter code + }, + set : function $1_$2_setter(value) { + // setter code + }, + value : ${3:value}, + writeable : ${4:boolean}, + enumerable : ${5:boolean}, + configurable : ${6:boolean} + } + ); From 36d57ca156ea6146f4a66bf65134a8349d9c5e3c Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 17 May 2013 11:19:50 +0800 Subject: [PATCH 0062/1587] add logging in python snippets --- snippets/python.snippets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index 9cb21135b..5f719dfb0 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -162,3 +162,18 @@ snippet getopt ${4} elif option in ("-v", "--verbose"): verbose = argument +# logging +# glog = get log +snippet glog + import logging + logger = logging.getLogger(${2:__name__}) +snippet le + logger.error(${1:msg}) +snippet ld + logger.debug(${1:msg}) +snippet lw + logger.warning(${1:msg}) +snippet lc + logger.critical(${1:msg}) +snippet li + logger.info(${1:msg}) From aabd2d94ca3995cde8217c6b8896066d1488ac6a Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 17 May 2013 11:28:28 +0800 Subject: [PATCH 0063/1587] fix glog $2 not right --- snippets/python.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index 5f719dfb0..ed1155f3f 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -166,7 +166,7 @@ snippet getopt # glog = get log snippet glog import logging - logger = logging.getLogger(${2:__name__}) + logger = logging.getLogger(${1:__name__}) snippet le logger.error(${1:msg}) snippet ld From 1d04040a19ec3a11b4ea9fc664a3fde9ab33893f Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 19 May 2013 18:00:59 -0300 Subject: [PATCH 0064/1587] Add has_one ... dependent: ... ruby snippet --- snippets/ruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 95b6fa96e..13522e3b6 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -680,6 +680,8 @@ snippet hmt has_many :${1:object}, :through => :${2:object} snippet ho has_one :${1:object} +snippet hod + has_one :${1:object}, dependent: :${2:destroy} snippet i18 I18n.t('${1:type.key}')${2} snippet ist From 1c060f7b1284d9d32ffd4f30f5e4c4329d8cd9d0 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 24 May 2013 17:00:04 +0800 Subject: [PATCH 0065/1587] fix lambda conflict with logger.debug --- snippets/python.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index ed1155f3f..b8593602f 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -79,7 +79,7 @@ snippet clatin1 snippet cascii # -*- coding: ascii -*- # Lambda -snippet ld +snippet lda ${1:var} = lambda ${2:vars} : ${3:action} snippet . self. From 3a93e890ebd660fa65fc53373b73cff6ad67f3f9 Mon Sep 17 00:00:00 2001 From: Enric Lluelles Date: Sun, 26 May 2013 23:33:29 +0200 Subject: [PATCH 0066/1587] Adding span# and span. snippets --- snippets/html.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/html.snippets b/snippets/html.snippets index cfc44ad1d..9693fe003 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -730,6 +730,10 @@ snippet source snippet span ${1} +snippet span# + ${2} +snippet span. + ${2} snippet strong ${1} snippet style From 72eeef77dec4d243ecf955fa55f88355a402c3bd Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Mon, 27 May 2013 10:51:49 +0800 Subject: [PATCH 0067/1587] fix lambda conflict #208 with alter logger.debug into lg --- snippets/python.snippets | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index b8593602f..518d2d664 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -79,7 +79,7 @@ snippet clatin1 snippet cascii # -*- coding: ascii -*- # Lambda -snippet lda +snippet ld ${1:var} = lambda ${2:vars} : ${3:action} snippet . self. @@ -169,7 +169,8 @@ snippet glog logger = logging.getLogger(${1:__name__}) snippet le logger.error(${1:msg}) -snippet ld +# conflict with lambda=ld, therefor we change into Logger.debuG +snippet lg logger.debug(${1:msg}) snippet lw logger.warning(${1:msg}) From b2dbd2ac4bf9dacad3583b40765e3e88f9b75ecf Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 31 May 2013 09:45:28 +0800 Subject: [PATCH 0068/1587] add CJK support --- snippets/rst.snippets | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index 97845de3f..46405f7f1 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -19,4 +19,10 @@ snippet - ${3} snippet cont: .. contents:: - + +# CJK optimize, CJK has no space between charaters +snippet *c + \ *${1:Emphasis}*\ +snippet **c + \ **${1:Strong emphasis}**\ + From b6074fab15ac8cdaa44cef8eaf313e86dff1346c Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 31 May 2013 11:06:43 +0800 Subject: [PATCH 0069/1587] add some directives --- snippets/rst.snippets | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index 46405f7f1..b99f6d4f5 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -3,9 +3,9 @@ snippet : :${1:field name}: ${2:field body} snippet * - *${1:Emphasis}* + *${1:Emphasis}* ${2} snippet ** - **${1:Strong emphasis}** + **${1:Strong emphasis}** ${2} snippet _ \`${1:hyperlink-name}\`_ .. _\`$1\`: ${2:link-block} @@ -17,12 +17,45 @@ snippet - ${1:Title} -----${2:-} ${3} +#some directive +snippet img: + .. |${2:alias}| image:: ${1:img} snippet cont: .. contents:: - + ${1:content} +snippet code: + .. code:: ${1:type} + ${2:write some code} +snippet tip: + .. tip:: + ${1:my tips} +snippet not: + .. note:: + ${1:my notes} +snippet war: + .. warning:: + ${1:attention!} +snippet imp: + .. important:: + ${1:this is importatnt} +snippet att: + .. attention:: + ${1:hey!} +snippet dan: + .. danger:: + ${1:ah!} +snippet err: + .. error:: + ${1:Error occur} +snippet cau: + .. caution:: + ${1:Watch out!} +snippet sid: + .. sidebar:: ${1:Title} + # CJK optimize, CJK has no space between charaters snippet *c - \ *${1:Emphasis}*\ + \ *${1:Emphasis}*\ ${2} snippet **c - \ **${1:Strong emphasis}**\ + \ **${1:Strong emphasis}**\ ${2} From 12e4eab2a7f76a0ec48cc18b52c958f2ef5de222 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 31 May 2013 11:12:17 +0800 Subject: [PATCH 0070/1587] fix code section failed --- snippets/rst.snippets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index b99f6d4f5..ca0c15589 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -25,6 +25,7 @@ snippet cont: ${1:content} snippet code: .. code:: ${1:type} + ${2:write some code} snippet tip: .. tip:: @@ -50,9 +51,11 @@ snippet err: snippet cau: .. caution:: ${1:Watch out!} +#Spinx only snippet sid: .. sidebar:: ${1:Title} - + + ${2} # CJK optimize, CJK has no space between charaters snippet *c \ *${1:Emphasis}*\ ${2} From 20d65b0617b4580f19f15c6e22b82b55888454d0 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 31 May 2013 11:18:29 +0800 Subject: [PATCH 0071/1587] add figure --- snippets/rst.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index ca0c15589..d97fa5738 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -20,6 +20,11 @@ snippet - #some directive snippet img: .. |${2:alias}| image:: ${1:img} +snippet fig: + .. figure:: ${1:img} + :alt: ${2:alter text} + + $2 snippet cont: .. contents:: ${1:content} From 234ddb7e702f3e4fdb127ed8fb8a916503da3fce Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Fri, 31 May 2013 23:42:10 +0400 Subject: [PATCH 0072/1587] refactor ruby on rails validations with new style --- snippets/ruby.snippets | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 13522e3b6..ac97f33c1 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -849,24 +849,24 @@ snippet tctss ${1} snippet va validates_associated :${1:attribute} -snippet vao - validates_acceptance_of :${1:terms} +snippet va + validates :${1:terms}, :acceptance => true snippet vc - validates_confirmation_of :${1:attribute} + validates :${1:attribute}, :confirmation => true snippet ve - validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )} + validates :${1:attribute}, :exclusion => { :in => ${2:%w( mov avi )} } snippet vf - validates_format_of :${1:attribute}, :with => /${2:regex}/ + validates :${1:attribute}, :format => { :with => /${2:regex}/ } snippet vi - validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi }) + validates :${1:attribute}, :inclusion => { :in => %w(${2: mov avi }) } snippet vl - validates_length_of :${1:attribute}, :within => ${2:3}..${3:20} + validates :${1:attribute}, :length => { :in => ${2:3}..${3:20} } snippet vn - validates_numericality_of :${1:attribute} -snippet vpo - validates_presence_of :${1:attribute} + validates :${1:attribute}, :numericality => true +snippet vp + validates :${1:attribute}, :presence => true snippet vu - validates_uniqueness_of :${1:attribute} + validates :${1:attribute}, :uniqueness => true snippet wants wants.${1:js|xml|html} { ${2} } snippet wc From 2f72d327ecc6e8bc47adc946be6a961cb7c66e44 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel Date: Sat, 1 Jun 2013 04:13:23 -0300 Subject: [PATCH 0073/1587] Add syntax highlighting to README.md --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1c9497851..cb9074bed 100644 --- a/README.md +++ b/README.md @@ -86,19 +86,23 @@ add snippets/ruby-1.9.snippets (1.9 only) then configure github.com/garbas/vim-snipmate this way: - let g:snipMate = {} - let g:snipMate.scope_aliases = {} - let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9' -or github.com/MarcWeber/UltiSnips this way: +```vim +let g:snipMate = {} +let g:snipMate.scope_aliases = {} +let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9' +``` +or github.com/MarcWeber/UltiSnips this way: - let g:UltiSnips = {} - let g:UltiSnips.snipmate_ft_filter = { - \ 'default' : {'filetypes': ["FILETYPE"] }, - \ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] }, +```vim +let g:UltiSnips = {} +let g:UltiSnips.snipmate_ft_filter = { + \ 'default' : {'filetypes': ["FILETYPE"] }, + \ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] }, +``` If it happens that you work on a project requiring ruby-1.8 snippets instead, consider using vim-addon-local-vimrc and override the filetypes. From b1bca66a11f21027d3f041943446ee280775dbad Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sat, 1 Jun 2013 10:39:30 -0300 Subject: [PATCH 0074/1587] Add elixir snippets. --- snippets/elixir.snippets | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 snippets/elixir.snippets diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets new file mode 100644 index 000000000..449071cde --- /dev/null +++ b/snippets/elixir.snippets @@ -0,0 +1,93 @@ +snippet if if .. do .. end + if ${1} do + ${2} + end + +snippet if if .. do: .. + if ${1:condition}, do: ${2} + +snippet ife if .. do .. else .. end + if ${1:condition} do + ${2} + else + ${3} + end + +snippet ife if .. do: .. else: + if ${1:condition}, do: ${2}, else: ${3} + +snippet case + case ${1} do + match: ${2} + ${3} + end + +snippet def + def ${1:name} do + ${2} + end + +snippet defim + defimpl ${1:protocol_name}, for: ${2:data_type} do + ${3} + end + +snippet defma + defmacro ${1:name} do + ${2} + end + +snippet defmo + defmodule ${1:module_name} do + ${2} + end + +snippet defp + defp ${1:name} do + ${2} + end + +snippet defpr + defprotocol ${1:name}, [${2:function}] + +snippet defr + defrecord ${1:record_name}, ${2:functions} + +snippet doc + @doc """ + ${1} + """ + +snippet fn + fn(${1:args}) -> ${2} end + +snippet loop + loop ${1:values}, ${2:initial} do + match: ${3} + ${4} + end + +snippet mdoc + @moduledoc """ + ${1} + """ + +snippet rec + receive do + match: ${1} + ${2} + end + +snippet req + require ${1:module_name}, as: ${2:alias} + +snippet test + test "${1:test_name}" do + ${2} + end + +snippet try + try do + catch: ${1} + ${2} + end From 4b42fc04b625338819f8fbc26ef7f2267aed5f30 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel Date: Sat, 1 Jun 2013 22:43:20 -0300 Subject: [PATCH 0075/1587] Update elixir snippets to stable Elixir lang --- snippets/elixir.snippets | 51 ++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index 449071cde..9c562adda 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -16,9 +16,33 @@ snippet ife if .. do .. else .. end snippet ife if .. do: .. else: if ${1:condition}, do: ${2}, else: ${3} +snippet unless unless .. do .. end + unless ${1} do + ${2} + end + +snippet unless unless .. do: .. + unless ${1:condition}, do: ${2} + +snippet unlesse unless .. do .. else .. end + unless ${1:condition} do + ${2} + else + ${3} + end + +snippet unlesse unless .. do: .. else: + unless ${1:condition}, do: ${2}, else: ${3} + +snippet cond + cond do + ${1} -> + ${2} + end + snippet case case ${1} do - match: ${2} + ${2} -> ${3} end @@ -51,7 +75,7 @@ snippet defpr defprotocol ${1:name}, [${2:function}] snippet defr - defrecord ${1:record_name}, ${2:functions} + defrecord ${1:record_name}, ${2:fields} snippet doc @doc """ @@ -61,12 +85,6 @@ snippet doc snippet fn fn(${1:args}) -> ${2} end -snippet loop - loop ${1:values}, ${2:initial} do - match: ${3} - ${4} - end - snippet mdoc @moduledoc """ ${1} @@ -74,20 +92,27 @@ snippet mdoc snippet rec receive do - match: ${1} + ${1} -> ${2} end snippet req - require ${1:module_name}, as: ${2:alias} + require ${1:module_name} + +snippet imp + import ${1:module_name} + +snippet ali + alias ${1:module_name} snippet test test "${1:test_name}" do ${2} end -snippet try +snippet try try .. rescue .. end try do - catch: ${1} - ${2} + ${1} + rescue + ${2} -> ${3} end From dbf583d697b6552cb8b97ffdbe9ea41fbad76e2c Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Tue, 4 Jun 2013 17:08:29 +0800 Subject: [PATCH 0076/1587] unity all directives, peel off ":" --- snippets/rst.snippets | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index d97fa5738..a6558f055 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -18,46 +18,46 @@ snippet - -----${2:-} ${3} #some directive -snippet img: +snippet img .. |${2:alias}| image:: ${1:img} -snippet fig: +snippet fig .. figure:: ${1:img} :alt: ${2:alter text} $2 -snippet cont: +snippet con .. contents:: ${1:content} -snippet code: +snippet cod .. code:: ${1:type} ${2:write some code} -snippet tip: +snippet tip .. tip:: ${1:my tips} -snippet not: +snippet not .. note:: ${1:my notes} -snippet war: +snippet war .. warning:: ${1:attention!} -snippet imp: +snippet imp .. important:: ${1:this is importatnt} -snippet att: +snippet att .. attention:: ${1:hey!} -snippet dan: +snippet dan .. danger:: ${1:ah!} -snippet err: +snippet err .. error:: ${1:Error occur} -snippet cau: +snippet cau .. caution:: ${1:Watch out!} #Spinx only -snippet sid: +snippet sid .. sidebar:: ${1:Title} ${2} From c5f0409182bdb81d291588a1fe52d9e094a7081f Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Tue, 4 Jun 2013 17:11:17 +0800 Subject: [PATCH 0077/1587] fix `**` conflict with `*`, triggered while typing `**` snippet will expand into `* *{e}*`. I change into `*&` user still don't have to release their Shift key --- snippets/rst.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index a6558f055..657d8b5a5 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -4,7 +4,7 @@ snippet : :${1:field name}: ${2:field body} snippet * *${1:Emphasis}* ${2} -snippet ** +snippet *& **${1:Strong emphasis}** ${2} snippet _ \`${1:hyperlink-name}\`_ @@ -62,8 +62,8 @@ snippet sid ${2} # CJK optimize, CJK has no space between charaters -snippet *c +snippet *! \ *${1:Emphasis}*\ ${2} -snippet **c +snippet *&! \ **${1:Strong emphasis}**\ ${2} From bc17b3d0231316962144fbdc3619a98f15c9e6d6 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Tue, 4 Jun 2013 10:30:10 -0300 Subject: [PATCH 0078/1587] Fix ruby snippets with the same name --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index ac97f33c1..027edf48e 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -847,9 +847,9 @@ snippet tcts snippet tctss t.timestamps ${1} -snippet va +snippet va validates_associated validates_associated :${1:attribute} -snippet va +snippet va validates .., :acceptance => true validates :${1:terms}, :acceptance => true snippet vc validates :${1:attribute}, :confirmation => true From 8f9010d21638dacf0839589f066eed31c5468d66 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 5 Jun 2013 10:45:38 +0800 Subject: [PATCH 0079/1587] reverse original ** for em --- snippets/rst.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index 657d8b5a5..46e2215ee 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -4,7 +4,7 @@ snippet : :${1:field name}: ${2:field body} snippet * *${1:Emphasis}* ${2} -snippet *& +snippet ** **${1:Strong emphasis}** ${2} snippet _ \`${1:hyperlink-name}\`_ @@ -64,6 +64,6 @@ snippet sid # CJK optimize, CJK has no space between charaters snippet *! \ *${1:Emphasis}*\ ${2} -snippet *&! +snippet *& \ **${1:Strong emphasis}**\ ${2} From fb20738cf4082212d5021c031f1d621352308a7c Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Thu, 6 Jun 2013 01:20:03 +0400 Subject: [PATCH 0080/1587] fix haml render snipets --- snippets/haml.snippets | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index 61e9cf287..4491c2bd5 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -11,10 +11,12 @@ snippet 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 +snippet rp + = render :partial => "${1:item}" +snippet rpc + = render :partial => "${1:item}", :collection => ${2:@$1s} +snippet rpl + = render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1} +snippet rpo + = render :partial => "${1:item}", :object => ${2:@$1} From c8783fd02f0688612abc9cbd85edacaea2f3f319 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 6 Jun 2013 13:44:17 +0200 Subject: [PATCH 0081/1587] adding alternative html-minimal snippets illustrating a somewhat minimal setup which is useful to me --- UltiSnips/html_minimal.snippets | 31 ++++++++++++++ snippets/html_minimal.snippets | 74 +++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 UltiSnips/html_minimal.snippets create mode 100644 snippets/html_minimal.snippets diff --git a/UltiSnips/html_minimal.snippets b/UltiSnips/html_minimal.snippets new file mode 100644 index 000000000..1f77ad7b9 --- /dev/null +++ b/UltiSnips/html_minimal.snippets @@ -0,0 +1,31 @@ +# more can be found in snippets/html_minimal.snippets +# these UltiSnips override snippets because nested placeholders are being used + +snippet id +id="${1}"${2} +endsnippet + +snippet idn +id="${1}" name="${2:$1}" +endsnippet + +snippet label_and_input + +${8} +endsnippet + +snippet input +${7} +endsnippet + +snippet textarea + +endsnippet + +snippet img + $3 +endsnippet diff --git a/snippets/html_minimal.snippets b/snippets/html_minimal.snippets new file mode 100644 index 000000000..ce971ef54 --- /dev/null +++ b/snippets/html_minimal.snippets @@ -0,0 +1,74 @@ +# file containing most useful mappings only +# when editing this file please be aware that there is ZenCoding and sparkup + +# html 5 is recommended from now on +snippet html5 + + + + $2 + + $3 + + + $4 + + + +# ==== TAGS +# you always need these: +snippet . + class="${1}"${2} +snippet n + name="${1}"${2} +snippet r + rel="${1}"${2} +snippet t + title="${1}"${2} + +# not using # because id is faster to type +snippet id + id="${1}"${2} +snippet idn + id="${1}" name="${2:$1}" + +snippet label_and_input + + ${7} + + +# FORMS +# use idn . or n to add id +snippet input + ${7} +snippet submit + ${7} +snippet textarea + + +# if you need id or class use snippets above +snippet form +
    + $3 +
    + +# other tags +snippet br +
    +snippet a +
    $3 +snippet img + $2 +# JS/CSS +snippet css_file + ${3} +snippet css_block + + + +snippet script_block + +snippet script_file + From c3a924d77270269ace7c990ce80179c805ace266 Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Fri, 7 Jun 2013 13:13:19 +0400 Subject: [PATCH 0082/1587] added haml if statements --- snippets/haml.snippets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index 4491c2bd5..939158d55 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -19,4 +19,12 @@ snippet rpl = render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1} snippet rpo = render :partial => "${1:item}", :object => ${2:@$1} +snippet ife + - if ${1:condition} + ${2} + - else + ${3} +snippet ifp + - if ${1:condition}.presence? + ${2} From 1871372934ce78f2fa7d047d0647ff7633398032 Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Fri, 7 Jun 2013 14:43:24 -0300 Subject: [PATCH 0083/1587] Add myself as maintainer of the Falcon snippets --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cb9074bed..99bd98036 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ vim-snippets is not like the "linux kernel". * Ruby - [taq](http://github.com/taq) * PHP - [chrisyue](http://github.com/chrisyue) * Scala - [gorodinskiy](https://github.com/gorodinskiy) +* Falcon - [steveno](https://github.com/steveno) Contributing notes ------------------ From e92b1e83f9e5d02713b80efdc1dd047467f531dc Mon Sep 17 00:00:00 2001 From: Donny Yang Date: Sat, 8 Jun 2013 08:14:52 +0900 Subject: [PATCH 0084/1587] binding function should be usable in middle of a line --- UltiSnips/coffee.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index 8f347f1fa..371859f81 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -5,7 +5,7 @@ ${1:name} = (${2:args}) -> ${0:# body...} endsnippet -snippet bfun "Function (bound)" b +snippet bfun "Function (bound)" ${1:(${2:args}) }=> ${0:# body...} endsnippet From f216cebf5479e91db3a007d30d12e1f7430f2783 Mon Sep 17 00:00:00 2001 From: Donny Yang Date: Sat, 8 Jun 2013 08:25:02 +0900 Subject: [PATCH 0085/1587] Interpolated Code should be usable as in-word snippet --- UltiSnips/coffee.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index 371859f81..a61dc5ca1 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -80,7 +80,7 @@ snippet req "Require" b ${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'}) endsnippet -snippet # "Interpolated Code" +snippet # "Interpolated Code" i #{$1}$0 endsnippet From f16295f3c135b151192d0020c36b6ba2cc07a559 Mon Sep 17 00:00:00 2001 From: Donny Yang Date: Sat, 8 Jun 2013 08:29:31 +0900 Subject: [PATCH 0086/1587] It is better to have an else clause in a switch --- UltiSnips/coffee.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index a61dc5ca1..db7e985b5 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -58,6 +58,8 @@ endsnippet snippet swi "Switch" b switch ${1:object} when ${2:value} + ${3:# body...} + else ${0:# body...} endsnippet From 81f85934428472c8965bb5c6ca8810f52475c4f9 Mon Sep 17 00:00:00 2001 From: Donny Yang Date: Sat, 8 Jun 2013 23:45:35 +0900 Subject: [PATCH 0087/1587] inline snippets, arg-less function, new swit snippet --- UltiSnips/coffee.snippets | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index db7e985b5..3e923dcf3 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -1,7 +1,8 @@ # From the TextMate bundle +# with some modification snippet fun "Function" b -${1:name} = (${2:args}) -> +${1:name} = ${2:(${3:args}) }-> ${0:# body...} endsnippet @@ -10,12 +11,12 @@ ${1:(${2:args}) }=> ${0:# body...} endsnippet -snippet if "If" b +snippet if "If" if ${1:condition} ${0:# body...} endsnippet -snippet ife "If .. Else" b +snippet ife "If .. Else" if ${1:condition} ${2:# body...} else @@ -27,40 +28,46 @@ else if ${1:condition} ${0:# body...} endsnippet -snippet ifte "Ternary if" b +snippet ifte "Ternary if" if ${1:condition} then ${2:value} else ${3:other} endsnippet -snippet unl "Unless" b +snippet unl "Unless" ${1:action} unless ${2:condition} endsnippet -snippet fora "Array Comprehension" b +snippet fora "Array Comprehension" for ${1:name} in ${2:array} ${0:# body...} endsnippet -snippet foro "Object Comprehension" b +snippet foro "Object Comprehension" for ${1:key}, ${2:value} of ${3:Object} ${0:# body...} endsnippet -snippet forr "Range Comprehension (inclusive)" b +snippet forr "Range Comprehension (inclusive)" for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}} ${0:# body...} endsnippet -snippet forrex "Range Comprehension (exclusive)" b +snippet forrex "Range Comprehension (exclusive)" for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}} ${0:# body...} endsnippet -snippet swi "Switch" b +snippet swi "Switch" switch ${1:object} when ${2:value} ${3:# body...} else - ${0:# body...} + $0 +endsnippet + +snippet swit "Switch when .. then" +switch ${1:object} + when ${2:${3:condition} then ${4:value}} + else ${0:value} endsnippet snippet cla "Class" b @@ -71,7 +78,7 @@ class ${1:ClassName}${2: extends ${3:Ancestor}} $7 endsnippet -snippet try "Try .. Catch" b +snippet try "Try .. Catch" try $1 catch ${2:error} From beedbaa29b5c9a5ab6df20c5b182f118c9b29aa7 Mon Sep 17 00:00:00 2001 From: Donny Yang Date: Mon, 10 Jun 2013 00:46:27 +0900 Subject: [PATCH 0088/1587] apply some python magic to reduce the tabstops needed --- UltiSnips/coffee.snippets | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index 3e923dcf3..dab4608ae 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -2,13 +2,12 @@ # with some modification snippet fun "Function" b -${1:name} = ${2:(${3:args}) }-> +${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`-> ${0:# body...} endsnippet -snippet bfun "Function (bound)" -${1:(${2:args}) }=> - ${0:# body...} +snippet bfun "Function (bound)" i +`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] else ""`${2:expr} endsnippet snippet if "If" @@ -47,12 +46,12 @@ for ${1:key}, ${2:value} of ${3:Object} endsnippet snippet forr "Range Comprehension (inclusive)" -for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}} +for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} ${0:# body...} endsnippet snippet forrex "Range Comprehension (exclusive)" -for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}} +for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} ${0:# body...} endsnippet @@ -66,16 +65,16 @@ endsnippet snippet swit "Switch when .. then" switch ${1:object} - when ${2:${3:condition} then ${4:value}} - else ${0:value} + when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} + else`!p snip.rv = " " if t[4] else ""`${4:value} endsnippet snippet cla "Class" b -class ${1:ClassName}${2: extends ${3:Ancestor}} +class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor} - ${4:constructor: (${5:args}) -> - ${6:# body...}} - $7 + ${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` -> + ${5:# body...}} + $0 endsnippet snippet try "Try .. Catch" From ee2a486dacfa5210ce4554e3c27ff034b9fb21fe Mon Sep 17 00:00:00 2001 From: Donny Yang Date: Mon, 10 Jun 2013 02:08:39 +0900 Subject: [PATCH 0089/1587] add newline checks to avoid leaving trailing whitespace --- UltiSnips/coffee.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index dab4608ae..bb451aac3 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -7,7 +7,7 @@ ${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2 endsnippet snippet bfun "Function (bound)" i -`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] else ""`${2:expr} +`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr} endsnippet snippet if "If" @@ -66,7 +66,7 @@ endsnippet snippet swit "Switch when .. then" switch ${1:object} when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} - else`!p snip.rv = " " if t[4] else ""`${4:value} + else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value} endsnippet snippet cla "Class" b From 057a066f9c549e445fcbd519e7785db0bf16a380 Mon Sep 17 00:00:00 2001 From: George Lee Date: Mon, 10 Jun 2013 21:37:09 +0800 Subject: [PATCH 0090/1587] add if/ife snippets to eruby --- snippets/eruby.snippets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index 592e490bd..721116c66 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -111,3 +111,13 @@ snippet slt <%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %> snippet sslt <%= stylesheet_link_tag "${1}" %> +snippet if + <% if ${1} %> + ${2} + <% end %> +snippet ife + <% if ${1} %> + ${2} + <% else %> + ${3} + <% end %> From 8ede47133fe8bb225a8f29c948e408ec713f4b98 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 18 Jun 2013 13:59:14 +0200 Subject: [PATCH 0091/1587] Tons of improvements to TeX snippets (rebased by Marc Weber), pull/182 --- snippets/tex.snippets | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 10fa82eff..1b3a8e458 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -1,16 +1,16 @@ #PREAMBLE #newcommand snippet nc - \newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}}${4} + \newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}} ${4} #usepackage snippet up - \usepackage[${1:[options}]{${2:package}} + \usepackage[${1:options}]{${2:package}} ${3} #newunicodechar snippet nuc - \newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} + \newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${4} #DeclareMathOperator snippet dmo - \DeclareMathOperator{${1}}{${2}} + \DeclareMathOperator{${1}}{${2}} ${3} #DOCUMENT # \begin{}...\end{} @@ -66,6 +66,8 @@ snippet itemize \begin{itemize} \item ${1} \end{itemize} +snippet item + \item ${1} # Description snippet desc \begin{description} @@ -123,6 +125,9 @@ snippet subp \subparagraph{${1:subparagraph name}} \label{subp:${2:$1}} ${3} +snippet ni + \noindent + ${1} #References snippet itd \item[${1:description}] ${2:item} @@ -133,14 +138,21 @@ snippet table snippet listing ${1:Listing}~\ref{${2:list}}${3} snippet section - ${1:Section}~\ref{${2:sec:}}${3} + ${1:Section}~\ref{sec:${2}} ${3} snippet page - ${1:page}~\pageref{${2}}${3} + ${1:page}~\pageref{${2}} ${3} snippet index - \index{${1:index}}${2} + \index{${1:index}} ${2} #Citations +snippet citen + \cite{$1} ${2} +# bibtex commands +snippet citep + \citep{$1} ${2} +snippet citet + \citet{$1} ${2} snippet cite - \cite[${1}]{${2}}${3} + \cite[${1}]{${2}} ${3} snippet fcite \footcite[${1}]{${2}}${3} #Formating text: italic, bold, underline, small capital, emphase .. @@ -172,6 +184,7 @@ snippet fig \caption{${3}} \label{fig:${4}} \end{figure} + ${5} snippet tikz \begin{figure} \begin{center} @@ -182,10 +195,14 @@ snippet tikz \caption{${3}} \label{fig:${4}} \end{figure} + ${5} #math snippet stackrel \stackrel{${1:above}}{${2:below}} ${3} snippet frac - \frac{${1:num}}{${2:denom}} + \frac{${1:num}}{${2:denom}} ${3} snippet sum - \sum^{${1:n}}_{${2:i=1}}{${3}} \ No newline at end of file + \sum^{${1:n}}_{${2:i=1}} ${3} +snippet lim + \lim_{${1:x \to +\infty}} ${2} + From 2ed243e2f798877ad651c5b6c9d9ac49cb6d0ca3 Mon Sep 17 00:00:00 2001 From: George Lee Date: Wed, 19 Jun 2013 11:27:01 +0800 Subject: [PATCH 0092/1587] add in migration index / simple_form input --- snippets/eruby.snippets | 2 ++ snippets/ruby.snippets | 2 ++ 2 files changed, 4 insertions(+) diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index 721116c66..d99cf0b6e 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -53,6 +53,8 @@ snippet ff <%= form_for @${1:model} do |f| %> ${2} <% end %> +snippet ffi + <%= ${1:f}.input :${2:attribute} %> snippet ffcb <%= ${1:f}.check_box :${2:attribute} %> snippet ffe diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 027edf48e..417a4f440 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -888,6 +888,8 @@ snippet test #migrations snippet mac add_column :${1:table_name}, :${2:column_name}, :${3:data_type} +snippet mai + add_index :${1:table_name}, :${2:column_name} snippet mrc remove_column :${1:table_name}, :${2:column_name} snippet mrnc From af19fb1d85bd15f028d9143019b44c36f99fd699 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 19 Jun 2013 15:35:26 +0800 Subject: [PATCH 0093/1587] update UltiSnips/rst.snippets --- UltiSnips/rst.snippets | 99 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index 717451015..58e5a5584 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -58,4 +58,103 @@ snippet cb "Code Block" b $0 endsnippet +snippet img "Image Block" b +.. |${2:alias}| image:: ${1:img} +endsnippet + +snippet fig "Figure Block" b +.. figure:: ${1:img} + :alt: ${2:alter text} + + ${3} + +$0 +endsnippet + +snippet cont "Content Block" b +.. contents:: + + ${1:content} + +$0 +endsnippet + +snippet tip "Tip Block" b +.. tip:: + + ${1:some tips} + +$0 +endsnippet + +snippet not "Note Block" b +.. note:: + + ${1:some notes} + +$0 +endsnippet + +snippet war "Warning Block" b +.. warning:: + + ${1:Warning!} + +$0 +endsnippet + +snippet imp "Important Block" b +.. important:: + + ${1:This is important} + +$0 +endsnippet + +snippet att "Attention " b +.. attention:: + + ${1:Attention!} + +$0 +endsnippet + +snippet dan "Danger" b +.. danger:: + + ${1:Danger} + +$0 +endsnippet + +snippet err "Error Block" b +.. error:: + + ${1:Errors!} + +$0 +endsnippet + +snippet cau "Cautions Block" b +.. caution:: + + ${1:Cautions!} + +$0 +endsnippet + +snippet top "Topic" b +.. topic:: ${1:title} + + ${2:contents} + +$0 +endsnippet + +# Spinx Only +snippet sid "SideBar" b +.. sidebar:: ${1:SideBar Title} + + ${2:SideBar Content} +endsnippet # vim:ft=snippets: From f2e535fd94c3f0ddf9e6ccac5356405a6dd2372e Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 19 Jun 2013 17:37:01 +0800 Subject: [PATCH 0094/1587] add emphasize --- UltiSnips/rst.snippets | 50 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index 58e5a5584..e3808b81e 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -47,6 +47,47 @@ ${1:Paragraph name} $0 endsnippet +snippet em "Emphasize string" i +*${1:Em}* $0 +endsnippet + +snippet ec "Emphasize string (CJK)" w +\ *${1:Em}*\ $0 +endsnippet + +snippet st "Strong string" i +**${1:Strong}** $0 +endsnippet + +snippet sc "Strong string (CJK)" w +\ **${1:Strong}**\ $0 +endsnippet + +global !p +def make_items(times, leading='+'): + times = int(times) + if leading == 1: + msg = "" + for x in xrange(1, times+1): + msg += "%s. Item\n" % x + return msg + else: + return ("%s Item\n" % leading) * times +endglobal + +snippet "li(st)? (?P\d+)" "List" br +$0 +`!p +snip.rv = make_items(match.groupdict()['num']) +` +endsnippet + +snippet "ol(st)? (?P\d+)" "Order List" br +$0 +`!p +snip.rv = make_items(match.groupdict()['num'], 1) +` +endsnippet ########################################################################### # More Specialized Stuff. # ########################################################################### @@ -72,9 +113,7 @@ $0 endsnippet snippet cont "Content Block" b -.. contents:: - - ${1:content} +.. contents:: ${1:Contents Title} $0 endsnippet @@ -151,7 +190,10 @@ snippet top "Topic" b $0 endsnippet -# Spinx Only +############ +# Sphinx # +############ + snippet sid "SideBar" b .. sidebar:: ${1:SideBar Title} From d41ca9e656dfed11aff4c51ac6de66033830e1b8 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 19 Jun 2013 18:08:51 +0800 Subject: [PATCH 0095/1587] add rst auto complie most common code type --- UltiSnips/rst.snippets | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index e3808b81e..ec11b7fea 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -91,8 +91,21 @@ endsnippet ########################################################################### # More Specialized Stuff. # ########################################################################### +global !p +import re +from collections import Counter +def find_all_code_type(path): + with open(path) as source: + types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) + try: + popular_type = Counter(types).most_common()[0][0] + except KeyError: + popular_type = "lua" # Don't break default + + return popular_type +endglobal snippet cb "Code Block" b -.. code-block:: ${1:lua} +.. code-block:: ${1:`!p snip.rv = find_all_code_type(path)`} ${2:code} From 1c80d84e9cc4d0d26edacbe354ad204192ca6332 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 19 Jun 2013 18:12:12 +0800 Subject: [PATCH 0096/1587] fix Out of Code detetction indexerror --- UltiSnips/rst.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index ec11b7fea..ea70d8190 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -99,7 +99,7 @@ def find_all_code_type(path): types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) try: popular_type = Counter(types).most_common()[0][0] - except KeyError: + except IndexError: popular_type = "lua" # Don't break default return popular_type From 382ad016d30fca3819bc30ba0efc4218ba925d39 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 10:15:00 +0800 Subject: [PATCH 0097/1587] set a proper name to function --- UltiSnips/rst.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index ea70d8190..1eba27493 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -94,7 +94,7 @@ endsnippet global !p import re from collections import Counter -def find_all_code_type(path): +def get_popular_code_type(path): with open(path) as source: types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) try: @@ -105,7 +105,7 @@ def find_all_code_type(path): return popular_type endglobal snippet cb "Code Block" b -.. code-block:: ${1:`!p snip.rv = find_all_code_type(path)`} +.. code-block:: ${1:`!p snip.rv = get_popular_code_type(path)`} ${2:code} From eaeada33c5e9cef2b9818c03ccb2bf82a1aab2f7 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 10:21:33 +0800 Subject: [PATCH 0098/1587] revert rst snippets --- snippets/rst.snippets | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index 46e2215ee..d97fa5738 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -18,52 +18,52 @@ snippet - -----${2:-} ${3} #some directive -snippet img +snippet img: .. |${2:alias}| image:: ${1:img} -snippet fig +snippet fig: .. figure:: ${1:img} :alt: ${2:alter text} $2 -snippet con +snippet cont: .. contents:: ${1:content} -snippet cod +snippet code: .. code:: ${1:type} ${2:write some code} -snippet tip +snippet tip: .. tip:: ${1:my tips} -snippet not +snippet not: .. note:: ${1:my notes} -snippet war +snippet war: .. warning:: ${1:attention!} -snippet imp +snippet imp: .. important:: ${1:this is importatnt} -snippet att +snippet att: .. attention:: ${1:hey!} -snippet dan +snippet dan: .. danger:: ${1:ah!} -snippet err +snippet err: .. error:: ${1:Error occur} -snippet cau +snippet cau: .. caution:: ${1:Watch out!} #Spinx only -snippet sid +snippet sid: .. sidebar:: ${1:Title} ${2} # CJK optimize, CJK has no space between charaters -snippet *! +snippet *c \ *${1:Emphasis}*\ ${2} -snippet *& +snippet **c \ **${1:Strong emphasis}**\ ${2} From d666cfc6a5042c1fb1832941a734bdde7adbfd92 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 10:27:05 +0800 Subject: [PATCH 0099/1587] add usage for enumberic items --- UltiSnips/rst.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index 1eba27493..c8b62e59f 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -75,6 +75,7 @@ def make_items(times, leading='+'): return ("%s Item\n" % leading) * times endglobal +# usage: li 3 snippet "li(st)? (?P\d+)" "List" br $0 `!p @@ -82,6 +83,7 @@ snip.rv = make_items(match.groupdict()['num']) ` endsnippet +# usage: ol 3 snippet "ol(st)? (?P\d+)" "Order List" br $0 `!p From 6ac725a309217a3a0417783043f40ab1a371bc49 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 11:29:44 +0800 Subject: [PATCH 0100/1587] fix CJK lens --- UltiSnips/rst.snippets | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index c8b62e59f..0fed43fe2 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -3,46 +3,52 @@ ########################################################################### # General Stuff # ########################################################################### +global !p +import re +def rst_char_len(char): + return len(re.findall(r'[^\u4e00-\u9fff\s]', char))+len(char) + +endglobal snippet part "Part" b -`!p snip.rv = len(t[1])*'#'` +`!p snip.rv = rst_char_len(t[1])*'#'` ${1:Part name} -`!p snip.rv = len(t[1])*'#'` +`!p snip.rv = rst_char_len(t[1])*'#'` $0 endsnippet snippet sec "Section" b ${1:Section name} -`!p snip.rv = len(t[1])*'='` +`!p snip.rv = rst_char_len(t[1])*'='` $0 endsnippet snippet ssec "Subsection" b ${1:Section name} -`!p snip.rv = len(t[1])*'-'` +`!p snip.rv = rst_char_len(t[1])*'-'` $0 endsnippet snippet sssec "Subsubsection" b ${1:Section name} -`!p snip.rv = len(t[1])*'^'` +`!p snip.rv = rst_char_len(t[1])*'^'` $0 endsnippet snippet chap "Chapter" b -`!p snip.rv = len(t[1])*'*'` +`!p snip.rv = rst_char_len(t[1])*'*'` ${1:Chapter name} -`!p snip.rv = len(t[1])*'*'` +`!p snip.rv = rst_char_len(t[1])*'*'` $0 endsnippet snippet para "Paragraph" b ${1:Paragraph name} -`!p snip.rv = len(t[1])*'"'` +`!p snip.rv = rst_char_len(t[1])*'"'` $0 endsnippet @@ -94,7 +100,6 @@ endsnippet # More Specialized Stuff. # ########################################################################### global !p -import re from collections import Counter def get_popular_code_type(path): with open(path) as source: From ab97140f5ddb30d46f22ac20616293a754a102a2 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 11:31:41 +0800 Subject: [PATCH 0101/1587] get python code together --- UltiSnips/rst.snippets | 49 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index 0fed43fe2..126f59b9a 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -5,9 +5,33 @@ ########################################################################### global !p import re +from collections import Counter + + def rst_char_len(char): return len(re.findall(r'[^\u4e00-\u9fff\s]', char))+len(char) + +def make_items(times, leading='+'): + times = int(times) + if leading == 1: + msg = "" + for x in xrange(1, times+1): + msg += "%s. Item\n" % x + return msg + else: + return ("%s Item\n" % leading) * times + + +def get_popular_code_type(path): + with open(path) as source: + types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) + try: + popular_type = Counter(types).most_common()[0][0] + except IndexError: + popular_type = "lua" # Don't break default + + return popular_type endglobal snippet part "Part" b `!p snip.rv = rst_char_len(t[1])*'#'` @@ -69,19 +93,6 @@ snippet sc "Strong string (CJK)" w \ **${1:Strong}**\ $0 endsnippet -global !p -def make_items(times, leading='+'): - times = int(times) - if leading == 1: - msg = "" - for x in xrange(1, times+1): - msg += "%s. Item\n" % x - return msg - else: - return ("%s Item\n" % leading) * times -endglobal - -# usage: li 3 snippet "li(st)? (?P\d+)" "List" br $0 `!p @@ -99,18 +110,6 @@ endsnippet ########################################################################### # More Specialized Stuff. # ########################################################################### -global !p -from collections import Counter -def get_popular_code_type(path): - with open(path) as source: - types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) - try: - popular_type = Counter(types).most_common()[0][0] - except IndexError: - popular_type = "lua" # Don't break default - - return popular_type -endglobal snippet cb "Code Block" b .. code-block:: ${1:`!p snip.rv = get_popular_code_type(path)`} From 317dddc096deb7af7839facf3cbe35bc8acf721c Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 15:40:12 +0800 Subject: [PATCH 0102/1587] add docstring --- UltiSnips/rst.snippets | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index 126f59b9a..0490c319c 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -1,4 +1,4 @@ - +# -*- coding: utf-8 -*- ########################################################################### # General Stuff # @@ -7,12 +7,23 @@ global !p import re from collections import Counter - def rst_char_len(char): - return len(re.findall(r'[^\u4e00-\u9fff\s]', char))+len(char) + """ + return len of string which fit in rst + For instance:chinese "我" decode as only one character, + However, the rst interpreter needs 2 "=" instead of 1. + :param: char needs to be count + """ + return len(re.findall(r'[^\u4e00-\u9fff\s]', char))+len(char) def make_items(times, leading='+'): + """ + make lines with leading char multitimes + + :param: times, how many times you need + :param: leading, leading character + """ times = int(times) if leading == 1: msg = "" @@ -24,6 +35,11 @@ def make_items(times, leading='+'): def get_popular_code_type(path): + """ + As function name, it will get most popular code type in given file + + :param: path, to path to rst file + """ with open(path) as source: types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) try: @@ -33,6 +49,7 @@ def get_popular_code_type(path): return popular_type endglobal + snippet part "Part" b `!p snip.rv = rst_char_len(t[1])*'#'` ${1:Part name} @@ -78,19 +95,22 @@ $0 endsnippet snippet em "Emphasize string" i -*${1:Em}* $0 +*${1:${VISUAL:Em}}* $0 endsnippet +# the CJK characters doesn't had space to sperate them, like "我强调" +# should be "我\ *强调*\ " +# Therefor we need special snippet snippet ec "Emphasize string (CJK)" w -\ *${1:Em}*\ $0 +\ *${1:${VISUAL:Em}}*\ $0 endsnippet snippet st "Strong string" i -**${1:Strong}** $0 +**${1:${VISUAL:Strong}}** $0 endsnippet snippet sc "Strong string (CJK)" w -\ **${1:Strong}**\ $0 +\ **${1:${VISUAL:Strong}}**\ $0 endsnippet snippet "li(st)? (?P\d+)" "List" br From ab4daaf4ce6ba6b20b1088e35be68253fcca51a2 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 20 Jun 2013 16:21:04 +0800 Subject: [PATCH 0103/1587] change blocks into sa --- UltiSnips/rst.snippets | 81 ++++++++---------------------------------- 1 file changed, 14 insertions(+), 67 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index 0490c319c..c70dccc83 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -48,6 +48,14 @@ def get_popular_code_type(path): popular_type = "lua" # Don't break default return popular_type + +def complete(t, opts): + if t: + opts = [ m[len(t):] for m in opts if m.startswith(t) ] + if len(opts) == 1: + return opts[0] + return "({0})".format("|".join(opts)) + endglobal snippet part "Part" b @@ -157,74 +165,13 @@ snippet cont "Content Block" b $0 endsnippet -snippet tip "Tip Block" b -.. tip:: - - ${1:some tips} - -$0 -endsnippet - -snippet not "Note Block" b -.. note:: - - ${1:some notes} - -$0 -endsnippet - -snippet war "Warning Block" b -.. warning:: - - ${1:Warning!} - -$0 -endsnippet - -snippet imp "Important Block" b -.. important:: - - ${1:This is important} - -$0 -endsnippet - -snippet att "Attention " b -.. attention:: - - ${1:Attention!} - -$0 -endsnippet - -snippet dan "Danger" b -.. danger:: - - ${1:Danger} - -$0 -endsnippet - -snippet err "Error Block" b -.. error:: +#http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions +snippet sa "Specific Admonitions" b +.. $1`!p snip.rv =complete(t[1], ["attention", "caution", "danger", + "error", "hint", "important", "note", + "tip", "warning"])`:: - ${1:Errors!} - -$0 -endsnippet - -snippet cau "Cautions Block" b -.. caution:: - - ${1:Cautions!} - -$0 -endsnippet - -snippet top "Topic" b -.. topic:: ${1:title} - - ${2:contents} + ${2:Content} $0 endsnippet From dbfcb24f15dd498f3f37110f0b14aa00ffc0e7fd Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 20 Jun 2013 12:57:09 +0200 Subject: [PATCH 0104/1587] replace vim-git-wiki link by link to snippet engine page --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 99bd98036..984cdb646 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,11 @@ so that all users can benefit from them. People can list their snippet reposito Installation using VAM: "github:rbonvall/snipmate-snippets-bib" -## If you believe in the success of vim-snipmate -then you may also want to have a look at [vim-git-wiki](http://github.com/MarcWeber/vim-git-wiki). -If you contribute to this git based wiki editable by Vim we have a chance -of making it official at www.vim.org. +Future - ideas - examples +========================= +[overview snippet engines](http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html) +If you have ideas you can add them to that list of "snippet engine features by example". + Historical notes ================ From df74813351e319012be0c8a0f5205141d875e266 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Thu, 20 Jun 2013 14:33:44 -0700 Subject: [PATCH 0105/1587] Removed comment blocks from placeholders --- snippets/actionscript.snippets | 12 +++---- snippets/c.snippets | 14 ++++---- snippets/cpp.snippets | 10 +++--- snippets/dart.snippets | 8 ++--- snippets/falcon.snippets | 14 ++++---- snippets/go.snippets | 30 ++++++++--------- snippets/java.snippets | 2 +- snippets/javascript-jquery.snippets | 4 +-- snippets/javascript.snippets | 20 ++++++------ snippets/make.snippets | 2 +- snippets/objc.snippets | 2 +- snippets/perl.snippets | 2 +- snippets/php.snippets | 30 ++++++++--------- snippets/processing.snippets | 6 ++-- snippets/python.snippets | 40 +++++++++++------------ snippets/r.snippets | 10 +++--- snippets/scala.snippets | 50 ++++++++++++++--------------- snippets/vim.snippets | 8 ++--- 18 files changed, 132 insertions(+), 132 deletions(-) diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index af9611c3f..cd2ab0ebd 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -109,17 +109,17 @@ snippet try # For Loop (same as c.snippet) snippet for for (..) {..} for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${4} } # Custom For Loop snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5:/* code */} + ${5} } # If Condition snippet if if (${1:/* condition */}) { - ${2:/* code */} + ${2} } snippet el else { @@ -131,7 +131,7 @@ snippet t snippet fun function ${1:function_name}(${2})${3} { - ${4:/* code */} + ${4} } # FlxSprite (usefull when using the flixel library) snippet FlxSprite @@ -144,13 +144,13 @@ snippet FlxSprite public function $1(${3: X:Number, Y:Number}):void { super(X,Y); - ${4: //code...} + ${4} } override public function update():void { super.update(); - ${5: //code...} + ${5} } } } diff --git a/snippets/c.snippets b/snippets/c.snippets index de6d6a933..85e7ac2b0 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -53,7 +53,7 @@ snippet once # if snippet if if (${1:/* condition */}) { - ${2:/* code */} + ${2} }${3} # else snippet el @@ -63,7 +63,7 @@ snippet el # else if snippet elif else if (${1:/* condition */}) { - ${2:/* code */} + ${2} }${3} # ternary snippet t @@ -94,22 +94,22 @@ snippet case # for snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${4} }${5} # for (custom) snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5:/* code */} + ${5} }${6} # while snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${2} }${3} # do... while snippet do do { - ${2:/* code */} + ${2} } while (${1:/* condition */});${3} ## ## Functions @@ -117,7 +117,7 @@ snippet do snippet fun ${1:void} ${2:function_name}(${3}) { - ${4:/* code */} + ${4} }${5} # function declaration snippet fund diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index c3e19fe93..048671246 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -80,7 +80,7 @@ snippet cl # member function implementation snippet mfun ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5:/* code */} + ${5} } # namespace snippet ns @@ -100,13 +100,13 @@ snippet cin # for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${4} }${5} # foreach snippet fore for (${1:auto} ${2:i} : ${3:container}) { - ${4:/* code */} + ${4} }${5} # iterator snippet iter @@ -123,9 +123,9 @@ snippet itera ## Lambdas # lamda (one line) snippet ld - [${1}](${2}){${3:/* code */}}${4} + [${1}](${2}){${3}}${4} # lambda (multi-line) snippet lld [${1}](${2}){ - ${3:/* code */} + ${3} }${4} diff --git a/snippets/dart.snippets b/snippets/dart.snippets index 6f0b8ac5e..c7b56daf6 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -9,7 +9,7 @@ snippet so ${2} snippet main static void main() { - ${1:/* code */} + ${1} } snippet st static ${1} @@ -57,15 +57,15 @@ snippet for } snippet fore for (final ${2:item} in ${1:itemList}) { - ${3:/* code */} + ${3} } snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${2} } snippet dowh do { - ${2:/* code */} + ${2} } while (${1:/* condition */}); snippet as assert(${1:/* condition */}); diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 85fb918dd..93aba1983 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -8,7 +8,7 @@ snippet imp # Function snippet fun function ${2:function_name}(${3}) - ${4:/* code */} + ${4} end # Class @@ -20,13 +20,13 @@ snippet class # If snippet if if ${1:condition} - ${2:/* code */} + ${2} end # If else snippet ife if ${1:condition} - ${2:/* code */} + ${2} else ${1} end @@ -34,7 +34,7 @@ snippet ife # If else if snippet elif elif ${1:condition} - ${2:/* code */} + ${2} # Switch case snippet switch @@ -55,17 +55,17 @@ snippet select # For/in Loop snippet forin for ${1:element} in ${2:container} - ${3:/* code */} + ${3} end # For/to Loop snippet forto for ${1:lowerbound} to ${2:upperbound} - ${3:/* code */} + ${3} end # While Loop snippet while while ${1:conidition} - ${2:/* code */} + ${2} end diff --git a/snippets/go.snippets b/snippets/go.snippets index c64db91f9..a88d8d069 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -16,7 +16,7 @@ snippet ch # case snippet cs case ${1:value}: - ${2:/* code */} + ${2} # const snippet c const ${1:NAME} = ${2:0} @@ -36,7 +36,7 @@ snippet df snippet dfr defer func() { if err := recover(); err != nil { - ${1:/* code */} + ${1} } }() # gpl @@ -78,7 +78,7 @@ snippet inf # if condition snippet if if ${1:/* condition */} { - ${2:/* code */} + ${2} }${2} # else snippet snippet el @@ -109,7 +109,7 @@ snippet f6 # if else snippet ie if ${1:/* condition */} { - ${2:/* code */} + ${2} } else { ${3} } @@ -117,25 +117,25 @@ snippet ie # for loop snippet fo for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { - ${4:/* code */} + ${4} } ${5} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { - ${4:/* code */} + ${4} } ${5} # function simple snippet fun func ${1:funcName}(${2}) ${3:error} { - ${4:/* code */} + ${4} } ${5} # function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { - ${5:/* code */} + ${5} } ${6} # log printf @@ -153,7 +153,7 @@ snippet mp # main() snippet main func main() { - ${1:/* code */} + ${1} } ${2} # new @@ -178,11 +178,11 @@ snippet rs snippet sl select { case ${1:v1} := <-${2:chan1} - ${3:/* code */} + ${3} case ${4:v2} := <-${5:chan2} - ${6:/* code */} + ${6} default: - ${7:/* code */} + ${7} } # string snippet sr @@ -197,11 +197,11 @@ snippet st snippet sw switch ${1:var} { case ${2:value1}: - ${3:/* code */} + ${3} case ${4:value2}: - ${5:/* code */} + ${5} default: - ${6:/* code */} + ${6} } snippet sp fmt.Sprintf("%${1:s}", ${2:var})${3} diff --git a/snippets/java.snippets b/snippets/java.snippets index 854f14ac2..daf8928b7 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -171,7 +171,7 @@ snippet wh ## Main method snippet main public static void main (String[] args) { - ${1:/* code */} + ${1} } ## ## Print Methods diff --git a/snippets/javascript-jquery.snippets b/snippets/javascript-jquery.snippets index ce247a005..014c6158d 100644 --- a/snippets/javascript-jquery.snippets +++ b/snippets/javascript-jquery.snippets @@ -260,7 +260,7 @@ snippet filter ${1:obj}.filter('${2:selector expression}')${3} snippet filtert ${1:obj}.filter(function (${2:index}) { - ${3:// test code} + ${3} })${4} snippet find ${1:obj}.find('${2:selector expression}')${3} @@ -291,7 +291,7 @@ snippet getscript }); snippet grep $.grep(${1:array}, function (item, index) { - ${2:// test code} + ${2} }${3:, true}); snippet hasc ${1:obj}.hasClass('${2:className}')${3} diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 801968fcd..e9dd58b94 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -17,7 +17,7 @@ snippet f # Immediate function snippet (f (function (${1}) { - ${3:/* code */} + ${3} }(${2})); # if snippet if @@ -38,16 +38,16 @@ snippet ter snippet switch switch (${1:expression}) { case '${3:case}': - ${4:// code} + ${4} break; ${5} default: - ${2:// code} + ${2} } # case snippet case case '${1:case}': - ${2:// code} + ${2} break; ${3} # for (...) {...} @@ -63,19 +63,19 @@ snippet forr # while (...) {...} snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${2} } # try snippet try try { - ${1:/* code */} + ${1} } catch (${2:e}) { ${3:/* handle error */} } # do...while snippet do do { - ${2:/* code */} + ${2} } while (${1:/* condition */}); # Object Method snippet :f @@ -124,10 +124,10 @@ snippet jsons # self-defining function snippet sdf var ${1:function_name} = function (${2:argument}) { - ${3:// initial code ...} + ${3} $1 = function ($2) { - ${4:// main code} + ${4} }; }; # singleton @@ -150,7 +150,7 @@ snippet sing // reset the constructor pointer instance.constructor = $1; - ${3:// code ...} + ${3} return instance; } diff --git a/snippets/make.snippets b/snippets/make.snippets index 436481363..ba8e2b292 100644 --- a/snippets/make.snippets +++ b/snippets/make.snippets @@ -1,4 +1,4 @@ snippet ifeq ifeq (${1:cond0},${2:cond1}) - ${3:code} + ${3} endif diff --git a/snippets/objc.snippets b/snippets/objc.snippets index 85b80d9e6..3cf5a0a6d 100644 --- a/snippets/objc.snippets +++ b/snippets/objc.snippets @@ -207,7 +207,7 @@ snippet arel # autorelease pool snippet pool NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init]; - ${2:/* code */} + ${2} [$1 drain]; # Throw an exception snippet except diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 9cebedeac..ef83e0f5e 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -326,7 +326,7 @@ snippet tsub snippet trsub test ${1:test_name} => { description => '${2:Description of test.}'} => sub { my ($self) = @_; - ${3:# test code} + ${3} }; #prep test method diff --git a/snippets/php.snippets b/snippets/php.snippets index 5ca502de8..97ec3e317 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -231,7 +231,7 @@ snippet class */ ${5:public} function ${6:__construct}(${7:argument}) { - ${8:// code...} + ${8} } } snippet nc @@ -249,26 +249,26 @@ snippet def? ${1}defined('${2}')${3} snippet wh while (${1:/* condition */}) { - ${2:// code...} + ${2} } # do ... while snippet do do { - ${2:// code... } + ${2} } while (${1:/* condition */}); snippet if if (${1:/* condition */}) { - ${2:// code...} + ${2} } snippet ifil - ${2:} + ${2} snippet ife if (${1:/* condition */}) { - ${2:// code...} + ${2} } else { - ${3:// code...} + ${3} } ${4} snippet ifeil @@ -280,33 +280,33 @@ snippet ifeil ${4} snippet else else { - ${1:// code...} + ${1} } snippet elseif elseif (${1:/* condition */}) { - ${2:// code...} + ${2} } snippet switch switch ($${1:variable}) { case '${2:value}': - ${3:// code...} + ${3} break; ${5} default: - ${4:// code...} + ${4} break; } snippet case case '${1:value}': - ${2:// code...} + ${2} break;${3} snippet for for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4: // code...} + ${4} } snippet foreach foreach ($${1:variable} as $${2:value}) { - ${3:// code...} + ${3} } snippet foreachil @@ -314,7 +314,7 @@ snippet foreachil snippet foreachk foreach ($${1:variable} as $${2:key} => $${3:value}) { - ${4:// code...} + ${4} } snippet foreachkil $${3:value}): ?> diff --git a/snippets/processing.snippets b/snippets/processing.snippets index b0aa93ced..27f3e005a 100755 --- a/snippets/processing.snippets +++ b/snippets/processing.snippets @@ -65,7 +65,7 @@ snippet for #loop while snippet while while (${1:/* condition */}) { - ${2:/* code */} + ${2} } #break snippet break @@ -84,11 +84,11 @@ snippet default snippet switch switch(${1:expression}) { case '${3:case}': - ${4:// code} + ${4} break; ${5} default: - ${2:// code} + ${2} } #try snippet try diff --git a/snippets/python.snippets b/snippets/python.snippets index 518d2d664..c29b340ef 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -15,16 +15,16 @@ snippet docs """ snippet wh while ${1:condition}: - ${2:# TODO: write code...} + ${2} # dowh - does the same as do...while in other languages snippet dowh while True: - ${1:# TODO: write code...} + ${1} if ${2:condition}: break snippet with with ${1:expr} as ${2:var}: - ${3:# TODO: write code...} + ${3} # New Class snippet cl class ${1:ClassName}(${2:object}): @@ -37,14 +37,14 @@ snippet cl snippet def def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): """${3:docstring for $1}""" - ${4:# TODO: write code...} + ${4} snippet deff def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${3:# TODO: write code...} + ${3} # New Method snippet defs def ${1:mname}(self, ${2:arg}): - ${3:# TODO: write code...} + ${3} # New Property snippet property def ${1:foo}(): @@ -60,17 +60,17 @@ snippet property # Ifs snippet if if ${1:condition}: - ${2:# TODO: write code...} + ${2} snippet el else: - ${1:# TODO: write code...} + ${1} snippet ei elif ${1:condition}: - ${2:# TODO: write code...} + ${2} # For snippet for for ${1:item} in ${2:items}: - ${3:# TODO: write code...} + ${3} # Encodes snippet cutf8 # -*- coding: utf-8 -*- @@ -85,32 +85,32 @@ snippet . self. snippet try Try/Except try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} snippet try Try/Except/Else try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:# TODO: write code...} + ${5} snippet try Try/Except/Finally try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} finally: - ${5:# TODO: write code...} + ${5} snippet try Try/Except/Else/Finally try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:# TODO: write code...} + ${5} finally: - ${6:# TODO: write code...} + ${6} # if __name__ == '__main__': snippet ifmain if __name__ == '__main__': @@ -136,13 +136,13 @@ snippet " # test function/method snippet test def test_${1:description}(${2:`indent('.') ? 'self' : ''`}): - ${3:# TODO: write code...} + ${3} # test case snippet testcase class ${1:ExampleCase}(unittest.TestCase): def test_${2:description}(self): - ${3:# TODO: write code...} + ${3} snippet fut from __future__ import ${1} #getopt diff --git a/snippets/r.snippets b/snippets/r.snippets index 71186e35b..95079650f 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -12,24 +12,24 @@ snippet source # conditionals snippet if if (${1:condition}) { - ${2:code} + ${2} } snippet el else { - ${1:code} + ${1} } snippet ei else if (${1:condition}) { - ${2:code} + ${2} } # functions snippet fun ${1:name} = function (${2:variables}) { - ${3:code} + ${3} } snippet ret - return(${1:code}) + return(${1}) # dataframes, lists, etc snippet df diff --git a/snippets/scala.snippets b/snippets/scala.snippets index c342228a2..9a71ec2c9 100644 --- a/snippets/scala.snippets +++ b/snippets/scala.snippets @@ -7,61 +7,61 @@ #if snippet if if(${1:obj}) { - ${2:/* code */} + ${2} } #if not snippet ifn if(!${1:obj}) { - ${2:/* code */} + ${2} } #if-else snippet ifel if(${1:obj}) { - ${2:/* code */} + ${2} } else { - ${3:/* code */} + ${3} } #if-else-if snippet ifelif if(${1:obj}) { - ${2:/* code */} + ${2} } else if(${3:obj}) { - ${4:/* code */} + ${4} } #while loop snippet while while (${1:obj}) { - ${2:/* code */} + ${2} } #for loop(classic) snippet for for (${1:item} <- ${2:obj}) { - ${3:/* code */} + ${3} } #for loop(indexed) snippet fori for (${1:i} <- ${2:0} to ${3:obj}.length) { - ${4:/* code */} + ${4} } #exceptions snippet try try { - ${1:/* code */} + ${1} } catch { - case e: FileNotFoundException => ${2:/* code */} - case e: IOException => ${3:/* code */} + case e: FileNotFoundException => ${2} + case e: IOException => ${3} } finally { - ${4:/* code */} + ${4} } #match snippet match ${1: obj} match { - case ${2:e} => ${3:/* code */} - case _ => ${4:/* code */} + case ${2:e} => ${3} + case _ => ${4} } #case snippet case - case ${1:value} => ${2:/* code */} + case ${1:value} => ${2} ############################ # methods and arguments # @@ -82,9 +82,9 @@ snippet ovdef override def ${1:name}(${2:arg}) = ${3:} #first class function(see scalabook p 188) snippet fcf - (${1:a}: ${2:T}) => $1 ${3:/* code */} + (${1:a}: ${2:T}) => $1 ${3} snippet => - ${1:name} => ${2:/* code */} + ${1:name} => ${2} #recursion snippet rec def ${1:name}(${2:arg}) = @@ -196,11 +196,11 @@ snippet as #scope() with one arg snippet (a - (${1:a} => ${2:/* code */}) + (${1:a} => ${2}) #scope() with two args snippet {( {(${1:a},${2:b}) => - ${3:/* code */} + ${3} } #filter snippet filter @@ -220,10 +220,10 @@ snippet fldr #fold left operator(if u wanna reduce readability of ur code) #use wildcard symbols snippet /: - (${1:first}/:${2:name})(${3:/* code */}) + (${1:first}/:${2:name})(${3}) #fold right operator snippet :\ - (${1:first}:\${2:name})(${3:/* code */}) + (${1:first}:\${2:name})(${3}) #reduce left snippet redl ${1:name}.reduceLeft[${2:T}] {( @@ -258,13 +258,13 @@ snippet athis snippet abstract abstract class ${1:name}${2:(arg)}${3: extends }${4: with} { ${5:override def toString = "$1"} - ${6:/* code */} + ${6} } #class snippet class class ${1:name}${2:(arg)}${3: extends }${4: with} { ${5:override def toString = "$1"} - ${6:/* code */} + ${6} } #object snippet object @@ -279,7 +279,7 @@ snippet ordered class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} { ${4:override def toString = "$1"} def compare(that: $1) = ${5:this - that} - ${6:/* code */} + ${6} } #case class snippet casecl diff --git a/snippets/vim.snippets b/snippets/vim.snippets index 329d1e9f2..728c40208 100644 --- a/snippets/vim.snippets +++ b/snippets/vim.snippets @@ -10,7 +10,7 @@ snippet guard let $1 = 1${3} snippet f fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) - ${4:" code} + ${4} endf snippet t try @@ -20,15 +20,15 @@ snippet t endtry snippet for for ${1:needle} in ${2:haystack} - ${3:" code} + ${3} endfor snippet wh while ${1:condition} - ${2:" code} + ${2} endw snippet if if ${1:condition} - ${2:" code} + ${2} endif snippet ife if ${1:condition} From b6ba92b409b37684983bca76f53859c6ca514298 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Thu, 20 Jun 2013 14:39:31 -0700 Subject: [PATCH 0106/1587] Removed unnecessary whitespace from the end of the line --- snippets/_.snippets | 68 +++++++++---------- snippets/actionscript.snippets | 8 +-- snippets/apache.snippets | 2 +- snippets/c.snippets | 4 +- snippets/chef.snippets | 6 +- snippets/clojure.snippets | 2 +- snippets/cmake.snippets | 6 +- snippets/cpp.snippets | 6 +- snippets/cs.snippets | 14 ++-- snippets/django.snippets | 12 ++-- snippets/erlang.snippets | 8 +-- snippets/falcon.snippets | 26 ++++---- snippets/go.snippets | 32 ++++----- snippets/haskell.snippets | 2 +- snippets/htmltornado.snippets | 2 +- snippets/java.snippets | 2 +- snippets/javascript.snippets | 10 +-- snippets/markdown.snippets | 4 +- snippets/progress.snippets | 2 +- snippets/puppet.snippets | 8 +-- snippets/python.snippets | 4 +- snippets/r.snippets | 2 +- snippets/rst.snippets | 8 +-- snippets/sh.snippets | 12 ++-- snippets/tcl.snippets | 2 +- snippets/textile.snippets | 2 +- snippets/xslt.snippets | 8 +-- snippets/yii-chtml.snippets | 118 ++++++++++++++++----------------- snippets/yii.snippets | 82 +++++++++++------------ 29 files changed, 231 insertions(+), 231 deletions(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index c72974801..6204aee5d 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -16,17 +16,17 @@ snippet lorem snippet GPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, see . @@ -34,17 +34,17 @@ snippet GPL2 snippet LGPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . @@ -52,35 +52,35 @@ snippet LGPL2 snippet GPL3 ${1:one line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . - + ${3} snippet LGPL3 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . @@ -89,7 +89,7 @@ snippet BSD2 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -97,7 +97,7 @@ snippet BSD2 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -108,9 +108,9 @@ snippet BSD2 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The views and conclusions contained in the software and documentation + + + The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressedor implied, of $2. @@ -119,7 +119,7 @@ snippet BSD3 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -130,7 +130,7 @@ snippet BSD3 3. Neither the name of the ${3:organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -147,7 +147,7 @@ snippet BSD4 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -161,7 +161,7 @@ snippet BSD4 4. Neither the name of the $3 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -177,17 +177,17 @@ snippet BSD4 snippet MIT ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -200,13 +200,13 @@ snippet MIT snippet APACHE ${1:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${2:copyright holder} - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -214,14 +214,14 @@ snippet APACHE limitations under the License. ${3} -snippet BEERWARE +snippet BEERWARE ${2:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${3:copyright holder} - + Licensed under the "THE BEER-WARE LICENSE" (Revision 42): ${1:`g:snips_author`} wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think - this stuff is worth it, you can buy me a beer or coffee in return + this stuff is worth it, you can buy me a beer or coffee in return ${4} diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index cd2ab0ebd..5385d115d 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -2,22 +2,22 @@ snippet main package { import flash.display.*; import flash.Events.*; - + public class Main extends Sprite { public function Main ( ) { trace("start"); stage.scaleMode = StageScaleMode.NO_SCALE; stage.addEventListener(Event.RESIZE, resizeListener); } - + private function resizeListener (e:Event):void { trace("The application window changed size!"); trace("New width: " + stage.stageWidth); trace("New height: " + stage.stageHeight); } - + } - + } snippet class ${1:public|internal} class ${2:name} ${3:extends } { diff --git a/snippets/apache.snippets b/snippets/apache.snippets index a9e53e197..6f0c8873f 100644 --- a/snippets/apache.snippets +++ b/snippets/apache.snippets @@ -6,7 +6,7 @@ snippet dir Order Deny,Allow Deny from All -# +# snippet filesmatch ${2} diff --git a/snippets/c.snippets b/snippets/c.snippets index 85e7ac2b0..21c265d68 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -14,7 +14,7 @@ snippet mainn return 0; } ## -## Preprocessor +## Preprocessor # #include <...> snippet inc #include <${1:stdio}.h>${2} @@ -230,5 +230,5 @@ snippet gpl * * Copyright (C) ${1:Author}, `strftime("%Y")` */ - + ${2} diff --git a/snippets/chef.snippets b/snippets/chef.snippets index 51036135a..d44f535ec 100644 --- a/snippets/chef.snippets +++ b/snippets/chef.snippets @@ -141,7 +141,7 @@ snippet svn ${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations ${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations ${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command - + ${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default) ${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available ${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts @@ -159,7 +159,7 @@ snippet git ${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update ${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone ${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this. - + ${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default) ${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available ${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts @@ -197,7 +197,7 @@ snippet deploy ${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking ${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting ${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting - + ${60:#}${61::deploy} # Deploy the application (Default) ${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place ${64:#}${65::rollback} # Rollback the application to the previous release diff --git a/snippets/clojure.snippets b/snippets/clojure.snippets index e247debf6..59867b755 100644 --- a/snippets/clojure.snippets +++ b/snippets/clojure.snippets @@ -43,7 +43,7 @@ snippet if (if ${1:test-expr} ${2:then-expr} ${3:else-expr}) -snippet if-let +snippet if-let (if-let [${1:result} ${2:test-expr}] (${3:then-expr} $1) (${4:else-expr})) diff --git a/snippets/cmake.snippets b/snippets/cmake.snippets index 26aa9ac9d..0c3a21576 100644 --- a/snippets/cmake.snippets +++ b/snippets/cmake.snippets @@ -39,7 +39,7 @@ snippet link TARGET_LINK_LIBRARIES(${1:bin} ${2:somelib} ) - + snippet bin ADD_EXECUTABLE(${1:bin}) @@ -52,7 +52,7 @@ snippet dep ) snippet props - SET_TARGET_PROPERTIES(${1:target} - ${2:PROPERTIES} ${3:COMPILE_FLAGS} + SET_TARGET_PROPERTIES(${1:target} + ${2:PROPERTIES} ${3:COMPILE_FLAGS} ${4:"-O3 -Wall -pedantic"} ) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 048671246..52148e786 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -64,11 +64,11 @@ snippet fr # mutable snippet mu mutable -## +## ## Class # class snippet cl - class ${1:`Filename('$1', 'name')`} + class ${1:`Filename('$1', 'name')`} { public: $1(${2}); @@ -97,7 +97,7 @@ snippet cin std::cin >> ${1};${2} ## ## Iteration -# for i +# for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4} diff --git a/snippets/cs.snippets b/snippets/cs.snippets index 725f8b7d3..d93435141 100644 --- a/snippets/cs.snippets +++ b/snippets/cs.snippets @@ -1,12 +1,12 @@ # cs.snippets # =========== -# +# # Standard C-Sharp snippets for snipmate. # # Largely ported over from Visual Studio 2010 snippets plus # a few snippets from Resharper plus a few widely known snippets. # -# Most snippets on elements (i.e. classes, properties) +# Most snippets on elements (i.e. classes, properties) # follow suffix conventions. The order of suffixes to a snippet # is fixed. # @@ -55,13 +55,13 @@ # * Events # # Feedback is welcome! -# +# # entry point snippet sim public static int Main(string[] args) { ${1} return 0; - } + } snippet simc public class Application { public static int Main(string[] args) { @@ -73,13 +73,13 @@ snippet simc snippet if if (${1}) { ${2} - } + } snippet el else { ${1} - } + } snippet ifs - if (${1}) + if (${1}) ${2} # ternary conditional snippet t diff --git a/snippets/django.snippets b/snippets/django.snippets index 8296cce25..5c72b2b9e 100644 --- a/snippets/django.snippets +++ b/snippets/django.snippets @@ -73,16 +73,16 @@ snippet model class ${1:ModelName}(models.Model): """${2:docstring}""" ${3} - + class Meta: ${4} - + def __unicode__(self): ${5} - + def save(self, force_insert=False, force_update=False): ${6} - + @models.permalink def get_absolute_url(self): return ('${7:view_or_url_name}' ${8}) @@ -90,9 +90,9 @@ snippet model snippet modeladmin class ${1:ModelName}Admin(admin.ModelAdmin): ${2} - + admin.site.register($1, $1Admin) - + snippet tabularinline class ${1:ModelName}Inline(admin.TabularInline): model = $1 diff --git a/snippets/erlang.snippets b/snippets/erlang.snippets index acc6fd195..1199e8443 100644 --- a/snippets/erlang.snippets +++ b/snippets/erlang.snippets @@ -1,12 +1,12 @@ # module and export all snippet mod -module(${1:`Filename('', 'my')`}). - + -compile([export_all]). - + start() -> ${2} - + stop() -> ok. # define directive @@ -81,7 +81,7 @@ snippet application end. stop(_State) -> - ok. + ok. # OTP supervisor snippet supervisor -module(${1:`Filename('', 'my')`}). diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 93aba1983..3fe4caca7 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -1,15 +1,15 @@ snippet #! #!/usr/bin/env falcon -# Import +# Import snippet imp import ${1:module} # Function snippet fun - function ${2:function_name}(${3}) + function ${2:function_name}(${3}) ${4} - end + end # Class snippet class @@ -17,35 +17,35 @@ snippet class ${3:/* members/methods */} end -# If +# If snippet if if ${1:condition} - ${2} + ${2} end # If else snippet ife if ${1:condition} - ${2} + ${2} else - ${1} + ${1} end -# If else if +# If else if snippet elif elif ${1:condition} - ${2} + ${2} # Switch case snippet switch switch ${1:expression} case ${2:item} case ${3:item} - default + default end # Select -snippet select +snippet select select ${1:variable} case ${2:TypeSpec} case ${3:TypeSpec} @@ -65,7 +65,7 @@ snippet forto end # While Loop -snippet while +snippet while while ${1:conidition} - ${2} + ${2} end diff --git a/snippets/go.snippets b/snippets/go.snippets index a88d8d069..1d7d4f595 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -4,7 +4,7 @@ snippet ap # bool snippet bl bool -# byte +# byte snippet bt byte # break @@ -29,7 +29,7 @@ snippet co # continue snippet cn continue -# defer +# defer snippet df defer ${1:func}() # defer recover @@ -57,20 +57,20 @@ snippet gpl * * Copyright (C) ${1:Author}, `strftime("%Y")` */ - + ${2} # int snippet i int -# import +# import snippet im import ( - "${1:package}" + "${1:package}" )${2} -# interface +# interface snippet in interface{} -# full interface snippet +# full interface snippet snippet inf interface ${1:name} { ${2:/* methods */} @@ -126,13 +126,13 @@ snippet fr ${4} } ${5} -# function simple +# function simple snippet fun func ${1:funcName}(${2}) ${3:error} { ${4} } ${5} -# function on receiver +# function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5} @@ -147,7 +147,7 @@ snippet lp # make snippet mk make(${1:[]string}, ${2:0}) -# map +# map snippet mp map[${1:string}]${2:int} # main() @@ -159,19 +159,19 @@ snippet main # new snippet nw new(${1:type}) -# panic +# panic snippet pn panic("${1:msg}") # print snippet pr fmt.Printf("%${1:s}\n", ${2:var})${3} -# range +# range snippet rn range ${1} -# return +# return snippet rt return ${1} -# result +# result snippet rs result # select @@ -193,7 +193,7 @@ snippet st ${2:/* data */} } ${3} -# switch +# switch snippet sw switch ${1:var} { case ${2:value1}: @@ -205,7 +205,7 @@ snippet sw } snippet sp fmt.Sprintf("%${1:s}", ${2:var})${3} -# true +# true snippet t true # variable declaration diff --git a/snippets/haskell.snippets b/snippets/haskell.snippets index bcda8a5b4..3857d8b4e 100644 --- a/snippets/haskell.snippets +++ b/snippets/haskell.snippets @@ -48,7 +48,7 @@ snippet ap ${1:map} ${2:fn} ${3:list} snippet do do - + snippet λ \${1:x} -> ${2} snippet \ diff --git a/snippets/htmltornado.snippets b/snippets/htmltornado.snippets index de9915363..9685b1f93 100644 --- a/snippets/htmltornado.snippets +++ b/snippets/htmltornado.snippets @@ -28,7 +28,7 @@ snippet if ${2} {% end %} snippet elif - {% elif ${1:condition} %} + {% elif ${1:condition} %} snippet else {% else %} snippet import diff --git a/snippets/java.snippets b/snippets/java.snippets index daf8928b7..c34010c5b 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -47,7 +47,7 @@ snippet tc ## ## Class Enhancements snippet ext - extends + extends snippet imp implements ## diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index e9dd58b94..fedb943df 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -140,7 +140,7 @@ snippet sing $1 = function $1($2) { return instance; }; - + // carry over the prototype properties $1.prototype = this; @@ -154,7 +154,7 @@ snippet sing return instance; } -# Crockford's object function +# Crockford's object function snippet obj function object(o) { function F() {} @@ -164,7 +164,7 @@ snippet obj # Define multiple properties snippet props var ${1:my_object} = Object.defineProperties( - ${2:new Object()}, + ${2:new Object()}, { ${3:property} : { get : function $1_$3_getter() { @@ -182,9 +182,9 @@ snippet props ); # Define single property snippet prop - Object.defineProperty( + Object.defineProperty( ${1:object}, - "${2:property}", + "${2:property}", { get : function $1_$2_getter() { // getter code diff --git a/snippets/markdown.snippets b/snippets/markdown.snippets index e4efd3c2d..9788959f6 100644 --- a/snippets/markdown.snippets +++ b/snippets/markdown.snippets @@ -24,11 +24,11 @@ snippet ![:* snippet === `repeat('=', strlen(getline(line(".") - 1)))` - + ${1} snippet --- `repeat('-', strlen(getline(line(".") - 1)))` - + ${1} snippet blockquote diff --git a/snippets/progress.snippets b/snippets/progress.snippets index 0e6d47bb9..0f1f436d3 100644 --- a/snippets/progress.snippets +++ b/snippets/progress.snippets @@ -55,4 +55,4 @@ snippet log snippet dec DECIMAL snippet sep - /* ------------------------------------------------------------------------- */ + /* ------------------------------------------------------------------------- */ diff --git a/snippets/puppet.snippets b/snippets/puppet.snippets index f3499321e..29fe6b37e 100644 --- a/snippets/puppet.snippets +++ b/snippets/puppet.snippets @@ -1,6 +1,6 @@ # Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540 # -# Please contact R.I.Pienaar for additions and feedback, +# Please contact R.I.Pienaar for additions and feedback, # see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php # Language Constructs @@ -25,7 +25,7 @@ snippet ife snippet if if $${1:variable} { ${2} - } + } snippet else else { ${1} @@ -34,7 +34,7 @@ snippet ? ? { '${1}' => ${2} } -# +# # blocks etc and general syntax sugar snippet [ [ ${1} ]${2} @@ -54,7 +54,7 @@ snippet defined defined(${1:Resource}["${2:name}"])${3} snippet emerg emerg("${1:message}")${2} -snippet extlookup Simple extlookup +snippet extlookup Simple extlookup extlookup("${1:variable}")${2} snippet extlookup Extlookup with defaults extlookup("${1:variable}", "${2:default}")${3} diff --git a/snippets/python.snippets b/snippets/python.snippets index c29b340ef..fcce99fec 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -140,7 +140,7 @@ snippet test # test case snippet testcase class ${1:ExampleCase}(unittest.TestCase): - + def test_${2:description}(self): ${3} snippet fut @@ -151,7 +151,7 @@ snippet getopt # Short option syntax: "hv:" # Long option syntax: "help" or "verbose=" opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}]) - + except getopt.GetoptError, err: # Print debug info print str(err) diff --git a/snippets/r.snippets b/snippets/r.snippets index 95079650f..2436f56ed 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -117,5 +117,5 @@ snippet cor cor.test(${1:x}, ${2:y}) snippet fte var.test(${1:x}, ${2:y}) -snippet kvt +snippet kvt kv.test(${1:x}, ${2:y}) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index d97fa5738..6cb799228 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -30,7 +30,7 @@ snippet cont: ${1:content} snippet code: .. code:: ${1:type} - + ${2:write some code} snippet tip: .. tip:: @@ -59,11 +59,11 @@ snippet cau: #Spinx only snippet sid: .. sidebar:: ${1:Title} - - ${2} + + ${2} # CJK optimize, CJK has no space between charaters snippet *c - \ *${1:Emphasis}*\ ${2} + \ *${1:Emphasis}*\ ${2} snippet **c \ **${1:Strong emphasis}**\ ${2} diff --git a/snippets/sh.snippets b/snippets/sh.snippets index b07362081..83e78482d 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -1,7 +1,7 @@ # Shebang. Executing bash via /usr/bin/env makes scripts more portable. snippet #! #!/usr/bin/env bash - + snippet if if [[ ${1:condition} ]]; then ${2:#statements} @@ -30,9 +30,9 @@ snippet case ${2:pattern}) ${3};; esac -snippet go - while getopts '${1:o}' ${2:opts} - do +snippet go + while getopts '${1:o}' ${2:opts} + do case $$2 in ${3:o0}) ${4:#staments};; @@ -53,9 +53,9 @@ snippet getopt { cat <<- EOT - Usage : $${0:0} [options] [--] + Usage : $${0:0} [options] [--] - Options: + Options: -h|help Display this message -v|version Display script version diff --git a/snippets/tcl.snippets b/snippets/tcl.snippets index 1fe1cb960..4d456de07 100644 --- a/snippets/tcl.snippets +++ b/snippets/tcl.snippets @@ -1,7 +1,7 @@ # #!/usr/bin/env tclsh snippet #! #!/usr/bin/env tclsh - + # Process snippet pro proc ${1:function_name} {${2:args}} { diff --git a/snippets/textile.snippets b/snippets/textile.snippets index c78d6ec81..9ad97be5b 100644 --- a/snippets/textile.snippets +++ b/snippets/textile.snippets @@ -27,4 +27,4 @@ snippet fn [${1:ref number}] ${3} fn$1. ${2:footnote} - + diff --git a/snippets/xslt.snippets b/snippets/xslt.snippets index e7abdf3fc..6e25fd594 100644 --- a/snippets/xslt.snippets +++ b/snippets/xslt.snippets @@ -50,7 +50,7 @@ snippet import snippet include ${2} - + snippet otherwise ${1} @@ -64,7 +64,7 @@ snippet stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">${1} -snippet template +snippet template ${3} @@ -91,7 +91,7 @@ snippet when snippet with-param ${2} - + snippet with-param select - + diff --git a/snippets/yii-chtml.snippets b/snippets/yii-chtml.snippets index 91c65b923..df5d5eb73 100644 --- a/snippets/yii-chtml.snippets +++ b/snippets/yii-chtml.snippets @@ -1,59 +1,59 @@ #--------------------Yii CHtml--------------------------------- #Yii CHtml::radioButton snippet yhrb - echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} ); + echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} ); #Yii CHtml::asset snippet yhass - echo CHtml::asset('${1:path}'); + echo CHtml::asset('${1:path}'); #Yii CHtml::activeLabelEx snippet yhale - echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::encodeArray snippet yheca - echo CHtml::encodeArray(array(${1})); + echo CHtml::encodeArray(array(${1})); #Yii CHtml::normalizeUrl snippet yhnurl - echo CHtml::normalizeUrl(array('${1}')); + echo CHtml::normalizeUrl(array('${1}')); #Yii CHtml::resetButton snippet yhsb - echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::linkButton snippet yhlinkb - echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::activeTextArea snippet yhata - echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::ajaxButton snippet yhajb - echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::activeId snippet yhai - echo CHtml::activeId(${1:model}, '${2:attribute}'); + echo CHtml::activeId(${1:model}, '${2:attribute}'); #Yii CHtml::activeCheckBox snippet yhacb - echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeHiddenField snippet yhahf - echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::encode snippet yhec - echo CHtml::encode(${1:text}); + echo CHtml::encode(${1:text}); #Yii CHtml::metaTag snippet yhmtag - echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue})); + echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::dropDownList snippet yhddl @@ -61,167 +61,167 @@ snippet yhddl #Yii CHtml::listBox snippet yhlb - echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::script snippet yhjs - echo CHtml::script('${1:test}'); + echo CHtml::script('${1:test}'); #Yii CHtml::ajax snippet yhaj - echo CHtml::ajax(array(${1})); + echo CHtml::ajax(array(${1})); #Yii CHtml::textField snippet yhtf - echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activePasswordField snippet yhapf - echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::listData snippet yhld - echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}'); + echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}'); #Yii CHtml::mailto snippet yhmt - echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::image snippet yhimg - echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeListBox snippet yhalb - echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::activeFileField snippet yhaff - echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::closeTag snippet yhct - echo CHtml::closeTag('${1:tag}'); + echo CHtml::closeTag('${1:tag}'); #Yii CHtml::activeInputField snippet yhaif - echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::scriptFile snippet yhjsf - echo CHtml::scriptFile('${1:url}'); + echo CHtml::scriptFile('${1:url}'); #Yii CHtml::radioButtonList snippet yhrbl - echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::cssFile snippet yhcssf - echo CHtml::cssFile('${1:url}','${2:media}'); + echo CHtml::cssFile('${1:url}','${2:media}'); #Yii CHtml::error snippet yherr - echo CHtml::error(${1:model}, '${2:attribute}'); + echo CHtml::error(${1:model}, '${2:attribute}'); #Yii CHtml::passwordField snippet yhpf - echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::hiddenField snippet yhhf - echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::cdata snippet yhc - echo CHtml::cdata(${1:text}); + echo CHtml::cdata(${1:text}); #Yii CHtml::link snippet yhlink - echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue})); + echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::errorSummary snippet yherrs - echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}'); + echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}'); #Yii CHtml::tag snippet yht - echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true}); + echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true}); #Yii CHtml::ajaxLink snippet yhajl - echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::label snippet yhlabel - echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeName snippet yhan - echo CHtml::activeName(${1:model}, '${2:attribute}'); + echo CHtml::activeName(${1:model}, '${2:attribute}'); #Yii CHtml::statefulForm snippet yhsform - echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::fileField snippet yhff - echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeTextField snippet yhatf - echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::css snippet yhcss - echo CHtml::css('${1:test}','${2:media}'); + echo CHtml::css('${1:test}','${2:media}'); #Yii CHtml::imageButton snippet yhimgb - echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::ajaxSubmitButton snippet yhajsb - echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::button snippet yhb - echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::listOptions snippet yhlo - echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue})); + echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeCheckBoxList snippet yhacbl - echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::openTag snippet yhot - echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue})); + echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::checkBox snippet yhcb - echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue})); + echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::textArea snippet yhta - echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::linkTag snippet yhlinkt - echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue})); + echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::resetButton snippet yhrsb - echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::activeRadioButtonList snippet yharbl - echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::checkBoxList snippet yhcbl - echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::form snippet yhform @@ -231,18 +231,18 @@ snippet yhform snippet yhbeform echo CHtml::beginForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); ${5} - echo CHtml::endForm(); + echo CHtml::endForm(); #Yii CHtml::activeDropDownList snippet yhaddl - echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::activeRadioButton snippet yharb - echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeLabel snippet yhal - echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); diff --git a/snippets/yii.snippets b/snippets/yii.snippets index 9f29eaf13..da48ee236 100644 --- a/snippets/yii.snippets +++ b/snippets/yii.snippets @@ -1,58 +1,58 @@ #Yii session offset snippet yse - Yii::app()->session['${1}']; + Yii::app()->session['${1}']; #Yii renderDynamic snippet yrd - $this->renderDynamic('${1:callback}'); + $this->renderDynamic('${1:callback}'); #Yii set cache snippet ycas - Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5})); + Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5})); #Yii Add cache snippet ycad - Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5})); + Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5})); #Yii register CSS file snippet yregcf - Yii::app()->clientScript->registerCssFile('${1:file}'); + Yii::app()->clientScript->registerCssFile('${1:file}'); #Yii requestType snippet yreqtype - Yii::app()->request->requestType + Yii::app()->request->requestType #Yii isAjaxRequest snippet yisajax - Yii::app()->request->isAjaxRequest + Yii::app()->request->isAjaxRequest #Yii translate snippet yt - Yii::t('${1:category}', '${2:message}',array(${3})); + Yii::t('${1:category}', '${2:message}',array(${3})); #Yii register CSS snippet yregc - Yii::app()->clientScript->registerCss('${1:id}', '${2}'); + Yii::app()->clientScript->registerCss('${1:id}', '${2}'); #Yii log snippet ylog - Yii::log('${1:msg}', '${2:info}'); + Yii::log('${1:msg}', '${2:info}'); #Yii userHostAddress snippet yuserip - YYii::app()->request->userHostAddress + YYii::app()->request->userHostAddress #Yii register script file snippet yregsf - Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END}); + Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END}); #Yii CLinkPager snippet ylinkpager - $this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'})) + $this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'})) #Yii CJSON::encode snippet yjec - CJSON::encode(${1:text}); + CJSON::encode(${1:text}); #CActiveDataProvider snippet yadp @@ -68,23 +68,23 @@ snippet yadp ), )); ${6} - // $dataProvider->getData() will return a list of Post objects + // $dataProvider->getData() will return a list of Post objects #Yii renderDynamic internal snippet yrdi - $this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value})); + $this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value})); #Yii register script snippet yregs - Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY}); + Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY}); #Yii Flush cache snippet ycaf - Yii::app()->cache->flush(); + Yii::app()->cache->flush(); #Yii Yii::app()->request->cookies snippet yco - Yii::app()->request->cookies['${1}'] + Yii::app()->request->cookies['${1}'] #Yii user-> snippet yuser @@ -92,54 +92,54 @@ snippet yuser #Yii refresh snippet yrf - $this->refresh(); + $this->refresh(); #Yii import snippet yimp - Yii::import('${1}'); + Yii::import('${1}'); #Yii trace snippet ytrace - Yii::trace('${1:msg}'); + Yii::trace('${1:msg}'); #Yii params snippet ypar - Yii::app()->params['${1}'] + Yii::app()->params['${1}'] #Yii isPostRequest snippet yispost - Yii::app()->request->isPostRequest + Yii::app()->request->isPostRequest #Yii IF isAjaxRequest snippet yifisajax if(Yii::app()->request->isAjaxRequest == TRUE) { ${1} - } + } #Yii Yii::app()->cache->delete snippet ydelcache - Yii::app()->cache->delete('${1:key}'); + Yii::app()->cache->delete('${1:key}'); #Yii render view snippet yr - $this->render('${1:view}',array('${2:key}'=>${3:value})); + $this->render('${1:view}',array('${2:key}'=>${3:value})); #Yii redirect snippet yre - $this->redirect(array('${1:controller}/${2:action}')); + $this->redirect(array('${1:controller}/${2:action}')); #Yii Get cache snippet ycag - Yii::app()->cache->get('${1:key}'); + Yii::app()->cache->get('${1:key}'); #Yii render text snippet yrt - $this->renderText('${1}'); + $this->renderText('${1}'); #Yii render partial snippet yrp - $this->renderPartial('${1:view}',array('${2:key}'=>${3:value})); + $this->renderPartial('${1:view}',array('${2:key}'=>${3:value})); #----------------Yii Model----------------------------- #Yii Model count @@ -152,7 +152,7 @@ snippet ycountbs #Yii Model updateAll snippet yupdatea - ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value})); #Yii Model updateByPk snippet yupdatebp @@ -164,35 +164,35 @@ snippet ydela #Yii Model deleteByPk snippet ydelbp - ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); #Yii Model find snippet yfind - ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value})); #Yii Model findAll snippet yfinda - ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value})); #Yii Model findByPk snippet yfindbp - ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); #Yii Model findAllByPk snippet yfindabp - ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value})); #Yii Model findBySql snippet yfindbs - ${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value})); #Yii Model findAllByAttributes snippet yfindaba - ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value})); + ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value})); #Yii Model exists snippet yexists - ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value})); #Yii Create model class snippet ymodel @@ -245,7 +245,7 @@ snippet ymodel } } -#------------Yii Controller------------------------------------ +#------------Yii Controller------------------------------------ #Yii Create controller class snippet ycontroller From 4eb88d79939ad2cb6af04227b180277c631388d3 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Thu, 20 Jun 2013 14:33:44 -0700 Subject: [PATCH 0107/1587] Removed comment blocks from placeholders --- snippets/actionscript.snippets | 12 +++---- snippets/c.snippets | 14 ++++---- snippets/cpp.snippets | 10 +++--- snippets/dart.snippets | 8 ++--- snippets/falcon.snippets | 14 ++++---- snippets/go.snippets | 30 ++++++++--------- snippets/java.snippets | 2 +- snippets/javascript-jquery.snippets | 4 +-- snippets/javascript.snippets | 20 ++++++------ snippets/make.snippets | 2 +- snippets/objc.snippets | 2 +- snippets/perl.snippets | 2 +- snippets/php.snippets | 30 ++++++++--------- snippets/processing.snippets | 6 ++-- snippets/python.snippets | 40 +++++++++++------------ snippets/r.snippets | 10 +++--- snippets/scala.snippets | 50 ++++++++++++++--------------- snippets/vim.snippets | 8 ++--- 18 files changed, 132 insertions(+), 132 deletions(-) diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index af9611c3f..cd2ab0ebd 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -109,17 +109,17 @@ snippet try # For Loop (same as c.snippet) snippet for for (..) {..} for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${4} } # Custom For Loop snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5:/* code */} + ${5} } # If Condition snippet if if (${1:/* condition */}) { - ${2:/* code */} + ${2} } snippet el else { @@ -131,7 +131,7 @@ snippet t snippet fun function ${1:function_name}(${2})${3} { - ${4:/* code */} + ${4} } # FlxSprite (usefull when using the flixel library) snippet FlxSprite @@ -144,13 +144,13 @@ snippet FlxSprite public function $1(${3: X:Number, Y:Number}):void { super(X,Y); - ${4: //code...} + ${4} } override public function update():void { super.update(); - ${5: //code...} + ${5} } } } diff --git a/snippets/c.snippets b/snippets/c.snippets index de6d6a933..85e7ac2b0 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -53,7 +53,7 @@ snippet once # if snippet if if (${1:/* condition */}) { - ${2:/* code */} + ${2} }${3} # else snippet el @@ -63,7 +63,7 @@ snippet el # else if snippet elif else if (${1:/* condition */}) { - ${2:/* code */} + ${2} }${3} # ternary snippet t @@ -94,22 +94,22 @@ snippet case # for snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${4} }${5} # for (custom) snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5:/* code */} + ${5} }${6} # while snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${2} }${3} # do... while snippet do do { - ${2:/* code */} + ${2} } while (${1:/* condition */});${3} ## ## Functions @@ -117,7 +117,7 @@ snippet do snippet fun ${1:void} ${2:function_name}(${3}) { - ${4:/* code */} + ${4} }${5} # function declaration snippet fund diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index c3e19fe93..048671246 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -80,7 +80,7 @@ snippet cl # member function implementation snippet mfun ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5:/* code */} + ${5} } # namespace snippet ns @@ -100,13 +100,13 @@ snippet cin # for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} + ${4} }${5} # foreach snippet fore for (${1:auto} ${2:i} : ${3:container}) { - ${4:/* code */} + ${4} }${5} # iterator snippet iter @@ -123,9 +123,9 @@ snippet itera ## Lambdas # lamda (one line) snippet ld - [${1}](${2}){${3:/* code */}}${4} + [${1}](${2}){${3}}${4} # lambda (multi-line) snippet lld [${1}](${2}){ - ${3:/* code */} + ${3} }${4} diff --git a/snippets/dart.snippets b/snippets/dart.snippets index 6f0b8ac5e..c7b56daf6 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -9,7 +9,7 @@ snippet so ${2} snippet main static void main() { - ${1:/* code */} + ${1} } snippet st static ${1} @@ -57,15 +57,15 @@ snippet for } snippet fore for (final ${2:item} in ${1:itemList}) { - ${3:/* code */} + ${3} } snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${2} } snippet dowh do { - ${2:/* code */} + ${2} } while (${1:/* condition */}); snippet as assert(${1:/* condition */}); diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 85fb918dd..93aba1983 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -8,7 +8,7 @@ snippet imp # Function snippet fun function ${2:function_name}(${3}) - ${4:/* code */} + ${4} end # Class @@ -20,13 +20,13 @@ snippet class # If snippet if if ${1:condition} - ${2:/* code */} + ${2} end # If else snippet ife if ${1:condition} - ${2:/* code */} + ${2} else ${1} end @@ -34,7 +34,7 @@ snippet ife # If else if snippet elif elif ${1:condition} - ${2:/* code */} + ${2} # Switch case snippet switch @@ -55,17 +55,17 @@ snippet select # For/in Loop snippet forin for ${1:element} in ${2:container} - ${3:/* code */} + ${3} end # For/to Loop snippet forto for ${1:lowerbound} to ${2:upperbound} - ${3:/* code */} + ${3} end # While Loop snippet while while ${1:conidition} - ${2:/* code */} + ${2} end diff --git a/snippets/go.snippets b/snippets/go.snippets index c64db91f9..a88d8d069 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -16,7 +16,7 @@ snippet ch # case snippet cs case ${1:value}: - ${2:/* code */} + ${2} # const snippet c const ${1:NAME} = ${2:0} @@ -36,7 +36,7 @@ snippet df snippet dfr defer func() { if err := recover(); err != nil { - ${1:/* code */} + ${1} } }() # gpl @@ -78,7 +78,7 @@ snippet inf # if condition snippet if if ${1:/* condition */} { - ${2:/* code */} + ${2} }${2} # else snippet snippet el @@ -109,7 +109,7 @@ snippet f6 # if else snippet ie if ${1:/* condition */} { - ${2:/* code */} + ${2} } else { ${3} } @@ -117,25 +117,25 @@ snippet ie # for loop snippet fo for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { - ${4:/* code */} + ${4} } ${5} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { - ${4:/* code */} + ${4} } ${5} # function simple snippet fun func ${1:funcName}(${2}) ${3:error} { - ${4:/* code */} + ${4} } ${5} # function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { - ${5:/* code */} + ${5} } ${6} # log printf @@ -153,7 +153,7 @@ snippet mp # main() snippet main func main() { - ${1:/* code */} + ${1} } ${2} # new @@ -178,11 +178,11 @@ snippet rs snippet sl select { case ${1:v1} := <-${2:chan1} - ${3:/* code */} + ${3} case ${4:v2} := <-${5:chan2} - ${6:/* code */} + ${6} default: - ${7:/* code */} + ${7} } # string snippet sr @@ -197,11 +197,11 @@ snippet st snippet sw switch ${1:var} { case ${2:value1}: - ${3:/* code */} + ${3} case ${4:value2}: - ${5:/* code */} + ${5} default: - ${6:/* code */} + ${6} } snippet sp fmt.Sprintf("%${1:s}", ${2:var})${3} diff --git a/snippets/java.snippets b/snippets/java.snippets index 854f14ac2..daf8928b7 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -171,7 +171,7 @@ snippet wh ## Main method snippet main public static void main (String[] args) { - ${1:/* code */} + ${1} } ## ## Print Methods diff --git a/snippets/javascript-jquery.snippets b/snippets/javascript-jquery.snippets index ce247a005..014c6158d 100644 --- a/snippets/javascript-jquery.snippets +++ b/snippets/javascript-jquery.snippets @@ -260,7 +260,7 @@ snippet filter ${1:obj}.filter('${2:selector expression}')${3} snippet filtert ${1:obj}.filter(function (${2:index}) { - ${3:// test code} + ${3} })${4} snippet find ${1:obj}.find('${2:selector expression}')${3} @@ -291,7 +291,7 @@ snippet getscript }); snippet grep $.grep(${1:array}, function (item, index) { - ${2:// test code} + ${2} }${3:, true}); snippet hasc ${1:obj}.hasClass('${2:className}')${3} diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 801968fcd..e9dd58b94 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -17,7 +17,7 @@ snippet f # Immediate function snippet (f (function (${1}) { - ${3:/* code */} + ${3} }(${2})); # if snippet if @@ -38,16 +38,16 @@ snippet ter snippet switch switch (${1:expression}) { case '${3:case}': - ${4:// code} + ${4} break; ${5} default: - ${2:// code} + ${2} } # case snippet case case '${1:case}': - ${2:// code} + ${2} break; ${3} # for (...) {...} @@ -63,19 +63,19 @@ snippet forr # while (...) {...} snippet wh while (${1:/* condition */}) { - ${2:/* code */} + ${2} } # try snippet try try { - ${1:/* code */} + ${1} } catch (${2:e}) { ${3:/* handle error */} } # do...while snippet do do { - ${2:/* code */} + ${2} } while (${1:/* condition */}); # Object Method snippet :f @@ -124,10 +124,10 @@ snippet jsons # self-defining function snippet sdf var ${1:function_name} = function (${2:argument}) { - ${3:// initial code ...} + ${3} $1 = function ($2) { - ${4:// main code} + ${4} }; }; # singleton @@ -150,7 +150,7 @@ snippet sing // reset the constructor pointer instance.constructor = $1; - ${3:// code ...} + ${3} return instance; } diff --git a/snippets/make.snippets b/snippets/make.snippets index 436481363..ba8e2b292 100644 --- a/snippets/make.snippets +++ b/snippets/make.snippets @@ -1,4 +1,4 @@ snippet ifeq ifeq (${1:cond0},${2:cond1}) - ${3:code} + ${3} endif diff --git a/snippets/objc.snippets b/snippets/objc.snippets index 85b80d9e6..3cf5a0a6d 100644 --- a/snippets/objc.snippets +++ b/snippets/objc.snippets @@ -207,7 +207,7 @@ snippet arel # autorelease pool snippet pool NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init]; - ${2:/* code */} + ${2} [$1 drain]; # Throw an exception snippet except diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 9cebedeac..ef83e0f5e 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -326,7 +326,7 @@ snippet tsub snippet trsub test ${1:test_name} => { description => '${2:Description of test.}'} => sub { my ($self) = @_; - ${3:# test code} + ${3} }; #prep test method diff --git a/snippets/php.snippets b/snippets/php.snippets index 5ca502de8..97ec3e317 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -231,7 +231,7 @@ snippet class */ ${5:public} function ${6:__construct}(${7:argument}) { - ${8:// code...} + ${8} } } snippet nc @@ -249,26 +249,26 @@ snippet def? ${1}defined('${2}')${3} snippet wh while (${1:/* condition */}) { - ${2:// code...} + ${2} } # do ... while snippet do do { - ${2:// code... } + ${2} } while (${1:/* condition */}); snippet if if (${1:/* condition */}) { - ${2:// code...} + ${2} } snippet ifil - ${2:} + ${2} snippet ife if (${1:/* condition */}) { - ${2:// code...} + ${2} } else { - ${3:// code...} + ${3} } ${4} snippet ifeil @@ -280,33 +280,33 @@ snippet ifeil ${4} snippet else else { - ${1:// code...} + ${1} } snippet elseif elseif (${1:/* condition */}) { - ${2:// code...} + ${2} } snippet switch switch ($${1:variable}) { case '${2:value}': - ${3:// code...} + ${3} break; ${5} default: - ${4:// code...} + ${4} break; } snippet case case '${1:value}': - ${2:// code...} + ${2} break;${3} snippet for for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4: // code...} + ${4} } snippet foreach foreach ($${1:variable} as $${2:value}) { - ${3:// code...} + ${3} } snippet foreachil @@ -314,7 +314,7 @@ snippet foreachil snippet foreachk foreach ($${1:variable} as $${2:key} => $${3:value}) { - ${4:// code...} + ${4} } snippet foreachkil $${3:value}): ?> diff --git a/snippets/processing.snippets b/snippets/processing.snippets index b0aa93ced..27f3e005a 100755 --- a/snippets/processing.snippets +++ b/snippets/processing.snippets @@ -65,7 +65,7 @@ snippet for #loop while snippet while while (${1:/* condition */}) { - ${2:/* code */} + ${2} } #break snippet break @@ -84,11 +84,11 @@ snippet default snippet switch switch(${1:expression}) { case '${3:case}': - ${4:// code} + ${4} break; ${5} default: - ${2:// code} + ${2} } #try snippet try diff --git a/snippets/python.snippets b/snippets/python.snippets index 518d2d664..c29b340ef 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -15,16 +15,16 @@ snippet docs """ snippet wh while ${1:condition}: - ${2:# TODO: write code...} + ${2} # dowh - does the same as do...while in other languages snippet dowh while True: - ${1:# TODO: write code...} + ${1} if ${2:condition}: break snippet with with ${1:expr} as ${2:var}: - ${3:# TODO: write code...} + ${3} # New Class snippet cl class ${1:ClassName}(${2:object}): @@ -37,14 +37,14 @@ snippet cl snippet def def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): """${3:docstring for $1}""" - ${4:# TODO: write code...} + ${4} snippet deff def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${3:# TODO: write code...} + ${3} # New Method snippet defs def ${1:mname}(self, ${2:arg}): - ${3:# TODO: write code...} + ${3} # New Property snippet property def ${1:foo}(): @@ -60,17 +60,17 @@ snippet property # Ifs snippet if if ${1:condition}: - ${2:# TODO: write code...} + ${2} snippet el else: - ${1:# TODO: write code...} + ${1} snippet ei elif ${1:condition}: - ${2:# TODO: write code...} + ${2} # For snippet for for ${1:item} in ${2:items}: - ${3:# TODO: write code...} + ${3} # Encodes snippet cutf8 # -*- coding: utf-8 -*- @@ -85,32 +85,32 @@ snippet . self. snippet try Try/Except try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} snippet try Try/Except/Else try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:# TODO: write code...} + ${5} snippet try Try/Except/Finally try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} finally: - ${5:# TODO: write code...} + ${5} snippet try Try/Except/Else/Finally try: - ${1:# TODO: write code...} + ${1} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:# TODO: write code...} + ${5} finally: - ${6:# TODO: write code...} + ${6} # if __name__ == '__main__': snippet ifmain if __name__ == '__main__': @@ -136,13 +136,13 @@ snippet " # test function/method snippet test def test_${1:description}(${2:`indent('.') ? 'self' : ''`}): - ${3:# TODO: write code...} + ${3} # test case snippet testcase class ${1:ExampleCase}(unittest.TestCase): def test_${2:description}(self): - ${3:# TODO: write code...} + ${3} snippet fut from __future__ import ${1} #getopt diff --git a/snippets/r.snippets b/snippets/r.snippets index 71186e35b..95079650f 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -12,24 +12,24 @@ snippet source # conditionals snippet if if (${1:condition}) { - ${2:code} + ${2} } snippet el else { - ${1:code} + ${1} } snippet ei else if (${1:condition}) { - ${2:code} + ${2} } # functions snippet fun ${1:name} = function (${2:variables}) { - ${3:code} + ${3} } snippet ret - return(${1:code}) + return(${1}) # dataframes, lists, etc snippet df diff --git a/snippets/scala.snippets b/snippets/scala.snippets index c342228a2..9a71ec2c9 100644 --- a/snippets/scala.snippets +++ b/snippets/scala.snippets @@ -7,61 +7,61 @@ #if snippet if if(${1:obj}) { - ${2:/* code */} + ${2} } #if not snippet ifn if(!${1:obj}) { - ${2:/* code */} + ${2} } #if-else snippet ifel if(${1:obj}) { - ${2:/* code */} + ${2} } else { - ${3:/* code */} + ${3} } #if-else-if snippet ifelif if(${1:obj}) { - ${2:/* code */} + ${2} } else if(${3:obj}) { - ${4:/* code */} + ${4} } #while loop snippet while while (${1:obj}) { - ${2:/* code */} + ${2} } #for loop(classic) snippet for for (${1:item} <- ${2:obj}) { - ${3:/* code */} + ${3} } #for loop(indexed) snippet fori for (${1:i} <- ${2:0} to ${3:obj}.length) { - ${4:/* code */} + ${4} } #exceptions snippet try try { - ${1:/* code */} + ${1} } catch { - case e: FileNotFoundException => ${2:/* code */} - case e: IOException => ${3:/* code */} + case e: FileNotFoundException => ${2} + case e: IOException => ${3} } finally { - ${4:/* code */} + ${4} } #match snippet match ${1: obj} match { - case ${2:e} => ${3:/* code */} - case _ => ${4:/* code */} + case ${2:e} => ${3} + case _ => ${4} } #case snippet case - case ${1:value} => ${2:/* code */} + case ${1:value} => ${2} ############################ # methods and arguments # @@ -82,9 +82,9 @@ snippet ovdef override def ${1:name}(${2:arg}) = ${3:} #first class function(see scalabook p 188) snippet fcf - (${1:a}: ${2:T}) => $1 ${3:/* code */} + (${1:a}: ${2:T}) => $1 ${3} snippet => - ${1:name} => ${2:/* code */} + ${1:name} => ${2} #recursion snippet rec def ${1:name}(${2:arg}) = @@ -196,11 +196,11 @@ snippet as #scope() with one arg snippet (a - (${1:a} => ${2:/* code */}) + (${1:a} => ${2}) #scope() with two args snippet {( {(${1:a},${2:b}) => - ${3:/* code */} + ${3} } #filter snippet filter @@ -220,10 +220,10 @@ snippet fldr #fold left operator(if u wanna reduce readability of ur code) #use wildcard symbols snippet /: - (${1:first}/:${2:name})(${3:/* code */}) + (${1:first}/:${2:name})(${3}) #fold right operator snippet :\ - (${1:first}:\${2:name})(${3:/* code */}) + (${1:first}:\${2:name})(${3}) #reduce left snippet redl ${1:name}.reduceLeft[${2:T}] {( @@ -258,13 +258,13 @@ snippet athis snippet abstract abstract class ${1:name}${2:(arg)}${3: extends }${4: with} { ${5:override def toString = "$1"} - ${6:/* code */} + ${6} } #class snippet class class ${1:name}${2:(arg)}${3: extends }${4: with} { ${5:override def toString = "$1"} - ${6:/* code */} + ${6} } #object snippet object @@ -279,7 +279,7 @@ snippet ordered class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} { ${4:override def toString = "$1"} def compare(that: $1) = ${5:this - that} - ${6:/* code */} + ${6} } #case class snippet casecl diff --git a/snippets/vim.snippets b/snippets/vim.snippets index 329d1e9f2..728c40208 100644 --- a/snippets/vim.snippets +++ b/snippets/vim.snippets @@ -10,7 +10,7 @@ snippet guard let $1 = 1${3} snippet f fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) - ${4:" code} + ${4} endf snippet t try @@ -20,15 +20,15 @@ snippet t endtry snippet for for ${1:needle} in ${2:haystack} - ${3:" code} + ${3} endfor snippet wh while ${1:condition} - ${2:" code} + ${2} endw snippet if if ${1:condition} - ${2:" code} + ${2} endif snippet ife if ${1:condition} From 5da33b7a01b11cf58053fc5f89361776deb2a8e2 Mon Sep 17 00:00:00 2001 From: Michael Thessel Date: Thu, 20 Jun 2013 14:39:31 -0700 Subject: [PATCH 0108/1587] Removed unnecessary whitespace from the end of the line --- snippets/_.snippets | 68 +++++++++---------- snippets/actionscript.snippets | 8 +-- snippets/apache.snippets | 2 +- snippets/c.snippets | 4 +- snippets/chef.snippets | 6 +- snippets/clojure.snippets | 2 +- snippets/cmake.snippets | 6 +- snippets/cpp.snippets | 6 +- snippets/cs.snippets | 14 ++-- snippets/django.snippets | 12 ++-- snippets/erlang.snippets | 8 +-- snippets/falcon.snippets | 26 ++++---- snippets/go.snippets | 32 ++++----- snippets/haskell.snippets | 2 +- snippets/htmltornado.snippets | 2 +- snippets/java.snippets | 2 +- snippets/javascript.snippets | 10 +-- snippets/markdown.snippets | 4 +- snippets/progress.snippets | 2 +- snippets/puppet.snippets | 8 +-- snippets/python.snippets | 4 +- snippets/r.snippets | 2 +- snippets/rst.snippets | 8 +-- snippets/sh.snippets | 12 ++-- snippets/tcl.snippets | 2 +- snippets/textile.snippets | 2 +- snippets/xslt.snippets | 8 +-- snippets/yii-chtml.snippets | 118 ++++++++++++++++----------------- snippets/yii.snippets | 82 +++++++++++------------ 29 files changed, 231 insertions(+), 231 deletions(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index c72974801..6204aee5d 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -16,17 +16,17 @@ snippet lorem snippet GPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, see . @@ -34,17 +34,17 @@ snippet GPL2 snippet LGPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . @@ -52,35 +52,35 @@ snippet LGPL2 snippet GPL3 ${1:one line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . - + ${3} snippet LGPL3 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . @@ -89,7 +89,7 @@ snippet BSD2 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -97,7 +97,7 @@ snippet BSD2 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -108,9 +108,9 @@ snippet BSD2 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - The views and conclusions contained in the software and documentation + + + The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressedor implied, of $2. @@ -119,7 +119,7 @@ snippet BSD3 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -130,7 +130,7 @@ snippet BSD3 3. Neither the name of the ${3:organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -147,7 +147,7 @@ snippet BSD4 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright @@ -161,7 +161,7 @@ snippet BSD4 4. Neither the name of the $3 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -177,17 +177,17 @@ snippet BSD4 snippet MIT ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -200,13 +200,13 @@ snippet MIT snippet APACHE ${1:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${2:copyright holder} - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -214,14 +214,14 @@ snippet APACHE limitations under the License. ${3} -snippet BEERWARE +snippet BEERWARE ${2:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${3:copyright holder} - + Licensed under the "THE BEER-WARE LICENSE" (Revision 42): ${1:`g:snips_author`} wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think - this stuff is worth it, you can buy me a beer or coffee in return + this stuff is worth it, you can buy me a beer or coffee in return ${4} diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index cd2ab0ebd..5385d115d 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -2,22 +2,22 @@ snippet main package { import flash.display.*; import flash.Events.*; - + public class Main extends Sprite { public function Main ( ) { trace("start"); stage.scaleMode = StageScaleMode.NO_SCALE; stage.addEventListener(Event.RESIZE, resizeListener); } - + private function resizeListener (e:Event):void { trace("The application window changed size!"); trace("New width: " + stage.stageWidth); trace("New height: " + stage.stageHeight); } - + } - + } snippet class ${1:public|internal} class ${2:name} ${3:extends } { diff --git a/snippets/apache.snippets b/snippets/apache.snippets index a9e53e197..6f0c8873f 100644 --- a/snippets/apache.snippets +++ b/snippets/apache.snippets @@ -6,7 +6,7 @@ snippet dir Order Deny,Allow Deny from All -# +# snippet filesmatch ${2} diff --git a/snippets/c.snippets b/snippets/c.snippets index 85e7ac2b0..21c265d68 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -14,7 +14,7 @@ snippet mainn return 0; } ## -## Preprocessor +## Preprocessor # #include <...> snippet inc #include <${1:stdio}.h>${2} @@ -230,5 +230,5 @@ snippet gpl * * Copyright (C) ${1:Author}, `strftime("%Y")` */ - + ${2} diff --git a/snippets/chef.snippets b/snippets/chef.snippets index 51036135a..d44f535ec 100644 --- a/snippets/chef.snippets +++ b/snippets/chef.snippets @@ -141,7 +141,7 @@ snippet svn ${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations ${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations ${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command - + ${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default) ${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available ${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts @@ -159,7 +159,7 @@ snippet git ${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update ${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone ${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this. - + ${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default) ${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available ${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts @@ -197,7 +197,7 @@ snippet deploy ${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking ${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting ${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting - + ${60:#}${61::deploy} # Deploy the application (Default) ${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place ${64:#}${65::rollback} # Rollback the application to the previous release diff --git a/snippets/clojure.snippets b/snippets/clojure.snippets index e247debf6..59867b755 100644 --- a/snippets/clojure.snippets +++ b/snippets/clojure.snippets @@ -43,7 +43,7 @@ snippet if (if ${1:test-expr} ${2:then-expr} ${3:else-expr}) -snippet if-let +snippet if-let (if-let [${1:result} ${2:test-expr}] (${3:then-expr} $1) (${4:else-expr})) diff --git a/snippets/cmake.snippets b/snippets/cmake.snippets index 26aa9ac9d..0c3a21576 100644 --- a/snippets/cmake.snippets +++ b/snippets/cmake.snippets @@ -39,7 +39,7 @@ snippet link TARGET_LINK_LIBRARIES(${1:bin} ${2:somelib} ) - + snippet bin ADD_EXECUTABLE(${1:bin}) @@ -52,7 +52,7 @@ snippet dep ) snippet props - SET_TARGET_PROPERTIES(${1:target} - ${2:PROPERTIES} ${3:COMPILE_FLAGS} + SET_TARGET_PROPERTIES(${1:target} + ${2:PROPERTIES} ${3:COMPILE_FLAGS} ${4:"-O3 -Wall -pedantic"} ) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 048671246..52148e786 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -64,11 +64,11 @@ snippet fr # mutable snippet mu mutable -## +## ## Class # class snippet cl - class ${1:`Filename('$1', 'name')`} + class ${1:`Filename('$1', 'name')`} { public: $1(${2}); @@ -97,7 +97,7 @@ snippet cin std::cin >> ${1};${2} ## ## Iteration -# for i +# for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4} diff --git a/snippets/cs.snippets b/snippets/cs.snippets index 725f8b7d3..d93435141 100644 --- a/snippets/cs.snippets +++ b/snippets/cs.snippets @@ -1,12 +1,12 @@ # cs.snippets # =========== -# +# # Standard C-Sharp snippets for snipmate. # # Largely ported over from Visual Studio 2010 snippets plus # a few snippets from Resharper plus a few widely known snippets. # -# Most snippets on elements (i.e. classes, properties) +# Most snippets on elements (i.e. classes, properties) # follow suffix conventions. The order of suffixes to a snippet # is fixed. # @@ -55,13 +55,13 @@ # * Events # # Feedback is welcome! -# +# # entry point snippet sim public static int Main(string[] args) { ${1} return 0; - } + } snippet simc public class Application { public static int Main(string[] args) { @@ -73,13 +73,13 @@ snippet simc snippet if if (${1}) { ${2} - } + } snippet el else { ${1} - } + } snippet ifs - if (${1}) + if (${1}) ${2} # ternary conditional snippet t diff --git a/snippets/django.snippets b/snippets/django.snippets index 8296cce25..5c72b2b9e 100644 --- a/snippets/django.snippets +++ b/snippets/django.snippets @@ -73,16 +73,16 @@ snippet model class ${1:ModelName}(models.Model): """${2:docstring}""" ${3} - + class Meta: ${4} - + def __unicode__(self): ${5} - + def save(self, force_insert=False, force_update=False): ${6} - + @models.permalink def get_absolute_url(self): return ('${7:view_or_url_name}' ${8}) @@ -90,9 +90,9 @@ snippet model snippet modeladmin class ${1:ModelName}Admin(admin.ModelAdmin): ${2} - + admin.site.register($1, $1Admin) - + snippet tabularinline class ${1:ModelName}Inline(admin.TabularInline): model = $1 diff --git a/snippets/erlang.snippets b/snippets/erlang.snippets index acc6fd195..1199e8443 100644 --- a/snippets/erlang.snippets +++ b/snippets/erlang.snippets @@ -1,12 +1,12 @@ # module and export all snippet mod -module(${1:`Filename('', 'my')`}). - + -compile([export_all]). - + start() -> ${2} - + stop() -> ok. # define directive @@ -81,7 +81,7 @@ snippet application end. stop(_State) -> - ok. + ok. # OTP supervisor snippet supervisor -module(${1:`Filename('', 'my')`}). diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 93aba1983..3fe4caca7 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -1,15 +1,15 @@ snippet #! #!/usr/bin/env falcon -# Import +# Import snippet imp import ${1:module} # Function snippet fun - function ${2:function_name}(${3}) + function ${2:function_name}(${3}) ${4} - end + end # Class snippet class @@ -17,35 +17,35 @@ snippet class ${3:/* members/methods */} end -# If +# If snippet if if ${1:condition} - ${2} + ${2} end # If else snippet ife if ${1:condition} - ${2} + ${2} else - ${1} + ${1} end -# If else if +# If else if snippet elif elif ${1:condition} - ${2} + ${2} # Switch case snippet switch switch ${1:expression} case ${2:item} case ${3:item} - default + default end # Select -snippet select +snippet select select ${1:variable} case ${2:TypeSpec} case ${3:TypeSpec} @@ -65,7 +65,7 @@ snippet forto end # While Loop -snippet while +snippet while while ${1:conidition} - ${2} + ${2} end diff --git a/snippets/go.snippets b/snippets/go.snippets index a88d8d069..1d7d4f595 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -4,7 +4,7 @@ snippet ap # bool snippet bl bool -# byte +# byte snippet bt byte # break @@ -29,7 +29,7 @@ snippet co # continue snippet cn continue -# defer +# defer snippet df defer ${1:func}() # defer recover @@ -57,20 +57,20 @@ snippet gpl * * Copyright (C) ${1:Author}, `strftime("%Y")` */ - + ${2} # int snippet i int -# import +# import snippet im import ( - "${1:package}" + "${1:package}" )${2} -# interface +# interface snippet in interface{} -# full interface snippet +# full interface snippet snippet inf interface ${1:name} { ${2:/* methods */} @@ -126,13 +126,13 @@ snippet fr ${4} } ${5} -# function simple +# function simple snippet fun func ${1:funcName}(${2}) ${3:error} { ${4} } ${5} -# function on receiver +# function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5} @@ -147,7 +147,7 @@ snippet lp # make snippet mk make(${1:[]string}, ${2:0}) -# map +# map snippet mp map[${1:string}]${2:int} # main() @@ -159,19 +159,19 @@ snippet main # new snippet nw new(${1:type}) -# panic +# panic snippet pn panic("${1:msg}") # print snippet pr fmt.Printf("%${1:s}\n", ${2:var})${3} -# range +# range snippet rn range ${1} -# return +# return snippet rt return ${1} -# result +# result snippet rs result # select @@ -193,7 +193,7 @@ snippet st ${2:/* data */} } ${3} -# switch +# switch snippet sw switch ${1:var} { case ${2:value1}: @@ -205,7 +205,7 @@ snippet sw } snippet sp fmt.Sprintf("%${1:s}", ${2:var})${3} -# true +# true snippet t true # variable declaration diff --git a/snippets/haskell.snippets b/snippets/haskell.snippets index bcda8a5b4..3857d8b4e 100644 --- a/snippets/haskell.snippets +++ b/snippets/haskell.snippets @@ -48,7 +48,7 @@ snippet ap ${1:map} ${2:fn} ${3:list} snippet do do - + snippet λ \${1:x} -> ${2} snippet \ diff --git a/snippets/htmltornado.snippets b/snippets/htmltornado.snippets index de9915363..9685b1f93 100644 --- a/snippets/htmltornado.snippets +++ b/snippets/htmltornado.snippets @@ -28,7 +28,7 @@ snippet if ${2} {% end %} snippet elif - {% elif ${1:condition} %} + {% elif ${1:condition} %} snippet else {% else %} snippet import diff --git a/snippets/java.snippets b/snippets/java.snippets index daf8928b7..c34010c5b 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -47,7 +47,7 @@ snippet tc ## ## Class Enhancements snippet ext - extends + extends snippet imp implements ## diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index e9dd58b94..fedb943df 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -140,7 +140,7 @@ snippet sing $1 = function $1($2) { return instance; }; - + // carry over the prototype properties $1.prototype = this; @@ -154,7 +154,7 @@ snippet sing return instance; } -# Crockford's object function +# Crockford's object function snippet obj function object(o) { function F() {} @@ -164,7 +164,7 @@ snippet obj # Define multiple properties snippet props var ${1:my_object} = Object.defineProperties( - ${2:new Object()}, + ${2:new Object()}, { ${3:property} : { get : function $1_$3_getter() { @@ -182,9 +182,9 @@ snippet props ); # Define single property snippet prop - Object.defineProperty( + Object.defineProperty( ${1:object}, - "${2:property}", + "${2:property}", { get : function $1_$2_getter() { // getter code diff --git a/snippets/markdown.snippets b/snippets/markdown.snippets index e4efd3c2d..9788959f6 100644 --- a/snippets/markdown.snippets +++ b/snippets/markdown.snippets @@ -24,11 +24,11 @@ snippet ![:* snippet === `repeat('=', strlen(getline(line(".") - 1)))` - + ${1} snippet --- `repeat('-', strlen(getline(line(".") - 1)))` - + ${1} snippet blockquote diff --git a/snippets/progress.snippets b/snippets/progress.snippets index 0e6d47bb9..0f1f436d3 100644 --- a/snippets/progress.snippets +++ b/snippets/progress.snippets @@ -55,4 +55,4 @@ snippet log snippet dec DECIMAL snippet sep - /* ------------------------------------------------------------------------- */ + /* ------------------------------------------------------------------------- */ diff --git a/snippets/puppet.snippets b/snippets/puppet.snippets index f3499321e..29fe6b37e 100644 --- a/snippets/puppet.snippets +++ b/snippets/puppet.snippets @@ -1,6 +1,6 @@ # Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540 # -# Please contact R.I.Pienaar for additions and feedback, +# Please contact R.I.Pienaar for additions and feedback, # see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php # Language Constructs @@ -25,7 +25,7 @@ snippet ife snippet if if $${1:variable} { ${2} - } + } snippet else else { ${1} @@ -34,7 +34,7 @@ snippet ? ? { '${1}' => ${2} } -# +# # blocks etc and general syntax sugar snippet [ [ ${1} ]${2} @@ -54,7 +54,7 @@ snippet defined defined(${1:Resource}["${2:name}"])${3} snippet emerg emerg("${1:message}")${2} -snippet extlookup Simple extlookup +snippet extlookup Simple extlookup extlookup("${1:variable}")${2} snippet extlookup Extlookup with defaults extlookup("${1:variable}", "${2:default}")${3} diff --git a/snippets/python.snippets b/snippets/python.snippets index c29b340ef..fcce99fec 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -140,7 +140,7 @@ snippet test # test case snippet testcase class ${1:ExampleCase}(unittest.TestCase): - + def test_${2:description}(self): ${3} snippet fut @@ -151,7 +151,7 @@ snippet getopt # Short option syntax: "hv:" # Long option syntax: "help" or "verbose=" opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}]) - + except getopt.GetoptError, err: # Print debug info print str(err) diff --git a/snippets/r.snippets b/snippets/r.snippets index 95079650f..2436f56ed 100644 --- a/snippets/r.snippets +++ b/snippets/r.snippets @@ -117,5 +117,5 @@ snippet cor cor.test(${1:x}, ${2:y}) snippet fte var.test(${1:x}, ${2:y}) -snippet kvt +snippet kvt kv.test(${1:x}, ${2:y}) diff --git a/snippets/rst.snippets b/snippets/rst.snippets index d97fa5738..6cb799228 100644 --- a/snippets/rst.snippets +++ b/snippets/rst.snippets @@ -30,7 +30,7 @@ snippet cont: ${1:content} snippet code: .. code:: ${1:type} - + ${2:write some code} snippet tip: .. tip:: @@ -59,11 +59,11 @@ snippet cau: #Spinx only snippet sid: .. sidebar:: ${1:Title} - - ${2} + + ${2} # CJK optimize, CJK has no space between charaters snippet *c - \ *${1:Emphasis}*\ ${2} + \ *${1:Emphasis}*\ ${2} snippet **c \ **${1:Strong emphasis}**\ ${2} diff --git a/snippets/sh.snippets b/snippets/sh.snippets index b07362081..83e78482d 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -1,7 +1,7 @@ # Shebang. Executing bash via /usr/bin/env makes scripts more portable. snippet #! #!/usr/bin/env bash - + snippet if if [[ ${1:condition} ]]; then ${2:#statements} @@ -30,9 +30,9 @@ snippet case ${2:pattern}) ${3};; esac -snippet go - while getopts '${1:o}' ${2:opts} - do +snippet go + while getopts '${1:o}' ${2:opts} + do case $$2 in ${3:o0}) ${4:#staments};; @@ -53,9 +53,9 @@ snippet getopt { cat <<- EOT - Usage : $${0:0} [options] [--] + Usage : $${0:0} [options] [--] - Options: + Options: -h|help Display this message -v|version Display script version diff --git a/snippets/tcl.snippets b/snippets/tcl.snippets index 1fe1cb960..4d456de07 100644 --- a/snippets/tcl.snippets +++ b/snippets/tcl.snippets @@ -1,7 +1,7 @@ # #!/usr/bin/env tclsh snippet #! #!/usr/bin/env tclsh - + # Process snippet pro proc ${1:function_name} {${2:args}} { diff --git a/snippets/textile.snippets b/snippets/textile.snippets index c78d6ec81..9ad97be5b 100644 --- a/snippets/textile.snippets +++ b/snippets/textile.snippets @@ -27,4 +27,4 @@ snippet fn [${1:ref number}] ${3} fn$1. ${2:footnote} - + diff --git a/snippets/xslt.snippets b/snippets/xslt.snippets index e7abdf3fc..6e25fd594 100644 --- a/snippets/xslt.snippets +++ b/snippets/xslt.snippets @@ -50,7 +50,7 @@ snippet import snippet include ${2} - + snippet otherwise ${1} @@ -64,7 +64,7 @@ snippet stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">${1} -snippet template +snippet template ${3} @@ -91,7 +91,7 @@ snippet when snippet with-param ${2} - + snippet with-param select - + diff --git a/snippets/yii-chtml.snippets b/snippets/yii-chtml.snippets index 91c65b923..df5d5eb73 100644 --- a/snippets/yii-chtml.snippets +++ b/snippets/yii-chtml.snippets @@ -1,59 +1,59 @@ #--------------------Yii CHtml--------------------------------- #Yii CHtml::radioButton snippet yhrb - echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} ); + echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} ); #Yii CHtml::asset snippet yhass - echo CHtml::asset('${1:path}'); + echo CHtml::asset('${1:path}'); #Yii CHtml::activeLabelEx snippet yhale - echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::encodeArray snippet yheca - echo CHtml::encodeArray(array(${1})); + echo CHtml::encodeArray(array(${1})); #Yii CHtml::normalizeUrl snippet yhnurl - echo CHtml::normalizeUrl(array('${1}')); + echo CHtml::normalizeUrl(array('${1}')); #Yii CHtml::resetButton snippet yhsb - echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::linkButton snippet yhlinkb - echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::activeTextArea snippet yhata - echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::ajaxButton snippet yhajb - echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::activeId snippet yhai - echo CHtml::activeId(${1:model}, '${2:attribute}'); + echo CHtml::activeId(${1:model}, '${2:attribute}'); #Yii CHtml::activeCheckBox snippet yhacb - echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeHiddenField snippet yhahf - echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::encode snippet yhec - echo CHtml::encode(${1:text}); + echo CHtml::encode(${1:text}); #Yii CHtml::metaTag snippet yhmtag - echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue})); + echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::dropDownList snippet yhddl @@ -61,167 +61,167 @@ snippet yhddl #Yii CHtml::listBox snippet yhlb - echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::script snippet yhjs - echo CHtml::script('${1:test}'); + echo CHtml::script('${1:test}'); #Yii CHtml::ajax snippet yhaj - echo CHtml::ajax(array(${1})); + echo CHtml::ajax(array(${1})); #Yii CHtml::textField snippet yhtf - echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activePasswordField snippet yhapf - echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::listData snippet yhld - echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}'); + echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}'); #Yii CHtml::mailto snippet yhmt - echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::image snippet yhimg - echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeListBox snippet yhalb - echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::activeFileField snippet yhaff - echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::closeTag snippet yhct - echo CHtml::closeTag('${1:tag}'); + echo CHtml::closeTag('${1:tag}'); #Yii CHtml::activeInputField snippet yhaif - echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::scriptFile snippet yhjsf - echo CHtml::scriptFile('${1:url}'); + echo CHtml::scriptFile('${1:url}'); #Yii CHtml::radioButtonList snippet yhrbl - echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::cssFile snippet yhcssf - echo CHtml::cssFile('${1:url}','${2:media}'); + echo CHtml::cssFile('${1:url}','${2:media}'); #Yii CHtml::error snippet yherr - echo CHtml::error(${1:model}, '${2:attribute}'); + echo CHtml::error(${1:model}, '${2:attribute}'); #Yii CHtml::passwordField snippet yhpf - echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::hiddenField snippet yhhf - echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::cdata snippet yhc - echo CHtml::cdata(${1:text}); + echo CHtml::cdata(${1:text}); #Yii CHtml::link snippet yhlink - echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue})); + echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::errorSummary snippet yherrs - echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}'); + echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}'); #Yii CHtml::tag snippet yht - echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true}); + echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true}); #Yii CHtml::ajaxLink snippet yhajl - echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::label snippet yhlabel - echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeName snippet yhan - echo CHtml::activeName(${1:model}, '${2:attribute}'); + echo CHtml::activeName(${1:model}, '${2:attribute}'); #Yii CHtml::statefulForm snippet yhsform - echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::fileField snippet yhff - echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeTextField snippet yhatf - echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::css snippet yhcss - echo CHtml::css('${1:test}','${2:media}'); + echo CHtml::css('${1:test}','${2:media}'); #Yii CHtml::imageButton snippet yhimgb - echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::ajaxSubmitButton snippet yhajsb - echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::button snippet yhb - echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::listOptions snippet yhlo - echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue})); + echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeCheckBoxList snippet yhacbl - echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::openTag snippet yhot - echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue})); + echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::checkBox snippet yhcb - echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue})); + echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::textArea snippet yhta - echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::linkTag snippet yhlinkt - echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue})); + echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue})); #Yii CHtml::resetButton snippet yhrsb - echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); #Yii CHtml::activeRadioButtonList snippet yharbl - echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::checkBoxList snippet yhcbl - echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::form snippet yhform @@ -231,18 +231,18 @@ snippet yhform snippet yhbeform echo CHtml::beginForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); ${5} - echo CHtml::endForm(); + echo CHtml::endForm(); #Yii CHtml::activeDropDownList snippet yhaddl - echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); #Yii CHtml::activeRadioButton snippet yharb - echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); #Yii CHtml::activeLabel snippet yhal - echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); diff --git a/snippets/yii.snippets b/snippets/yii.snippets index 9f29eaf13..da48ee236 100644 --- a/snippets/yii.snippets +++ b/snippets/yii.snippets @@ -1,58 +1,58 @@ #Yii session offset snippet yse - Yii::app()->session['${1}']; + Yii::app()->session['${1}']; #Yii renderDynamic snippet yrd - $this->renderDynamic('${1:callback}'); + $this->renderDynamic('${1:callback}'); #Yii set cache snippet ycas - Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5})); + Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5})); #Yii Add cache snippet ycad - Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5})); + Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5})); #Yii register CSS file snippet yregcf - Yii::app()->clientScript->registerCssFile('${1:file}'); + Yii::app()->clientScript->registerCssFile('${1:file}'); #Yii requestType snippet yreqtype - Yii::app()->request->requestType + Yii::app()->request->requestType #Yii isAjaxRequest snippet yisajax - Yii::app()->request->isAjaxRequest + Yii::app()->request->isAjaxRequest #Yii translate snippet yt - Yii::t('${1:category}', '${2:message}',array(${3})); + Yii::t('${1:category}', '${2:message}',array(${3})); #Yii register CSS snippet yregc - Yii::app()->clientScript->registerCss('${1:id}', '${2}'); + Yii::app()->clientScript->registerCss('${1:id}', '${2}'); #Yii log snippet ylog - Yii::log('${1:msg}', '${2:info}'); + Yii::log('${1:msg}', '${2:info}'); #Yii userHostAddress snippet yuserip - YYii::app()->request->userHostAddress + YYii::app()->request->userHostAddress #Yii register script file snippet yregsf - Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END}); + Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END}); #Yii CLinkPager snippet ylinkpager - $this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'})) + $this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'})) #Yii CJSON::encode snippet yjec - CJSON::encode(${1:text}); + CJSON::encode(${1:text}); #CActiveDataProvider snippet yadp @@ -68,23 +68,23 @@ snippet yadp ), )); ${6} - // $dataProvider->getData() will return a list of Post objects + // $dataProvider->getData() will return a list of Post objects #Yii renderDynamic internal snippet yrdi - $this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value})); + $this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value})); #Yii register script snippet yregs - Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY}); + Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY}); #Yii Flush cache snippet ycaf - Yii::app()->cache->flush(); + Yii::app()->cache->flush(); #Yii Yii::app()->request->cookies snippet yco - Yii::app()->request->cookies['${1}'] + Yii::app()->request->cookies['${1}'] #Yii user-> snippet yuser @@ -92,54 +92,54 @@ snippet yuser #Yii refresh snippet yrf - $this->refresh(); + $this->refresh(); #Yii import snippet yimp - Yii::import('${1}'); + Yii::import('${1}'); #Yii trace snippet ytrace - Yii::trace('${1:msg}'); + Yii::trace('${1:msg}'); #Yii params snippet ypar - Yii::app()->params['${1}'] + Yii::app()->params['${1}'] #Yii isPostRequest snippet yispost - Yii::app()->request->isPostRequest + Yii::app()->request->isPostRequest #Yii IF isAjaxRequest snippet yifisajax if(Yii::app()->request->isAjaxRequest == TRUE) { ${1} - } + } #Yii Yii::app()->cache->delete snippet ydelcache - Yii::app()->cache->delete('${1:key}'); + Yii::app()->cache->delete('${1:key}'); #Yii render view snippet yr - $this->render('${1:view}',array('${2:key}'=>${3:value})); + $this->render('${1:view}',array('${2:key}'=>${3:value})); #Yii redirect snippet yre - $this->redirect(array('${1:controller}/${2:action}')); + $this->redirect(array('${1:controller}/${2:action}')); #Yii Get cache snippet ycag - Yii::app()->cache->get('${1:key}'); + Yii::app()->cache->get('${1:key}'); #Yii render text snippet yrt - $this->renderText('${1}'); + $this->renderText('${1}'); #Yii render partial snippet yrp - $this->renderPartial('${1:view}',array('${2:key}'=>${3:value})); + $this->renderPartial('${1:view}',array('${2:key}'=>${3:value})); #----------------Yii Model----------------------------- #Yii Model count @@ -152,7 +152,7 @@ snippet ycountbs #Yii Model updateAll snippet yupdatea - ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value})); #Yii Model updateByPk snippet yupdatebp @@ -164,35 +164,35 @@ snippet ydela #Yii Model deleteByPk snippet ydelbp - ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); #Yii Model find snippet yfind - ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value})); #Yii Model findAll snippet yfinda - ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value})); #Yii Model findByPk snippet yfindbp - ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); #Yii Model findAllByPk snippet yfindabp - ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value})); + ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value})); #Yii Model findBySql snippet yfindbs - ${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value})); #Yii Model findAllByAttributes snippet yfindaba - ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value})); + ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value})); #Yii Model exists snippet yexists - ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value})); + ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value})); #Yii Create model class snippet ymodel @@ -245,7 +245,7 @@ snippet ymodel } } -#------------Yii Controller------------------------------------ +#------------Yii Controller------------------------------------ #Yii Create controller class snippet ycontroller From 8e1e176998a95b9e4d27fa892dd162c987d3f84c Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 21 Jun 2013 14:55:09 +0800 Subject: [PATCH 0109/1587] update fig/inc/img --- UltiSnips/rst.snippets | 129 ++++++++++++++++++++++++++++++++++------- 1 file changed, 109 insertions(+), 20 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index c70dccc83..cdc2a7791 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -4,9 +4,58 @@ # General Stuff # ########################################################################### global !p +from os import path as ospath +from string import Template import re from collections import Counter +#http://docutils.sourceforge.net/docs/ref/rst/roles.html +TEXT_ROLES = ['emphasis','literal','code','math', + 'pep-reference','rfc-reference', + 'strong','subscript','superscript', + 'title-reference','raw'] +TEXT_ROLES_REGEX = r'\.\.\srole::?\s(w+)' + +#http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions +SPECIFIC_ADMONITIONS = ["attention", "caution", "danger", + "error", "hint", "important", "note", + "tip", "warning"] +#http://docutils.sourceforge.net/docs/ref/rst/directives.html +DIRECTIVES = ['topic','sidebar','math','epigraph', + 'parsed-literal','code','highlights', + 'pull-quote','compound','container', + 'list-table','class','sectnum', + 'role','default-role','unicode', + 'raw'] + +NONE_CONTENT_DIRECTIVES = ['rubric', 'contents', 'header', + 'footer', 'date', 'include', 'title' + ] +INCLUDABLE_DIRECTIVES_INDEX = {'img':'image', + 'fig':'figure', + 'inc':'include'} + +def real_filename(filename): + # peal extension name off if possible + # i.e. "foo.bar.png will return "foo.bar" + names=filename.split('.') + return ".".join(names[:-1]) if len(names) > 1 else filename + +def check_file_exist(rst_path, relative_path): + """ + For RST file, it can just include files as relative path. + + :param rst_path: absolute path to rst file + :param relative_path: path related to rst file + :return: relative file's absolute path if file exist + """ + abs_path = ospath.join(ospath.dirname(rst_path), relative_path) + if ospath.isfile(abs_path): + return abs_path + +#TODO: File preview +#TODO: File list complete + def rst_char_len(char): """ return len of string which fit in rst @@ -34,27 +83,40 @@ def make_items(times, leading='+'): return ("%s Item\n" % leading) * times -def get_popular_code_type(path): +def look_up_directives(regex, fpath): """ - As function name, it will get most popular code type in given file - + find all directive args in given file + :param: regex, the regex that needs to match :param: path, to path to rst file + + :return: list, empty list if nothing match """ - with open(path) as source: - types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) + with open(fpath) as source: + match = re.findall(regex, source.read()) + return match + + +def get_popular_code_type(path): + # find most popular code type in the given rst + types = look_up_directives(r'[:|\.\.\s]code::?\s(\w+)', path) try: popular_type = Counter(types).most_common()[0][0] except IndexError: popular_type = "lua" # Don't break default return popular_type + def complete(t, opts): + msg = "({0})" if t: opts = [ m[len(t):] for m in opts if m.startswith(t) ] if len(opts) == 1: return opts[0] - return "({0})".format("|".join(opts)) + + if not len(opts): + msg = "{0}" + return msg.format("|".join(opts)) endglobal @@ -146,36 +208,63 @@ snippet cb "Code Block" b $0 endsnippet -snippet img "Image Block" b -.. |${2:alias}| image:: ${1:img} +# match snippets : +# img, inc, fig +snippet "(?P^img|inc|fig)" "Includable Block" !br +`!p +#TODO: Import img.template in rst relative path? +real_name=real_filename(ospath.basename(t[1])) +di=INCLUDABLE_DIRECTIVES_INDEX.get(match.groupdict()['shortcut'], 'include') +link="" +content="" + +if di in ['image']: + link = "|{0}| ".format(real_name) + +if di == 'figure': + content=""" + :alt: {0} + {0}""".format(real_name) + +snip.rv = ".. {link}{di}:: ".format(di=di,link=link) +`${1:file}`!p if content: + snip.rv +=" "+content` +`!p +# Tip of whether file is exist in comment type +if not check_file_exist(path, t[1]): + snip.rv='.. FILE {0} does not exist'.format(t[1]) +else: + snip.rv="" +`$0 endsnippet -snippet fig "Figure Block" b -.. figure:: ${1:img} - :alt: ${2:alter text} - - ${3} +snippet di "Directives" b +.. $1`!p snip.rv=complete(t[1], DIRECTIVES)`:: $2 + ${3:Content} $0 endsnippet -snippet cont "Content Block" b -.. contents:: ${1:Contents Title} - +snippet nd "None Content Directives" b +.. $1`!p snip.rv=complete(t[1], NONE_CONTENT_DIRECTIVES)`:: $2 $0 endsnippet -#http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions snippet sa "Specific Admonitions" b -.. $1`!p snip.rv =complete(t[1], ["attention", "caution", "danger", - "error", "hint", "important", "note", - "tip", "warning"])`:: +.. $1`!p snip.rv =complete(t[1], SPECIFIC_ADMONITIONS)`:: ${2:Content} $0 endsnippet +#it will be trigger at start of line or after a word +snippet ro "Text Roles" b +\ :$1`!p snip.rv=complete(t[1], + TEXT_ROLES+look_up_directives(TEXT_ROLES_REGEX, + path))`:\`$2\`\ +endsnippet + ############ # Sphinx # ############ From fb00219a4c777506473aaacf3085c013affe77b7 Mon Sep 17 00:00:00 2001 From: DSIW Date: Tue, 7 Aug 2012 16:08:35 +0200 Subject: [PATCH 0110/1587] 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 83e78482d..e2853b64a 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 0111/1587] 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 417a4f440..995274c69 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 0112/1587] 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 995274c69..6a9d26940 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 0113/1587] 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 6a9d26940..cbccd7357 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 0114/1587] 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 cbccd7357..5cf28d248 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 0115/1587] 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 5cf28d248..dddc101b3 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 0116/1587] 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 dddc101b3..10ecc8de0 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 0117/1587] 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 10ecc8de0..71b3e625a 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 0118/1587] 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 9693fe003..3615d4bed 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 0119/1587] 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 71b3e625a..d5d651648 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 0120/1587] 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 d5d651648..00f7884b5 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 0121/1587] 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 00f7884b5..0b4616b58 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 0122/1587] 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 0b4616b58..0ea63b6a1 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 0123/1587] 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 1b3a8e458..7d4322b5b 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 0124/1587] 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 7d4322b5b..bb071597c 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 0125/1587] 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 bb071597c..7737afa97 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 0126/1587] 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 7737afa97..94664cd73 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 0127/1587] 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 94664cd73..ababc99d9 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 0128/1587] 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 ababc99d9..fc44fffbb 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 0129/1587] 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 0ea63b6a1..b9fbf2174 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 From 344ac6ea2cc41f83ea8b040f98a0a01bfe64077f Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 23 Jun 2013 02:30:26 +0200 Subject: [PATCH 0130/1587] new policies for if, eif, el What about wh(ile)? drop some placeholder comments which don't add (enough) value to keep for patterns used very often. --- README.md | 37 ++++++++++++++++ UltiSnips/coffee.snippets | 2 +- UltiSnips/d.snippets | 2 +- UltiSnips/django.snippets | 2 +- UltiSnips/eruby.snippets | 2 +- UltiSnips/haskell.snippets | 8 ++-- UltiSnips/java.snippets | 2 +- UltiSnips/javascript.snippets | 11 ++++- UltiSnips/ocaml.snippets | 81 ++++++++++++++++------------------- UltiSnips/php.snippets | 22 +++++----- UltiSnips/tcl.snippets | 6 +-- UltiSnips/vim.snippets | 16 +++---- snippets/autoit.snippets | 6 +-- snippets/coffee.snippets | 2 +- snippets/falcon.snippets | 2 +- snippets/htmldjango.snippets | 4 +- snippets/htmltornado.snippets | 4 +- snippets/java.snippets | 2 +- snippets/mako.snippets | 2 +- snippets/perl.snippets | 36 +++++++++------- snippets/php.snippets | 4 +- snippets/puppet.snippets | 2 +- snippets/ruby.snippets | 2 +- snippets/scala.snippets | 6 ++- snippets/tcl.snippets | 18 +++++--- snippets/vim.snippets | 14 ++++-- snippets/zsh.snippets | 2 +- 27 files changed, 177 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index 984cdb646..849d0664e 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,43 @@ of the snippets by setting the "always_use_first_snippet" option to 1. If you have VimL only (vim without python support) your best option is using garbas/vim-snipmate and cope with the minor bugs found in the engine. + +Policies / for contributors +=========================== +some snippets are useful for all languages, so let's try to have the same +triggers for all languages: + +``` +if : if without else +ife: if $1 else $2 +eif : else if ($1) { .. } +el : else .. +``` + +If you're not satisfied with these defaults, open a ticket that we implement +aliasing. Then you can remap "else" to "el" or the like. + + +Don't add stupid placeholder default texts like +``` +if (${1:condition){ + ${2:some code here} +} +``` +instead use: + +``` +if (${1){ + ${2} +} +``` + +Exception: Functions which are used less often, such as Vim's matchall(), matchstr() +functions which case hints may be helpful to remember order. In the VimL case +get vim-dev plugin which has function completion + +Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks + Related repositories ==================== We also encourage people to maintain sets of snippets for particular use cases diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets index bb451aac3..68d40349d 100644 --- a/UltiSnips/coffee.snippets +++ b/UltiSnips/coffee.snippets @@ -22,7 +22,7 @@ else ${3:# body...} endsnippet -snippet elif "Else if" b +snippet eif "Else if" b else if ${1:condition} ${0:# body...} endsnippet diff --git a/UltiSnips/d.snippets b/UltiSnips/d.snippets index 8ed9b4170..94959514a 100644 --- a/UltiSnips/d.snippets +++ b/UltiSnips/d.snippets @@ -126,7 +126,7 @@ else } endsnippet -snippet elif "else if (elif)" b +snippet eif "else if (elif)" b else if(${1:/*condition*/}) { ${VISUAL}${0:/*code*/} diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 59b77c576..553babab9 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -76,7 +76,7 @@ snippet if {% endif %} endsnippet -snippet else +snippet el {% else %} ${1} endsnippet diff --git a/UltiSnips/eruby.snippets b/UltiSnips/eruby.snippets index c6b201eae..88f717911 100644 --- a/UltiSnips/eruby.snippets +++ b/UltiSnips/eruby.snippets @@ -263,7 +263,7 @@ snippet st "submit_tag" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet -snippet else "else (ERB)" +snippet el "else (ERB)" <% else %> endsnippet diff --git a/UltiSnips/haskell.snippets b/UltiSnips/haskell.snippets index eb7b2c62e..99f947f81 100644 --- a/UltiSnips/haskell.snippets +++ b/UltiSnips/haskell.snippets @@ -1,13 +1,13 @@ -snippet if "if ... then ... else ..." +snippet ife "if ... then ... else ..." if ${1:condition} then ${2:expression} else ${3:expression} endsnippet snippet case "case ... of ..." -case ${1:expression} of - ${2:pattern} -> ${3:expression} - ${4:pattern} -> ${5:expression} +case ${1} of + ${2} -> ${3} + ${4} -> ${5} endsnippet snippet :: "Type signature" diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets index 6e1b3ffe3..617c16166 100644 --- a/UltiSnips/java.snippets +++ b/UltiSnips/java.snippets @@ -59,7 +59,7 @@ default: $0 endsnippet -snippet elif "else if" b +snippet eif "else if" b else if ($1)`!p nl(snip)`{ $0 } diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index e4e7f7ab6..7eb18d770 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -50,12 +50,19 @@ function ${1:function_name} (${2:argument}) { } endsnippet +# for one line if .. else you usually use a ? b : c snippet ife "if ___ else" -if (${1:true}) {$0} else{}; +if (${1}) { + {$2} +} else { + {$3} +}; endsnippet snippet if "if" -if (${1:true}) {$0}; +if (${1}) { + {$2} +}; endsnippet snippet timeout "setTimeout function" diff --git a/UltiSnips/ocaml.snippets b/UltiSnips/ocaml.snippets index 8aefef3a0..14926c899 100644 --- a/UltiSnips/ocaml.snippets +++ b/UltiSnips/ocaml.snippets @@ -4,17 +4,17 @@ endsnippet snippet open "open" let open ${1:module} in -${2:e} +${2} endsnippet snippet try "try" -try ${1:e} +try ${1} with ${2:Not_found} -> ${3:()} endsnippet snippet ref "ref" -let ${1:name} = ref ${2:val} in -${3:e} +let ${1} = ref ${2} in +${3} endsnippet snippet matchl "pattern match on a list" @@ -24,88 +24,83 @@ match ${1:list} with endsnippet snippet matcho "pattern match on an option type" -match ${1:x} with -| Some(${2:y}) -> ${3:()} +match ${1} with +| Some(${2}) -> ${3:()} | None -> ${4:()} endsnippet snippet fun "anonymous function" -(fun ${1:x} -> ${2:x}) +(fun ${1} -> ${2}) endsnippet snippet cc "commment" -(* ${1:comment} *) +(* ${1} *) endsnippet snippet let "let .. in binding" -let ${1:x} = ${2:v} in -${3:e} +let ${1} = ${2} in +${3} endsnippet snippet lr "let rec" -let rec ${1:f} = - ${2:expr} +let rec ${1} = + ${2} endsnippet -snippet if "if" -if ${1:(* condition *)} then - ${2:(* A *)} +snippet ife "if" +if ${1} then + ${2} else - ${3:(* B *)} + ${3} endsnippet -snippet If "If" -if ${1:(* condition *)} then - ${2:(* A *)} +snippet if "If" +if ${1} then + ${2} endsnippet snippet while "while" -while ${1:(* condition *)} do - ${2:(* A *)} +while ${1} do + ${2} done endsnippet snippet for "for" for ${1:i} = ${2:1} to ${3:10} do - ${4:(* BODY *)} + ${4} done endsnippet snippet match "match" -match ${1:(* e1 *)} with -| ${2:p} -> ${3:e2} -endsnippet - -snippet Match "match" -match ${1:(* e1 *)} with -| ${2:p} -> ${3:e2} +match ${1} with +| ${2} -> ${3} endsnippet snippet class "class" class ${1:name} = object - ${2:methods} + ${2} end endsnippet snippet obj "obj" object - ${2:methods} + ${2} end endsnippet snippet Obj "object" object (self) - ${2:methods} + ${2} end endsnippet snippet {{ "object functional update" -{< ${1:x} = ${2:y} >} +{< ${1} = ${2} >} endsnippet snippet beg "beg" begin - ${1:block} + ${1}${VISUAL} end endsnippet @@ -115,19 +110,19 @@ endsnippet snippet mod "module - no signature" module ${1:(* Name *)} = struct - ${2:(* BODY *)} + ${2} end endsnippet snippet Mod "module with signature" module ${1:(* Name *)} : ${2:(* SIG *)} = struct - ${3:(* BODY *)} + ${3} end endsnippet snippet sig "anonymous signature" sig - ${2:(* BODY *)} + ${2} end endsnippet @@ -137,32 +132,32 @@ endsnippet snippet func "define functor - no signature" module ${1:M} (${2:Arg} : ${3:ARG}) = struct - ${4:(* BODY *)} + ${4} end endsnippet snippet Func "define functor - with signature" module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct - ${5:(* BODY *)} + ${5} end endsnippet snippet mot "Declare module signature" module type ${1:(* Name *)} = sig - ${2:(* BODY *)} + ${2} end endsnippet snippet module "Module with anonymous signature" module ${1:(* Name *)} : sig - ${2:(* SIGNATURE *)} + ${2} end = struct - ${3:(* BODY *)} + ${3} end endsnippet snippet oo "odoc" -(** ${1:odoc} *) +(** ${1} *) endsnippet snippet qt "inline qtest" diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 40461d293..3245568e0 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -11,8 +11,8 @@ endsnippet snippet do "do" do { - ${2:// code... } -} while (${1:/* condition */});" + ${2} +} while (${1});" endsnippet snippet doc_f "doc_f" @@ -37,21 +37,21 @@ interface ${1:someClass} } // END interface $1" endsnippet -snippet else "else" +snippet el "else" else { - ${1:// code...} + ${1} } endsnippet snippet for "for" for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:// code...} + ${4} } endsnippet snippet foreachk "foreachk" foreach ($${1:variable} as $${2:key} => $${3:value}){ - ${4:// code...} + ${4} } endsnippet @@ -60,8 +60,8 @@ $_GET['${1}']${2} endsnippet snippet if "if" -if (${1:/* condition */}) { - ${2:// code...} +if (${1}) { + ${2} } endsnippet @@ -210,9 +210,9 @@ endsnippet snippet ife "if else" if (${1:/* condition */}) { - ${2:// code...} + ${2} } else { - ${3:// code...} + ${3} } $0 endsnippet @@ -227,7 +227,7 @@ class $1 { public function ${3:__construct}(${4:$options}) { - ${4:// code} + ${4} } } $0 diff --git a/UltiSnips/tcl.snippets b/UltiSnips/tcl.snippets index 2cb1f347d..c5ae37ba2 100644 --- a/UltiSnips/tcl.snippets +++ b/UltiSnips/tcl.snippets @@ -16,14 +16,14 @@ foreach ${1:var} ${2:\$list} { endsnippet snippet if "if... (if)" b -if {${1:condition}} { +if {${1}} { ${2} } endsnippet snippet proc "proc... (proc)" b -proc ${1:name} {${2:args}} \ +proc ${1} {${2}} \ { ${3} } @@ -41,7 +41,7 @@ switch ${1:-exact} -- ${2:\$var} { endsnippet snippet while "while... (while)" b -while {${1:condition}} { +while {${1}} { ${2} } diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets index f4c37f079..5655c4b1b 100644 --- a/UltiSnips/vim.snippets +++ b/UltiSnips/vim.snippets @@ -25,30 +25,30 @@ endsnippet snippet f fun ${1:function_name}(${2}) - ${3:" code} + ${3} endf endsnippet snippet for -for ${1:needle} in ${2:haystack} - ${3:" code} +for ${1} in ${2} + ${3} endfor endsnippet snippet wh -while ${1:condition} - ${2:" code} +while ${1} + ${2} endw endsnippet snippet if -if ${1:condition} - ${2:" code} +if ${1} + ${2} endif endsnippet snippet ife -if ${1:condition} +if ${1} ${2} else ${3} diff --git a/snippets/autoit.snippets b/snippets/autoit.snippets index 690018ce9..c266e339e 100644 --- a/snippets/autoit.snippets +++ b/snippets/autoit.snippets @@ -5,17 +5,17 @@ snippet if snippet el Else ${1} -snippet elif +snippet eif ElseIf ${1:condition} Then ${2:; True code} # If/Else block -snippet ifel +snippet ife If ${1:condition} Then ${2:; True code} Else ${3:; Else code} EndIf -# If/ElseIf/Else block +# If/ElseIf/Else block - because there is eif this is not really neccessary snippet ifelif If ${1:condition 1} Then ${2:; True code} diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index 11c82e7db..21c2cc33e 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -63,7 +63,7 @@ snippet ife else ${3:# body...} # Else if -snippet elif +snippet eif else if ${1:condition} ${2:# body...} # Ternary If diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 3fe4caca7..78257b6e9 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -32,7 +32,7 @@ snippet ife end # If else if -snippet elif +snippet eif elif ${1:condition} ${2} diff --git a/snippets/htmldjango.snippets b/snippets/htmldjango.snippets index 09cf98ecb..4ff5d336d 100644 --- a/snippets/htmldjango.snippets +++ b/snippets/htmldjango.snippets @@ -47,10 +47,10 @@ snippet if {% if ${1} %} ${2} {% endif %} -snippet else +snippet el {% else %} ${1} -snippet elif +snippet eif {% elif ${1} %} ${2} snippet ifchanged diff --git a/snippets/htmltornado.snippets b/snippets/htmltornado.snippets index 9685b1f93..e80499ce9 100644 --- a/snippets/htmltornado.snippets +++ b/snippets/htmltornado.snippets @@ -27,9 +27,9 @@ snippet if {% if ${1:condition} %} ${2} {% end %} -snippet elif +snippet eif {% elif ${1:condition} %} -snippet else +snippet el {% else %} snippet import {% import ${1:module} %} diff --git a/snippets/java.snippets b/snippets/java.snippets index c34010c5b..4dc6ff069 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -72,7 +72,7 @@ snippet def ${2} snippet el else -snippet elif +snippet eif else if (${1}) ${2} snippet if if (${1}) ${2} diff --git a/snippets/mako.snippets b/snippets/mako.snippets index 2a0aef9ce..0f64187fc 100644 --- a/snippets/mako.snippets +++ b/snippets/mako.snippets @@ -22,7 +22,7 @@ snippet if if % if ${1:condition}: ${2:} % endif -snippet if if/else +snippet ife if/else % if ${1:condition}: ${2:} % else: diff --git a/snippets/perl.snippets b/snippets/perl.snippets index ef83e0f5e..cd3f459c8 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -8,31 +8,35 @@ snippet . # Function snippet sub sub ${1:function_name} { - ${2:#body ...} + ${2} } # Conditional snippet if if (${1}) { - ${2:# body...} + ${2} } # Conditional if..else snippet ife if (${1}) { - ${2:# body...} + ${2} } else { - ${3:# else...} + ${3} } # Conditional if..elsif..else snippet ifee if (${1}) { - ${2:# body...} + ${2} } elsif (${3}) { ${4:# elsif...} } else { - ${5:# else...} + ${5} + } +snippet eif + elsif (${1}) { + ${2} } # Conditional One-line snippet xif @@ -40,7 +44,7 @@ snippet xif # Unless conditional snippet unless unless (${1}) { - ${2:# body...} + ${2} } # Unless conditional One-line snippet xunless @@ -57,7 +61,7 @@ snippet eval # While Loop snippet wh while (${1}) { - ${2:# body...} + ${2} } # While Loop One-line snippet xwh @@ -65,7 +69,7 @@ snippet xwh # C-style For Loop snippet cfor for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:# body...} + ${4} } # For loop one-line snippet xfor @@ -73,7 +77,7 @@ snippet xfor # Foreach Loop snippet for foreach my $${1:x} (@${2:array}) { - ${3:# body...} + ${3} } # Foreach Loop One-line snippet fore @@ -127,7 +131,7 @@ snippet switch # Anonymous subroutine snippet asub sub { - ${1:# body } + ${1} } @@ -135,7 +139,7 @@ snippet asub # Begin block snippet begin BEGIN { - ${1:# begin body} + ${1} } # call package function with some parameter @@ -174,7 +178,7 @@ snippet given # switch-like case snippet when when (${1:case}) { - ${2:# body} + ${2} } # hash slice @@ -237,7 +241,7 @@ snippet subpod =cut sub ${1:subroutine_name} { - ${2:# body...} + ${2} } # Subroutine signature snippet parg @@ -318,7 +322,7 @@ snippet trunner snippet tsub sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) { my $self = shift; - ${4:# body} + ${4} } @@ -333,7 +337,7 @@ snippet trsub snippet tprep sub prep${1:number}_${2:test_case} :Test(startup) { my $self = shift; - ${4:# body} + ${4} } # cause failures to print stack trace diff --git a/snippets/php.snippets b/snippets/php.snippets index 97ec3e317..8b071fc1d 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -278,11 +278,11 @@ snippet ifeil ${3:} ${4} -snippet else +snippet el else { ${1} } -snippet elseif +snippet eif elseif (${1:/* condition */}) { ${2} } diff --git a/snippets/puppet.snippets b/snippets/puppet.snippets index 29fe6b37e..b8dbe504c 100644 --- a/snippets/puppet.snippets +++ b/snippets/puppet.snippets @@ -26,7 +26,7 @@ snippet if if $${1:variable} { ${2} } -snippet else +snippet el else { ${1} } diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index b9fbf2174..9813c8e88 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -68,7 +68,7 @@ snippet ife else ${3} end -snippet elsif +snippet eif elsif ${1:condition} ${2} snippet unless diff --git a/snippets/scala.snippets b/snippets/scala.snippets index 9a71ec2c9..e3999f850 100644 --- a/snippets/scala.snippets +++ b/snippets/scala.snippets @@ -15,7 +15,7 @@ snippet ifn ${2} } #if-else -snippet ifel +snippet ife if(${1:obj}) { ${2} } else { @@ -28,6 +28,10 @@ snippet ifelif } else if(${3:obj}) { ${4} } +snippet eif + else if(${3:obj}) { + ${4} + } #while loop snippet while while (${1:obj}) { diff --git a/snippets/tcl.snippets b/snippets/tcl.snippets index 4d456de07..8c0674e4e 100644 --- a/snippets/tcl.snippets +++ b/snippets/tcl.snippets @@ -5,7 +5,7 @@ snippet #! # Process snippet pro proc ${1:function_name} {${2:args}} { - ${3:#body ...} + ${3} } #xif snippet xif @@ -13,19 +13,23 @@ snippet xif # Conditional snippet if if {${1}} { - ${2:# body...} + ${2} } # Conditional if..else snippet ife if {${1}} { - ${2:# body...} + ${2} } else { ${3:# else...} } +snippet eif + elseif {${1}} { + ${2} + } # Conditional if..elsif..else snippet ifee if {${1}} { - ${2:# body...} + ${2} } elseif {${3}} { ${4:# elsif...} } else { @@ -42,17 +46,17 @@ snippet catch # While Loop snippet wh while {${1}} { - ${2:# body...} + ${2} } # For Loop snippet for for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} { - ${4:# body...} + ${4} } # Foreach Loop snippet fore foreach ${1:x} {${2:#list}} { - ${3:# body...} + ${3} } # after ms script... snippet af diff --git a/snippets/vim.snippets b/snippets/vim.snippets index 728c40208..98cb51e35 100644 --- a/snippets/vim.snippets +++ b/snippets/vim.snippets @@ -19,19 +19,25 @@ snippet t ${3} endtry snippet for - for ${1:needle} in ${2:haystack} + for ${1} in ${2} ${3} endfor +snippet forkv + for [a,b] in items({2}) + ${3} + unlet a b + endfor + snippet wh - while ${1:condition} + while ${1} ${2} endw snippet if - if ${1:condition} + if ${1} ${2} endif snippet ife - if ${1:condition} + if ${1} ${2} else ${3} diff --git a/snippets/zsh.snippets b/snippets/zsh.snippets index 367a01ce3..b3fdb8c71 100644 --- a/snippets/zsh.snippets +++ b/snippets/zsh.snippets @@ -12,7 +12,7 @@ snippet ife else ${3:# statements} fi -snippet elif +snippet eif elif ${1:condition} ; then ${2:# statements} snippet for From 673415f2d0670b62597d9e00ade3ad8b06d9e437 Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 23 Jun 2013 14:15:22 +0400 Subject: [PATCH 0131/1587] move accepts_nested_attributes_for to attributes section --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index b9fbf2174..c7cad047b 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 ana + accepts_nested_attributes_for :${1:association} snippet ivc @${1:variable_name} ||= ${2:chached_value} # include Enumerable @@ -1001,5 +1003,3 @@ snippet shared shared_examples "${1:shared examples name}" ${2} snippet itb it_behaves_like "${1:shared examples name}"${2} -snippet ana - accepts_nested_attributes_for :${1:association} From c3403b2daa639370c24841ec62a6b75ead03badc Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 23 Jun 2013 14:18:05 +0400 Subject: [PATCH 0132/1587] make rspec section definiton comment more readable --- snippets/ruby.snippets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index c7cad047b..0b5d49cae 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -947,7 +947,9 @@ snippet tre ${3} snippet tref t.references :${1:model} -#rspec +######################################## +# Rspec snippets - see below # +######################################## snippet it it "${1:spec_name}" do ${2} From e3e7ab1b45dc264c7aa5348a677371f3d83e80ab Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 23 Jun 2013 14:45:32 +0400 Subject: [PATCH 0133/1587] add rspec shoulda matchers snippets --- snippets/ruby.snippets | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0b5d49cae..66c5d1a66 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -1005,3 +1005,62 @@ snippet shared shared_examples "${1:shared examples name}" ${2} snippet itb it_behaves_like "${1:shared examples name}"${2} +#ShouldaMatchers#ActionController +snippet sfp + it { should filter_param :${1:key} } +snippet srt + it { should redirect_to ${1:url} } +snippet srtp + it { should render_template ${1} } +snippet srwl + it { should render_with_layout ${1} } +snippet srf + it { should rescue_from ${1:exception} } +snippet srw + it { should respond_with ${1:status} } +snippet sr + it { should route(:${1:method}, '${2:path}') } +snippet sss + it { should set_session :${1:key} } +snippet ssf + it { should set_the_flash('${1}') } +#ShouldaMatchers#ActiveModel +snippet sama + it { should allow_mass_assignment_of :${1} } +snippet sav + it { should allow_value(${1}) } +snippet see + it { should ensure_exclusion_of :${1} } +snippet sei + it { should ensure_inclusion_of :${1} } +snippet sel + it { should ensure_length_of :${1} } +snippet sva + it { should validate_acceptance_of :${1} } +snippet svc + it { should validate_confirmation_of :${1} } +snippet svn + it { should validate_numericality_of :${1} } +snippet svp + it { should validate_presence_of :${1} } +snippet svu + it { should validate_uniqueness_of :${1} } +#ShouldaMatchers#ActiveRecord +snippet sana + it { should accept_nested_attributes_for :${1} } +snippet sb + it { should belong_to :${1} } +snippet shbtm + it { should have_and_belong_to_many :${1} } +snippet shc + it { should have_db_column :${1} } +snippet shi + it { should have_db_index :${1} } +snippet shm + it { should have_many :${1} } +snippet sho + it { should have_one :${1} } +snippet shroa + it { should have_readonly_attribute :${1} } +snippet ss + it { should serialize :${1} } From 9ffd166a55d4d153c1c27de55789b502c3936dde Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 23 Jun 2013 13:31:33 +0200 Subject: [PATCH 0134/1587] fixes, add link to discussion page --- README.md | 6 ++++++ snippets/ruby.snippets | 2 ++ snippets/vim.snippets | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 849d0664e..ef76dedf4 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,12 @@ get vim-dev plugin which has function completion Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks +Open questions: +What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. ? +What about wh(ile), which trigger? +Discuss at: https://github.com/honza/vim-snippets/issues/230 + + Related repositories ==================== We also encourage people to maintain sets of snippets for particular use cases diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 9813c8e88..7744857ed 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} + +# ivc == instance variable cache snippet ivc @${1:variable_name} ||= ${2:chached_value} # include Enumerable diff --git a/snippets/vim.snippets b/snippets/vim.snippets index 98cb51e35..a92cd136c 100644 --- a/snippets/vim.snippets +++ b/snippets/vim.snippets @@ -23,9 +23,9 @@ snippet for ${3} endfor snippet forkv - for [a,b] in items({2}) - ${3} - unlet a b + for [${1},${2}] in items(${3}) + ${4} + unlet $1 $2 endfor snippet wh From efb571e2c53e5b24fb174fab90b5d1a82d856e39 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 23 Jun 2013 12:52:07 -0300 Subject: [PATCH 0135/1587] Place together ruby on rails migrations snippets --- snippets/ruby.snippets | 106 ++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 59 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index d0e7801c5..f48b4e3e8 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -826,51 +826,6 @@ snippet sweeper expire_page end end -snippet tcb - t.boolean :${1:title} - ${2} -snippet tcbi - t.binary :${1:title}, :limit => ${2:2}.megabytes - ${3} -snippet tcd - t.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2} - ${4} -snippet tcda - t.date :${1:title} - ${2} -snippet tcdt - t.datetime :${1:title} - ${2} -snippet tcf - t.float :${1:title} - ${2} -snippet tch - t.change :${1:name}, :${2:string}, :${3:limit} => ${4:80} - ${5} -snippet tci - t.integer :${1:title} - ${2} -snippet tcl - t.integer :lock_version, :null => false, :default => 0 - ${1} -snippet tcr - t.references :${1:taggable}, :polymorphic => { :default => '${2:Photo}' } - ${3} -snippet tcs - t.string :${1:title} - ${2} -snippet tct - t.text :${1:title} - ${2} -snippet tcti - t.time :${1:title} - ${2} -snippet tcts - t.timestamp :${1:title} - ${2} -snippet tctss - t.timestamps - ${1} snippet va validates_associated validates_associated :${1:attribute} snippet va validates .., :acceptance => true @@ -909,7 +864,9 @@ snippet test test "should ${1:do something}" do ${2} end -#migrations +########################### +# migrations snippets # +########################### snippet mac add_column :${1:table_name}, :${2:column_name}, :${3:data_type} snippet mai @@ -948,20 +905,51 @@ snippet tre ${3} snippet tref t.references :${1:model} -######################################## -# Rspec snippets - see below # -######################################## -snippet it - it "${1:spec_name}" do - ${2} - end -snippet itp - it "${1:spec_name}" +snippet tcb + t.boolean :${1:title} + ${2} +snippet tcbi + t.binary :${1:title}, :limit => ${2:2}.megabytes + ${3} +snippet tcd + t.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2} + ${4} +snippet tcda + t.date :${1:title} + ${2} +snippet tcdt + t.datetime :${1:title} + ${2} +snippet tcf + t.float :${1:title} + ${2} +snippet tch + t.change :${1:name}, :${2:string}, :${3:limit} => ${4:80} + ${5} +snippet tci + t.integer :${1:title} + ${2} +snippet tcl + t.integer :lock_version, :null => false, :default => 0 + ${1} +snippet tcr + t.references :${1:taggable}, :polymorphic => { :default => '${2:Photo}' } + ${3} +snippet tcs + t.string :${1:title} ${2} -snippet its - its(:${1:method}) { should ${2} } -snippet itsn - its(:${1:method}) { should_not ${2} } +snippet tct + t.text :${1:title} + ${2} +snippet tcti + t.time :${1:title} + ${2} +snippet tcts + t.timestamp :${1:title} + ${2} +snippet tctss + t.timestamps + ${1} snippet desc describe ${1:class_name} do ${2} From acb135cfadf55d81d45d8222e540660b9f946aef Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 23 Jun 2013 12:55:53 -0300 Subject: [PATCH 0136/1587] Refactor some ruby rspec/shoulda snippets and add new ones --- snippets/ruby.snippets | 46 ++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index f48b4e3e8..c38c74e0d 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -950,16 +950,17 @@ snippet tcts snippet tctss t.timestamps ${1} +########################## +# Rspec snippets # +########################## snippet desc describe ${1:class_name} do ${2} end snippet descm - describe "#${1:method}" do - pending "Not implemented" + describe "${1:#method}" do + ${2:pending "Not implemented"} end - - ${2} snippet cont context "${1:message}" do ${2} @@ -973,9 +974,9 @@ snippet aft ${2} end snippet let - let(:${1:object}) ${2:block} + let(:${1:object}) ${2} snippet let! - let!(:${1:object}) ${2:block} + let!(:${1:object}) ${2} snippet subj subject { ${1} } snippet s. @@ -986,14 +987,23 @@ 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 - be_false snippet shared - shared_examples "${1:shared examples name}" ${2} + shared_examples ${1:"shared examples name"} snippet itb - it_behaves_like "${1:shared examples name}"${2} + it_behaves_like ${1:"shared examples name"} +snippet it + it "${1:spec_name}" do + ${2} + end +snippet itp + it "${1:spec_name}" + ${2} +snippet its + its(:${1:method}) { should ${2} } +snippet itsh + it { should ${1} } +snippet itsn + it { should_not ${1} } #ShouldaMatchers#ActionController snippet sfp it { should filter_param :${1:key} } @@ -1017,7 +1027,7 @@ snippet ssf snippet sama it { should allow_mass_assignment_of :${1} } snippet sav - it { should allow_value(${1}) } + it { should allow_value(${1}).for :${2} } snippet see it { should ensure_exclusion_of :${1} } snippet sei @@ -1037,19 +1047,25 @@ snippet svu #ShouldaMatchers#ActiveRecord snippet sana it { should accept_nested_attributes_for :${1} } -snippet sb +snippet sbt it { should belong_to :${1} } +snippet sbtcc + it { should belong_to(:${1}).counter_cache ${2:true} } snippet shbtm it { should have_and_belong_to_many :${1} } +snippet sbv + it { should be_valid }${1} snippet shc it { should have_db_column :${1} } snippet shi it { should have_db_index :${1} } snippet shm it { should have_many :${1} } +snippet shmt + it { should have_many(:${1}).through :${2} } snippet sho it { should have_one :${1} } -snippet shroa +snippet shro it { should have_readonly_attribute :${1} } snippet ss it { should serialize :${1} } From 93c19d9899e85583f25224a72f85c925adc6d7d3 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 23 Jun 2013 13:26:47 -0300 Subject: [PATCH 0137/1587] Fix policies explanation for default triggers and some typos --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ef76dedf4..1b623689a 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,8 @@ garbas/vim-snipmate and cope with the minor bugs found in the engine. Policies / for contributors =========================== -some snippets are useful for all languages, so let's try to have the same -triggers for all languages: +Some snippets are useful for almost all languages, so let's try to have the same +triggers for them: ``` if : if without else @@ -69,14 +69,14 @@ aliasing. Then you can remap "else" to "el" or the like. Don't add stupid placeholder default texts like ``` -if (${1:condition){ +if (${1:condition}){ ${2:some code here} } ``` instead use: ``` -if (${1){ +if (${1}){ ${2} } ``` From fa5def93a130715bd02d14c4a6c332045acb6cba Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Sun, 23 Jun 2013 13:27:35 -0300 Subject: [PATCH 0138/1587] Add iurifq to Elixir maintenance and to AUTHORS file --- AUTHORS | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 22a322905..1891f2615 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,6 +10,7 @@ Elliot Murphy Eustaquio Rangel Henrik Nyh Honza Pokorny +Iuri Fernandes Queiroz Jakub Nawalaniec James F. Herdman Jon Bernard diff --git a/README.md b/README.md index 1b623689a..35eac1bc7 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ vim-snippets is not like the "linux kernel". * PHP - [chrisyue](http://github.com/chrisyue) * Scala - [gorodinskiy](https://github.com/gorodinskiy) * Falcon - [steveno](https://github.com/steveno) +* Elixir - [iurifq](https://github.com/iurifq) Contributing notes ------------------ From a8d936b0e8e5fd97c95622e4e6ed00a9b628e092 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Tue, 25 Jun 2013 21:40:02 -0300 Subject: [PATCH 0139/1587] Add snippet for do to elixir snippets --- snippets/elixir.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index 9c562adda..50243a705 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -1,3 +1,7 @@ +snippet do + do + ${1} + end snippet if if .. do .. end if ${1} do ${2} From 9ab873b6eaa228d3b5ed0a6641bd812a4030d18b Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 26 Jun 2013 09:48:50 +0800 Subject: [PATCH 0140/1587] A docstring C change img/inc/fig snippet into id U update em/st with CJK detection --- UltiSnips/rst.snippets | 120 ++++++++++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 43 deletions(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index cdc2a7791..f65031890 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -4,6 +4,7 @@ # General Stuff # ########################################################################### global !p +import vim from os import path as ospath from string import Template import re @@ -29,17 +30,32 @@ DIRECTIVES = ['topic','sidebar','math','epigraph', 'raw'] NONE_CONTENT_DIRECTIVES = ['rubric', 'contents', 'header', - 'footer', 'date', 'include', 'title' - ] -INCLUDABLE_DIRECTIVES_INDEX = {'img':'image', - 'fig':'figure', - 'inc':'include'} + 'footer', 'date', 'include', 'title'] + +INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include'] +# CJK chars +# http://stackoverflow.com/questions/2718196/find-all-chinese-text-in-a-string-using-python-and-regex +CJK_RE = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.UNICODE) + + +def has_cjk(char): + """ + Detect char contains CJK character + + :param char: characters needs to be detect + """ + try: + CJK_RE.finditer(char).next() + except StopIteration: + return False + else: + return True def real_filename(filename): - # peal extension name off if possible + """peal extension name off if possible # i.e. "foo.bar.png will return "foo.bar" - names=filename.split('.') - return ".".join(names[:-1]) if len(names) > 1 else filename + """ + return ospath.splitext(filename)[0] def check_file_exist(rst_path, relative_path): """ @@ -53,8 +69,6 @@ def check_file_exist(rst_path, relative_path): if ospath.isfile(abs_path): return abs_path -#TODO: File preview -#TODO: File list complete def rst_char_len(char): """ @@ -91,23 +105,40 @@ def look_up_directives(regex, fpath): :return: list, empty list if nothing match """ - with open(fpath) as source: - match = re.findall(regex, source.read()) + try: + with open(fpath) as source: + match = re.findall(regex, source.read()) + except IOError: + match = [] return match -def get_popular_code_type(path): - # find most popular code type in the given rst - types = look_up_directives(r'[:|\.\.\s]code::?\s(\w+)', path) +def get_popular_code_type(): + """ + find most popular code type in the given rst + + :param path: file to detect + + :return: string, most popular code type in file + """ + buf = "".join(vim.current.buffer) + types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', buf) try: popular_type = Counter(types).most_common()[0][0] except IndexError: popular_type = "lua" # Don't break default - return popular_type def complete(t, opts): + """ + get options that start with t + + :param t: query string + :param opts: list that needs to be completed + + :return: a string that start with t + """ msg = "({0})" if t: opts = [ m[len(t):] for m in opts if m.startswith(t) ] @@ -165,22 +196,26 @@ $0 endsnippet snippet em "Emphasize string" i -*${1:${VISUAL:Em}}* $0 -endsnippet - -# the CJK characters doesn't had space to sperate them, like "我强调" -# should be "我\ *强调*\ " -# Therefor we need special snippet -snippet ec "Emphasize string (CJK)" w -\ *${1:${VISUAL:Em}}*\ $0 +`!p +# dirty but works with CJK charactor detection +if has_cjk(vim.current.line): + snip.rv ="\ "`*${1:${VISUAL:Em}}*`!p +if has_cjk(vim.current.line): + snip.rv ="\ " +else: + snip.rv = " " +`$0 endsnippet snippet st "Strong string" i -**${1:${VISUAL:Strong}}** $0 -endsnippet - -snippet sc "Strong string (CJK)" w -\ **${1:${VISUAL:Strong}}**\ $0 +`!p +if has_cjk(vim.current.line): + snip.rv ="\ "`**${1:${VISUAL:Strong}}**`!p +if has_cjk(vim.current.line): + snip.rv ="\ " +else: + snip.rv = " " +`$0 endsnippet snippet "li(st)? (?P\d+)" "List" br @@ -201,7 +236,7 @@ endsnippet # More Specialized Stuff. # ########################################################################### snippet cb "Code Block" b -.. code-block:: ${1:`!p snip.rv = get_popular_code_type(path)`} +.. code-block:: ${1:`!p snip.rv = get_popular_code_type()`} ${2:code} @@ -210,29 +245,28 @@ endsnippet # match snippets : # img, inc, fig -snippet "(?P^img|inc|fig)" "Includable Block" !br +snippet id "Includable Directives" b `!p -#TODO: Import img.template in rst relative path? -real_name=real_filename(ospath.basename(t[1])) -di=INCLUDABLE_DIRECTIVES_INDEX.get(match.groupdict()['shortcut'], 'include') +real_name=real_filename(ospath.basename(t[2])) +di=t[1][:2] + link="" content="" -if di in ['image']: - link = "|{0}| ".format(real_name) +if di == 'im': + link = "|{0}|".format(real_name) -if di == 'figure': +if di == 'fi': content=""" :alt: {0} {0}""".format(real_name) - -snip.rv = ".. {link}{di}:: ".format(di=di,link=link) -`${1:file}`!p if content: +` +..`!p snip.rv = " %s" % link if link else ""` $1`!p snip.rv=complete(t[1], INCLUDABLE_DIRECTIVES)`:: ${2:file}`!p if content: snip.rv +=" "+content` `!p # Tip of whether file is exist in comment type -if not check_file_exist(path, t[1]): - snip.rv='.. FILE {0} does not exist'.format(t[1]) +if not check_file_exist(path, t[2]): + snip.rv='.. FILE {0} does not exist'.format(t[2]) else: snip.rv="" `$0 @@ -259,7 +293,7 @@ $0 endsnippet #it will be trigger at start of line or after a word -snippet ro "Text Roles" b +snippet ro "Text Roles" w \ :$1`!p snip.rv=complete(t[1], TEXT_ROLES+look_up_directives(TEXT_ROLES_REGEX, path))`:\`$2\`\ From 92eb5c6363ef929477fc4b3c5ae7292c6b98da4d Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 26 Jun 2013 13:57:08 +0800 Subject: [PATCH 0141/1587] CMT update li comment --- UltiSnips/rst.snippets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index f65031890..88e0caafb 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -221,14 +221,17 @@ endsnippet snippet "li(st)? (?P\d+)" "List" br $0 `!p +# usage: li 4 +# which will extand into a unordered list contains 4 items snip.rv = make_items(match.groupdict()['num']) ` endsnippet -# usage: ol 3 snippet "ol(st)? (?P\d+)" "Order List" br $0 `!p +# usage: ol 4 +# which will extand into a ordered list contains 4 items snip.rv = make_items(match.groupdict()['num'], 1) ` endsnippet From 17b4633bdc53156f4303bd99ad898756c069ab07 Mon Sep 17 00:00:00 2001 From: Tobie Warburton Date: Wed, 26 Jun 2013 10:42:22 +0100 Subject: [PATCH 0142/1587] added __unicode__ python snippet --- snippets/python.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index fcce99fec..7007a99b1 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -2,6 +2,9 @@ snippet #! #!/usr/bin/env python snippet imp import ${1:module} +snippet uni + def __unicode__(self): + ${1:representation} snippet from from ${1:package} import ${2:module} # Module Docstring @@ -13,6 +16,7 @@ snippet docs Github: `g:snips_github` Description: ${2} """ + snippet wh while ${1:condition}: ${2} From dc336dcd497991c00fb5a6f35eed0213687cc310 Mon Sep 17 00:00:00 2001 From: aisensiy Date: Thu, 27 Jun 2013 16:00:14 +0800 Subject: [PATCH 0143/1587] ruby test assert_diff with a chance to set value --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index c38c74e0d..2c9344822 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -596,8 +596,8 @@ snippet artp snippet artpp assert_redirected_to ${1:model}s_path snippet asd - assert_difference "${1:Model}.${2:count}", $1 do - ${3} + assert_difference "${1:Model}.${2:count}", ${3:1} do + ${4} end snippet asnd assert_no_difference "${1:Model}.${2:count}" do From 9573b83de48300ce3fba0c34ea3817e61065383b Mon Sep 17 00:00:00 2001 From: Vladimir Rybas Date: Sat, 29 Jun 2013 08:42:22 +0700 Subject: [PATCH 0144/1587] Duplicated Ruby snippet `sel` --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 2c9344822..cc2addcae 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -1032,7 +1032,7 @@ snippet see it { should ensure_exclusion_of :${1} } snippet sei it { should ensure_inclusion_of :${1} } -snippet sel +snippet itsel it { should ensure_length_of :${1} } snippet sva it { should validate_acceptance_of :${1} } From 6fbe9913f23f276fde87c2ba19b43e7946aea8ac Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sat, 29 Jun 2013 17:35:56 +0400 Subject: [PATCH 0145/1587] refactor (ruby.snippet) new pattern for rspec snippets --- snippets/ruby.snippets | 71 ++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index cc2addcae..8734d8079 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -989,83 +989,80 @@ snippet raise expect { ${1:object} }.to raise_error ${2:StandardError}, /${3:message_regex}/ snippet shared shared_examples ${1:"shared examples name"} -snippet itb +snippet ibl it_behaves_like ${1:"shared examples name"} snippet it it "${1:spec_name}" do ${2} end -snippet itp - it "${1:spec_name}" - ${2} snippet its its(:${1:method}) { should ${2} } -snippet itsh +snippet is it { should ${1} } -snippet itsn +snippet isn it { should_not ${1} } #ShouldaMatchers#ActionController -snippet sfp +snippet isfp it { should filter_param :${1:key} } -snippet srt +snippet isrt it { should redirect_to ${1:url} } -snippet srtp +snippet isrtp it { should render_template ${1} } -snippet srwl +snippet isrwl it { should render_with_layout ${1} } -snippet srf +snippet isrf it { should rescue_from ${1:exception} } -snippet srw +snippet isrw it { should respond_with ${1:status} } -snippet sr +snippet isr it { should route(:${1:method}, '${2:path}') } -snippet sss +snippet isss it { should set_session :${1:key} } -snippet ssf +snippet issf it { should set_the_flash('${1}') } #ShouldaMatchers#ActiveModel -snippet sama +snippet isama it { should allow_mass_assignment_of :${1} } -snippet sav +snippet isav it { should allow_value(${1}).for :${2} } -snippet see +snippet isee it { should ensure_exclusion_of :${1} } -snippet sei +snippet isei it { should ensure_inclusion_of :${1} } -snippet itsel +snippet isel it { should ensure_length_of :${1} } -snippet sva +snippet isva it { should validate_acceptance_of :${1} } -snippet svc +snippet isvc it { should validate_confirmation_of :${1} } -snippet svn +snippet isvn it { should validate_numericality_of :${1} } -snippet svp +snippet isvp it { should validate_presence_of :${1} } -snippet svu +snippet isvu it { should validate_uniqueness_of :${1} } #ShouldaMatchers#ActiveRecord -snippet sana +snippet isana it { should accept_nested_attributes_for :${1} } -snippet sbt +snippet isbt it { should belong_to :${1} } -snippet sbtcc +snippet isbtcc it { should belong_to(:${1}).counter_cache ${2:true} } -snippet shbtm +snippet ishbtm it { should have_and_belong_to_many :${1} } -snippet sbv +snippet isbv it { should be_valid }${1} -snippet shc +snippet ishc it { should have_db_column :${1} } -snippet shi +snippet ishi it { should have_db_index :${1} } -snippet shm +snippet ishm it { should have_many :${1} } -snippet shmt +snippet ishmt it { should have_many(:${1}).through :${2} } -snippet sho +snippet isho it { should have_one :${1} } -snippet shro +snippet ishro it { should have_readonly_attribute :${1} } -snippet ss +snippet iss it { should serialize :${1} } From 8e678bd9037f2ad6bfa50d5002f74ab33377d179 Mon Sep 17 00:00:00 2001 From: Matt Stevens Date: Wed, 3 Jul 2013 12:17:40 +0100 Subject: [PATCH 0146/1587] Add snippet for pudb in Python --- AUTHORS | 1 + snippets/python.snippets | 3 +++ 2 files changed, 4 insertions(+) diff --git a/AUTHORS b/AUTHORS index 1891f2615..c5c68c6a7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,6 +39,7 @@ Dmitry Dementev Travis Holton Chrisyue Erik Westrup +Matt Deacalion Stevens TODO: add contributors from github.com/SirVer/Ultisnip having contributed to github.com/SirVer/Ultisnip/UltiSnips/* files diff --git a/snippets/python.snippets b/snippets/python.snippets index 7007a99b1..e8dade287 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -131,6 +131,9 @@ snippet ipdb # ipython debugger (pdbbb) snippet pdbbb import pdbpp; pdbpp.set_trace() +# python console debugger (pudb) +snippet pudb + import pudb; pudb.set_trace() snippet pprint import pprint; pprint.pprint(${1})${2} snippet " From 3f956a0f48c59e20ea84ef01a5b81ea2cf1c75b9 Mon Sep 17 00:00:00 2001 From: Iuri Fernandes Date: Fri, 5 Jul 2013 11:15:59 -0300 Subject: [PATCH 0147/1587] Add ruby snippets for "it { should respond_to :method }" --- snippets/ruby.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 8734d8079..1d344ac56 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -1066,3 +1066,7 @@ snippet ishro it { should have_readonly_attribute :${1} } snippet iss it { should serialize :${1} } +snippet isres + it { should respond_to :${1} } +snippet isresw + it { should respond_to(:${1}).with(${2}).arguments } From a1d8992489328bb4d07bef059722c96f705b8687 Mon Sep 17 00:00:00 2001 From: kenshin54 Date: Sat, 6 Jul 2013 22:17:27 +0800 Subject: [PATCH 0148/1587] Add inline if snippet to c. --- snippets/c.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/c.snippets b/snippets/c.snippets index 21c265d68..16a86e990 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -65,6 +65,9 @@ snippet elif else if (${1:/* condition */}) { ${2} }${3} +# ifi +snippet ifi + if (${1:/* condition */}) ${2};${3} # ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b} From 80697bea6feb83c870a4fa5798e897d4561900f3 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 8 Jul 2013 03:41:11 +0200 Subject: [PATCH 0149/1587] replace Filename by vim_snippets#Filename and document it It doesn't make sense that all snippet engines have to keep this function somewhere --- UltiSnips/d.snippets | 2 +- autoload/vim_snippets.vim | 27 +++++++++++++++++++++++++++ snippets/c.snippets | 8 ++++---- snippets/coffee.snippets | 8 ++++---- snippets/cpp.snippets | 6 +++--- snippets/cs.snippets | 24 ++++++++++++------------ snippets/dart.snippets | 4 ++-- snippets/erlang.snippets | 8 ++++---- snippets/html.snippets | 6 +++--- snippets/java.snippets | 8 ++++---- snippets/objc.snippets | 18 +++++++++--------- snippets/perl.snippets | 4 ++-- snippets/php.snippets | 14 +++++++------- snippets/puppet.snippets | 4 ++-- snippets/python.snippets | 2 +- snippets/ruby.snippets | 20 +++++++++++--------- snippets/vim.snippets | 2 +- 17 files changed, 97 insertions(+), 68 deletions(-) create mode 100644 autoload/vim_snippets.vim diff --git a/UltiSnips/d.snippets b/UltiSnips/d.snippets index 94959514a..7f38c6d8d 100644 --- a/UltiSnips/d.snippets +++ b/UltiSnips/d.snippets @@ -576,7 +576,7 @@ snippet module "New module (module)" b // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -module ${2}.`!v Filename('$1', 'name')`; +module ${2}.`!v vim_snippets#Filename('$1', 'name')`; ${3} diff --git a/autoload/vim_snippets.vim b/autoload/vim_snippets.vim new file mode 100644 index 000000000..061f171e7 --- /dev/null +++ b/autoload/vim_snippets.vim @@ -0,0 +1,27 @@ +" this is well known Filename found in snipmate (and the other engines), but +" rewritten and documented :) +" +" optional arg1: string in which to replace '$1' by filename with extension +" and path dropped. Defaults to $1 +" optional arg2: return this value if buffer has no filename +" But why not use the template in this case, too? +" Doesn't make sense to me +fun! vim_snippets#Filename(...) + let template = get(a:000, 0, "$1") + let arg2 = get(a:000, 1, "") + + let basename = expand('%:t:r') + + if basename == '' + return arg2 + else + return substitute(template, '$1', basename, 'g') + endif +endf + +" original code: +" fun! Filename(...) +" let filename = expand('%:t:r') +" if filename == '' | return a:0 == 2 ? a:2 : '' | endif +" return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g') +" endf diff --git a/snippets/c.snippets b/snippets/c.snippets index 16a86e990..757802438 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -20,7 +20,7 @@ snippet inc #include <${1:stdio}.h>${2} # #include "..." snippet Inc - #include "${1:`Filename("$1.h")`}"${2} + #include "${1:`vim_snippets#Filename("$1.h")`}"${2} # ifndef...define...endif snippet ndef #ifndef $1 @@ -41,7 +41,7 @@ snippet #if #endif # header include guard snippet once - #ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`} + #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} #define $1 @@ -132,14 +132,14 @@ snippet td typedef ${1:int} ${2:MyCustomType};${3} # struct snippet st - struct ${1:`Filename('$1_t', 'name')`} { + struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { ${2:/* data */} }${3: /* optional variable list */};${4} # typedef struct snippet tds typedef struct ${2:_$1 }{ ${3:/* data */} - } ${1:`Filename('$1_t', 'name')`};${4} + } ${1:`vim_snippets#Filename('$1_t', 'name')`};${4} # typedef enum snippet tde typedef enum { diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index 21c2cc33e..8e2f20e0b 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -35,19 +35,19 @@ snippet bfun ${2:# body...} # Class snippet cla class .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} ${2} snippet cla class .. constructor: .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} constructor: (${2:args}) -> ${3} ${4} snippet cla class .. extends .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} ${3} snippet cla class .. extends .. constructor: .. - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} constructor: (${3:args}) -> ${4} diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 52148e786..e95d35342 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -68,7 +68,7 @@ snippet mu ## Class # class snippet cl - class ${1:`Filename('$1', 'name')`} + class ${1:`vim_snippets#Filename('$1', 'name')`} { public: $1(${2}); @@ -79,12 +79,12 @@ snippet cl }; # member function implementation snippet mfun - ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { + ${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { ${5} } # namespace snippet ns - namespace ${1:`Filename('', 'my')`} { + namespace ${1:`vim_snippets#Filename('', 'my')`} { ${2} } /* namespace $1 */ ## diff --git a/snippets/cs.snippets b/snippets/cs.snippets index d93435141..9a915f094 100644 --- a/snippets/cs.snippets +++ b/snippets/cs.snippets @@ -116,49 +116,49 @@ snippet each } # interfaces snippet interface - public interface ${1:`Filename()`} { + public interface ${1:`vim_snippets#Filename()`} { ${2} } snippet if+ - public interface ${1:`Filename()`} { + public interface ${1:`vim_snippets#Filename()`} { ${2} } # class bodies snippet class - public class ${1:`Filename()`} { + public class ${1:`vim_snippets#Filename()`} { ${2} } snippet cls - ${2:public} class ${1:`Filename()`} { + ${2:public} class ${1:`vim_snippets#Filename()`} { ${3} } snippet cls+ - public class ${1:`Filename()`} { + public class ${1:`vim_snippets#Filename()`} { ${2} } snippet cls+^ - public static class ${1:`Filename()`} { + public static class ${1:`vim_snippets#Filename()`} { ${2} } snippet cls& - internal class ${1:`Filename()`} { + internal class ${1:`vim_snippets#Filename()`} { ${2} } snippet cls&^ - internal static class ${1:`Filename()`} { + internal static class ${1:`vim_snippets#Filename()`} { ${2} } snippet cls| - protected class ${1:`Filename()`} { + protected class ${1:`vim_snippets#Filename()`} { ${2} } snippet cls|% - protected abstract class ${1:`Filename()`} { + protected abstract class ${1:`vim_snippets#Filename()`} { ${2} } # constructor snippet ctor - public ${1:`Filename()`}() { + public ${1:`vim_snippets#Filename()`}() { ${2} } # properties - auto properties by default. @@ -342,7 +342,7 @@ snippet ms- } # structure snippet struct - public struct ${1:`Filename()`} { + public struct ${1:`vim_snippets#Filename()`} { ${2} } # enumeration diff --git a/snippets/dart.snippets b/snippets/dart.snippets index c7b56daf6..a74520022 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -22,9 +22,9 @@ snippet br snippet th throw ${1} snippet cl - class ${1:`Filename("", "untitled")`} ${2} + class ${1:`vim_snippets#Filename("", "untitled")`} ${2} snippet in - interface ${1:`Filename("", "untitled")`} ${2} + interface ${1:`vim_snippets#Filename("", "untitled")`} ${2} snippet imp implements ${1} snippet ext diff --git a/snippets/erlang.snippets b/snippets/erlang.snippets index 1199e8443..0837bb7cc 100644 --- a/snippets/erlang.snippets +++ b/snippets/erlang.snippets @@ -1,6 +1,6 @@ # module and export all snippet mod - -module(${1:`Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename('', 'my')`}). -compile([export_all]). @@ -66,7 +66,7 @@ snippet %p %% @private # OTP application snippet application - -module(${1:`Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename('', 'my')`}). -behaviour(application). @@ -84,7 +84,7 @@ snippet application ok. # OTP supervisor snippet supervisor - -module(${1:`Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename('', 'my')`}). -behaviour(supervisor). @@ -107,7 +107,7 @@ snippet supervisor {ok, {RestartStrategy, Children}}. # OTP gen_server snippet gen_server - -module(${1:`Filename('', 'my')`}). + -module(${1:`vim_snippets#Filename('', 'my')`}). -behaviour(gen_server). diff --git a/snippets/html.snippets b/snippets/html.snippets index 3615d4bed..a83089c81 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -412,7 +412,7 @@ snippet head - ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2} snippet header @@ -450,7 +450,7 @@ snippet html5 - ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:meta} @@ -795,7 +795,7 @@ snippet thead snippet time snippet title - ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} snippet tr ${1} diff --git a/snippets/java.snippets b/snippets/java.snippets index 4dc6ff069..a36e0f158 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -39,11 +39,11 @@ snippet j.u ## ## Class snippet cl - class ${1:`Filename("", "untitled")`} ${2} + class ${1:`vim_snippets#Filename("", "untitled")`} ${2} snippet in - interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3} + interface ${1:`vim_snippets#Filename("", "untitled")`} ${2:extends Parent}${3} snippet tc - public class ${1:`Filename()`} extends ${2:TestCase} + public class ${1:`vim_snippets#Filename()`} extends ${2:TestCase} ## ## Class Enhancements snippet ext @@ -144,7 +144,7 @@ snippet @au snippet @br @brief ${1:Description} snippet @fi - @file ${1:`Filename()`}.java + @file ${1:`vim_snippets#Filename()`}.java snippet @pa @param ${1:param} snippet @re diff --git a/snippets/objc.snippets b/snippets/objc.snippets index 3cf5a0a6d..c819c776a 100644 --- a/snippets/objc.snippets +++ b/snippets/objc.snippets @@ -3,7 +3,7 @@ snippet Imp #import <${1:Cocoa/Cocoa.h}>${2} # #import "..." snippet imp - #import "${1:`Filename()`.h}"${2} + #import "${1:`vim_snippets#Filename()`.h}"${2} # @selector(...) snippet sel @selector(${1:method}:)${3} @@ -18,7 +18,7 @@ snippet log NSLog(@"${1:%@}"${2});${3} # Class snippet objc - @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} + @interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject} { } @end @@ -28,33 +28,33 @@ snippet objc @end # Class Interface snippet int - @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} + @interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject} {${3} } ${4} @end snippet @interface - @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} + @interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject} {${3} } ${4} @end # Class Implementation snippet impl - @implementation ${1:`Filename('', 'someClass')`} + @implementation ${1:`vim_snippets#Filename('', 'someClass')`} ${2} @end snippet @implementation - @implementation ${1:`Filename('', 'someClass')`} + @implementation ${1:`vim_snippets#Filename('', 'someClass')`} ${2} @end # Protocol snippet pro - @protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:} + @protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:} ${3} @end snippet @protocol - @protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:} + @protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:} ${3} @end # init Definition @@ -87,7 +87,7 @@ snippet cat @end # Category Interface snippet cath - @interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory}) + @interface ${1:`vim_snippets#Filename('$1', 'NSObject')`} (${2:MyCategory}) ${3} @end # Method diff --git a/snippets/perl.snippets b/snippets/perl.snippets index cd3f459c8..48d3f2266 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -84,7 +84,7 @@ snippet fore ${1:expression} foreach @${2:array};${3} # Package snippet package - package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}; + package ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}; ${2} @@ -93,7 +93,7 @@ snippet package __END__ # Package syntax perl >= 5.14 snippet packagev514 - package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99}; + package ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99}; ${3} diff --git a/snippets/php.snippets b/snippets/php.snippets index 8b071fc1d..b85d96e6c 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -28,12 +28,12 @@ snippet use use ${1:Foo\Bar\Baz}; ${2} snippet c - class ${1:`Filename()`} + class ${1:`vim_snippets#Filename()`} { ${2} } snippet i - interface ${1:`Filename()`} + interface ${1:`vim_snippets#Filename()`} { ${2} } @@ -57,7 +57,7 @@ snippet sm * * @param ${2:$1} $$1 ${3:description} * - * @return ${4:`Filename()`} + * @return ${4:`vim_snippets#Filename()`} */ ${5:public} function set${6:$2}(${7:$2 }$$1) { @@ -214,7 +214,7 @@ snippet interface * @package ${3:default} * @author ${4:`g:snips_author`} */ - interface ${1:`Filename()`} + interface ${1:`vim_snippets#Filename()`} { ${5} } @@ -223,7 +223,7 @@ snippet class /** * ${1} */ - class ${2:`Filename()`} + class ${2:`vim_snippets#Filename()`} { ${3} /** @@ -237,7 +237,7 @@ snippet class snippet nc namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`}; - ${2:abstract }class ${3:`Filename()`} + ${2:abstract }class ${3:`vim_snippets#Filename()`} { ${4} } @@ -366,7 +366,7 @@ snippet gs * * @param $2 $$1 ${5:description} * - * @return ${6:`Filename()`} + * @return ${6:`vim_snippets#Filename()`} */ public function set$3(${7:$2 }$$1) { diff --git a/snippets/puppet.snippets b/snippets/puppet.snippets index b8dbe504c..e95b9c7ae 100644 --- a/snippets/puppet.snippets +++ b/snippets/puppet.snippets @@ -5,11 +5,11 @@ # Language Constructs snippet class - class ${1:`Filename('', 'name')`} { + class ${1:`vim_snippets#Filename('', 'name')`} { ${2} } snippet node - node "${1:`Filename('', 'fqdn')`}" { + node "${1:`vim_snippets#Filename('', 'fqdn')`}" { ${2} } snippet case diff --git a/snippets/python.snippets b/snippets/python.snippets index e8dade287..d8544cd17 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -10,7 +10,7 @@ snippet from # Module Docstring snippet docs """ - File: ${1:`Filename('$1.py', 'foo.py')`} + File: ${1:`vim_snippets#Filename('$1.py', 'foo.py')`} Author: `g:snips_author` Email: `g:snips_email` Github: `g:snips_github` diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 1d344ac56..9c994794f 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -88,23 +88,23 @@ snippet until ${2} end snippet cla class .. end - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} ${2} end snippet cla class .. initialize .. end - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} def initialize(${2:args}) ${3} end end snippet cla class .. < ParentClass .. initialize .. end - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass} + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass} def initialize(${3:args}) ${4} end end snippet cla ClassName = Struct .. do .. end - ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do + ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do def ${3:method_name} ${4} end @@ -119,7 +119,7 @@ snippet cla class << self .. end end # class .. < DelegateClass .. initialize .. end snippet cla- - class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass}) + class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass}) def initialize(${3:args}) super(${4:del_obj}) @@ -127,17 +127,17 @@ snippet cla- end end snippet mod module .. end - module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} ${2} end snippet mod module .. module_function .. end - module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} module_function ${2} end snippet mod module .. ClassMethods .. end - module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} module ClassMethods ${2} end @@ -553,7 +553,7 @@ snippet clafn snippet sinc class << self; self end snippet nam - namespace :${1:`Filename()`} do + namespace :${1:`vim_snippets#Filename()`} do ${2} end snippet tas @@ -1070,3 +1070,5 @@ snippet isres it { should respond_to :${1} } snippet isresw it { should respond_to(:${1}).with(${2}).arguments } +snippet super_call + ${1:super_class}.instance_method(:${2:method}).bind(self).call diff --git a/snippets/vim.snippets b/snippets/vim.snippets index a92cd136c..6dd502ff8 100644 --- a/snippets/vim.snippets +++ b/snippets/vim.snippets @@ -4,7 +4,7 @@ snippet header " Description: ${3} ${4:" Last Modified: `strftime("%B %d, %Y")`} snippet guard - if exists('${1:did_`Filename()`}') || &cp${2: || version < 700} + if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} finish endif let $1 = 1${3} From 533fe487a1f7af9cbbf13db27dc75f501a13ce79 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 8 Jul 2013 23:44:03 +0200 Subject: [PATCH 0150/1587] ruby snippets: use do dov for both engines drop #TODO comments changing defaults is bad, but I expect ruby folks to expect do to type do .. doo has the advantage to get a completion popup .. but its too long to type The UtiSnips do snippet didn't make sense: the nested placeholder still didn't remove the space after the "do" when deleting it - so it was written badly. Could be fixed, by why bother? Thus learn do and dov and be happy forever. Would Do be a better choice (upper case chars?) Don't know. This was used by UltiSnips. Comment on this commit if you don't like this choice. --- UltiSnips/ruby.snippets | 116 ++++++++++++++++++++-------------------- snippets/ruby.snippets | 10 ++-- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/UltiSnips/ruby.snippets b/UltiSnips/ruby.snippets index 63365890d..306c7e10d 100644 --- a/UltiSnips/ruby.snippets +++ b/UltiSnips/ruby.snippets @@ -25,7 +25,7 @@ endsnippet snippet if "if ... end" if ${1:condition} - ${2:# TODO} + ${2} end endsnippet @@ -33,9 +33,9 @@ endsnippet snippet ife "if ... else ... end" if ${1:condition} - ${2:# TODO} + ${2} else - ${3:# TODO} + ${3} end endsnippet @@ -43,11 +43,11 @@ endsnippet snippet ifee "if ... elseif ... else ... end" if ${1:condition} - ${2:# TODO} + ${2} elsif ${3:condition} - ${4:# TODO} + ${4} else - ${0:# TODO} + ${0} end endsnippet @@ -55,7 +55,7 @@ endsnippet snippet unless "unless ... end" unless ${1:condition} - ${0:# TODO} + ${0} end endsnippet @@ -63,9 +63,9 @@ endsnippet snippet unlesse "unless ... else ... end" unless ${1:condition} - ${2:# TODO} + ${2} else - ${0:# TODO} + ${0} end endsnippet @@ -73,11 +73,11 @@ endsnippet snippet unlesee "unless ... elseif ... else ... end" unless ${1:condition} - ${2:# TODO} + ${2} elsif ${3:condition} - ${4:# TODO} + ${4} else - ${0:# TODO} + ${0} end endsnippet @@ -85,7 +85,7 @@ endsnippet snippet "\b(de)?f" "def ..." r def ${1:function_name}${2: ${3:*args}} - ${0:# TODO} + ${0} end endsnippet @@ -93,7 +93,7 @@ endsnippet snippet defi "def initialize ..." def initialize${1: ${2:*args}} - ${0:# TODO} + ${0} end endsnippet @@ -101,23 +101,23 @@ endsnippet snippet defr "def ... rescue ..." def ${1:function_name}${2: ${3:*args}} - ${4:# TODO} + ${4} rescue - ${0:# TODO} + ${0} end endsnippet snippet For "(..).each { || }" -(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} } +(${1:from}..${2:to}).each { |${3:i}| ${4} } endsnippet snippet for "(..).each do || end" (${1:from}..${2:to}).each do |${3:i}| - ${0:# TODO} + ${0} end endsnippet @@ -138,42 +138,42 @@ endsnippet snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |,| }" r -`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.del(ete)?_?if" ".delete_if do |,| end" r `!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Keep_?if" ".keep_if { |,| }" r -`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.keep_?if" ".keep_if do ,| end" r `!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Reject" ".reject { |,| }" r -`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.reject" ".reject do ,| end" r `!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet @@ -194,56 +194,56 @@ endsnippet snippet "(\S+)\.Sort" ".sort { |,| }" r -`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3} } endsnippet snippet "(\S+)\.sort" ".sort do |,| end" r `!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Each_?k(ey)?" ".each_key { || }" r -`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} } +`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2} } endsnippet snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| end" r `!p snip.rv=match.group(1)`.each_key do |${1:key}| - ${0:# TODO} + ${0} end endsnippet snippet "(\S+)\.Each_?val(ue)?" ".each_value { || }" r -`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} } +`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2} } endsnippet snippet "(\S+)\.each_?val(ue)?" ".each_value do || end" r `!p snip.rv=match.group(1)`.each_value do |${1:value}| - ${0:# TODO} + ${0} end endsnippet snippet Each ".each { || }" -${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} } +${1:elements}.each { |${2:${1/s$//}}| ${3} } endsnippet snippet each ".each do || end" ${1:elements}.each do |${2:${1/s$//}}| - ${0:# TODO} + ${0} end endsnippet @@ -251,14 +251,14 @@ endsnippet snippet each_?s(lice)? ".each_slice(n) do |slice| end" each_slice(${1:2}) do |${2:slice}| - ${0:# TODO} + ${0} end endsnippet snippet Each_?s(lice)? ".each_slice(n) { |slice| }" -each_slice(${1:2}) { |${2:slice}| ${3:# TODO} } +each_slice(${1:2}) { |${2:slice}| ${3} } endsnippet @@ -273,7 +273,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2:# TODO} } +`}| ${2} } endsnippet @@ -288,7 +288,7 @@ try: except: snip.rv = 'element' `}| - ${0:# TODO} + ${0} end endsnippet @@ -303,7 +303,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2:# TODO} } +`}| ${2} } endsnippet @@ -318,7 +318,7 @@ try: except: snip.rv = 'element' `}| - ${0:# TODO} + ${0} end endsnippet @@ -333,7 +333,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2:# TODO} } +`}| ${2} } endsnippet @@ -348,7 +348,7 @@ try: except: snip.rv = 'element' `}| - ${0:# TODO} + ${0} end endsnippet @@ -364,7 +364,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`},${2:i}| ${3:# TODO} }$0 +`},${2:i}| ${3} }$0 endsnippet @@ -379,7 +379,7 @@ try: except: snip.rv = 'element' `},${2:i}| - ${0:# TODO} + ${0} end endsnippet @@ -387,14 +387,14 @@ endsnippet snippet "(\S+)\.Each_?p(air)?" ".each_pair { |,| }" r -`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} } +`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3} } endsnippet snippet "(\S+)\.each_?p(air)?" ".each_pair do |,| end" r `!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}| - ${0:# TODO} + ${0} end endsnippet @@ -424,26 +424,24 @@ snippet "(\S+)\.Index" ".index do |item| ... end" r end endsnippet - - -snippet do "do || ... end" i -do ${1:|${2:key}|} +# comments about do and dov see snippets/ruby.snippets +snippet do "do ... end" i +do $0 end endsnippet - - -snippet Do "do ... end" i -do - $0 +snippet dov "do || ... end" i +do |${0:v}| + $1 end endsnippet + snippet until "until ... end" until ${1:expression} - ${0:# TODO} + ${0} end endsnippet @@ -451,7 +449,7 @@ endsnippet snippet Until "begin ... end until " begin - ${0:# TODO} + ${0} end until ${1:expression} endsnippet @@ -459,7 +457,7 @@ endsnippet snippet while "while ... end" while ${1:expression} - ${0:# TODO} + ${0} end endsnippet @@ -467,7 +465,7 @@ endsnippet snippet While "begin ... end while " begin - ${0:# TODO} + ${0} end while ${1:expression} endsnippet @@ -493,9 +491,9 @@ endsnippet snippet begin "begin ... rescue ... end" begin - ${1:# TODO} + ${1} rescue - ${0:# TODO} + ${0} end endsnippet diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 9c994794f..73db3667d 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -413,13 +413,17 @@ snippet seld end snippet lam lambda { |${1:args}| ${2} } -snippet doo +# I'm pretty sure that ruby users expect do to expand to do .. end +snippet do do ${1} end +# this is for one or more variables. typing a ", " is that cheap that it may +# not be worth adding another snippet. should 0/1 placeholders change order? +# its a good idea to think about the var name, so use it first snippet dov - do |${1:variable}| - ${2} + do |${0:v}| + ${1} end snippet : :${1:key} => ${2:"value"}${3} From 52f500fd07e1420446da9d43b5a4e62b5b0add82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 10 Jul 2013 15:52:40 +0200 Subject: [PATCH 0151/1587] Add erlang common_test testsuite snippet --- snippets/erlang.snippets | 190 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) diff --git a/snippets/erlang.snippets b/snippets/erlang.snippets index 0837bb7cc..cfad09a36 100644 --- a/snippets/erlang.snippets +++ b/snippets/erlang.snippets @@ -157,4 +157,194 @@ snippet gen_server %%%=================================================================== %%% Internal functions %%%=================================================================== +# common_test test_SUITE +snippet testsuite + -module(${1:`vim_snippets#Filename('', 'my')`}). + + -include_lib("common_test/include/ct.hrl"). + + %% Test server callbacks + -export([suite/0, all/0, groups/0, + init_per_suite/1, end_per_suite/1, + init_per_group/2, end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). + + %% Test cases + -export([ + ]). + + %%-------------------------------------------------------------------- + %% COMMON TEST CALLBACK FUNCTIONS + %%-------------------------------------------------------------------- + + %%-------------------------------------------------------------------- + %% Function: suite() -> Info + %% + %% Info = [tuple()] + %% List of key/value pairs. + %% + %% Description: Returns list of tuples to set default properties + %% for the suite. + %% + %% Note: The suite/0 function is only meant to be used to return + %% default data values, not perform any other operations. + %%-------------------------------------------------------------------- + suite() -> + [{timetrap,{minutes,10}}]. + + %%-------------------------------------------------------------------- + %% Function: init_per_suite(Config0) -> + %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} + %% + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for skipping the suite. + %% + %% Description: Initialization before the suite. + %% + %% Note: This function is free to add any key/value pairs to the Config + %% variable, but should NOT alter/remove any existing entries. + %%-------------------------------------------------------------------- + init_per_suite(Config) -> + Config. + + %%-------------------------------------------------------------------- + %% Function: end_per_suite(Config0) -> void() | {save_config,Config1} + %% + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% + %% Description: Cleanup after the suite. + %%-------------------------------------------------------------------- + end_per_suite(_Config) -> + ok. + + %%-------------------------------------------------------------------- + %% Function: init_per_group(GroupName, Config0) -> + %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} + %% + %% GroupName = atom() + %% Name of the test case group that is about to run. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding configuration data for the group. + %% Reason = term() + %% The reason for skipping all test cases and subgroups in the group. + %% + %% Description: Initialization before each test case group. + %%-------------------------------------------------------------------- + init_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- + %% Function: end_per_group(GroupName, Config0) -> + %% void() | {save_config,Config1} + %% + %% GroupName = atom() + %% Name of the test case group that is finished. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding configuration data for the group. + %% + %% Description: Cleanup after each test case group. + %%-------------------------------------------------------------------- + end_per_group(_GroupName, _Config) -> + ok. + + %%-------------------------------------------------------------------- + %% Function: init_per_testcase(TestCase, Config0) -> + %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} + %% + %% TestCase = atom() + %% Name of the test case that is about to run. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for skipping the test case. + %% + %% Description: Initialization before each test case. + %% + %% Note: This function is free to add any key/value pairs to the Config + %% variable, but should NOT alter/remove any existing entries. + %%-------------------------------------------------------------------- + init_per_testcase(_TestCase, Config) -> + Config. + + %%-------------------------------------------------------------------- + %% Function: end_per_testcase(TestCase, Config0) -> + %% void() | {save_config,Config1} | {fail,Reason} + %% + %% TestCase = atom() + %% Name of the test case that is finished. + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for failing the test case. + %% + %% Description: Cleanup after each test case. + %%-------------------------------------------------------------------- + end_per_testcase(_TestCase, _Config) -> + ok. + + %%-------------------------------------------------------------------- + %% Function: groups() -> [Group] + %% + %% Group = {GroupName,Properties,GroupsAndTestCases} + %% GroupName = atom() + %% The name of the group. + %% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] + %% Group properties that may be combined. + %% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] + %% TestCase = atom() + %% The name of a test case. + %% Shuffle = shuffle | {shuffle,Seed} + %% To get cases executed in random order. + %% Seed = {integer(),integer(),integer()} + %% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | + %% repeat_until_any_ok | repeat_until_any_fail + %% To get execution of cases repeated. + %% N = integer() | forever + %% + %% Description: Returns a list of test case group definitions. + %%-------------------------------------------------------------------- + groups() -> + []. + + %%-------------------------------------------------------------------- + %% Function: all() -> GroupsAndTestCases | {skip,Reason} + %% + %% GroupsAndTestCases = [{group,GroupName} | TestCase] + %% GroupName = atom() + %% Name of a test case group. + %% TestCase = atom() + %% Name of a test case. + %% Reason = term() + %% The reason for skipping all groups and test cases. + %% + %% Description: Returns the list of groups and test cases that + %% are to be executed. + %%-------------------------------------------------------------------- + all() -> + []. + + + %%-------------------------------------------------------------------- + %% TEST CASES + %%-------------------------------------------------------------------- + + %%-------------------------------------------------------------------- + %% Function: TestCase(Config0) -> + %% ok | exit() | {skip,Reason} | {comment,Comment} | + %% {save_config,Config1} | {skip_and_save,Reason,Config1} + %% + %% Config0 = Config1 = [tuple()] + %% A list of key/value pairs, holding the test case configuration. + %% Reason = term() + %% The reason for skipping the test case. + %% Comment = term() + %% A comment about the test case that will be printed in the html log. + %% + %% Description: Test case function. (The name of it must be specified in + %% the all/0 list or in a test case group for the test case + %% to be executed). + %%-------------------------------------------------------------------- From e477c20bd68d25cc36e62c1c9aed3559cb25b901 Mon Sep 17 00:00:00 2001 From: Dale Roberts Date: Wed, 10 Jul 2013 17:27:17 +0200 Subject: [PATCH 0152/1587] Fix bug in thm --- snippets/tex.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index fc44fffbb..649e06b7f 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -26,7 +26,7 @@ snippet tab snippet thm \begin[${1:author}]{${2:thm}} ${3} - \end{$1} + \end{$2} snippet center \begin{center} ${1} From 9c2cfdd51ad53e694e3c2e40e4707c2c976875b9 Mon Sep 17 00:00:00 2001 From: "Simeon F. Willbanks" Date: Wed, 17 Jul 2013 10:22:01 -0700 Subject: [PATCH 0153/1587] Refactor go Snipmate snippet "if", so you can tab into if block body --- snippets/go.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/go.snippets b/snippets/go.snippets index 1d7d4f595..c4aaf6027 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -79,7 +79,7 @@ snippet inf snippet if if ${1:/* condition */} { ${2} - }${2} + }${3} # else snippet snippet el else { From 6164455931501742d820bec393e353edae9d3296 Mon Sep 17 00:00:00 2001 From: Santiago Gallego Date: Thu, 18 Jul 2013 21:31:59 +0200 Subject: [PATCH 0154/1587] Added python epydoc snippet --- snippets/python.snippets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index d8544cd17..a20086820 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -185,3 +185,15 @@ snippet lc logger.critical(${1:msg}) snippet li logger.info(${1:msg}) +snippet epydoc + """ + ${1:Description} + + @param ${2:param}: ${3: Description} + @type $2: ${4: Type} + + @return: ${5: Description} + @rtype : ${6: Type} + + @raise e: ${7: Description} + """ From 5a95942a8a8ee31ed78c3421749229cdb403ceb4 Mon Sep 17 00:00:00 2001 From: Gea-Suan Lin Date: Sat, 20 Jul 2013 23:42:24 +0800 Subject: [PATCH 0155/1587] Perfer to use . Both are valid in HTML5, and both are valid in major browsers, so we choose shorter version. And move charset before title, because might contain multibyte string. Ref: https://code.google.com/p/doctype-mirror/wiki/MetaCharsetAttribute --- snippets/html_minimal.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/html_minimal.snippets b/snippets/html_minimal.snippets index ce971ef54..61e4738c4 100644 --- a/snippets/html_minimal.snippets +++ b/snippets/html_minimal.snippets @@ -6,8 +6,8 @@ snippet html5 <!doctype html> <html> <head> + <meta charset="utf-8"> <title>$2 - $3 From 743da3a940dd229c4838a2c2455427b0af6940d2 Mon Sep 17 00:00:00 2001 From: Gea-Suan Lin Date: Sat, 20 Jul 2013 23:45:40 +0800 Subject: [PATCH 0156/1587] In HTML5, we don't need xml-style close tag. --- snippets/html_minimal.snippets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/html_minimal.snippets b/snippets/html_minimal.snippets index 61e4738c4..bc6d3e0af 100644 --- a/snippets/html_minimal.snippets +++ b/snippets/html_minimal.snippets @@ -34,15 +34,15 @@ snippet idn snippet label_and_input - ${7} + ${7} # FORMS # use idn . or n to add id snippet input - ${7} + ${7} snippet submit - ${7} + ${7} snippet textarea @@ -61,7 +61,7 @@ snippet img $2 # JS/CSS snippet css_file - ${3} + ${3} snippet css_block From 5ce921601a6725832db69e63f592edd37a2535da Mon Sep 17 00:00:00 2001 From: Michi Huber Date: Mon, 22 Jul 2013 08:52:16 +0200 Subject: [PATCH 0157/1587] Add function do ... end snippet to elixir --- snippets/elixir.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index 50243a705..eb3319e0d 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -89,6 +89,11 @@ snippet doc snippet fn fn(${1:args}) -> ${2} end +snippet fun + function do + ${1} + end + snippet mdoc @moduledoc """ ${1} From e688bfe1fdd6b5a2a8ddb789bb2b7cf2f7b9c3c0 Mon Sep 17 00:00:00 2001 From: "Simeon F. Willbanks" Date: Fri, 26 Jul 2013 08:56:21 -0700 Subject: [PATCH 0158/1587] Add Go snippets for invoking named and anonymous functions in goroutines --- snippets/go.snippets | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/snippets/go.snippets b/snippets/go.snippets index c4aaf6027..94610fc8d 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -211,3 +211,11 @@ snippet t # variable declaration snippet v var ${1:t} ${2:string} +# goroutine named function +snippet g + go ${1:funcName}(${2}) +# goroutine anonymous function +snippet ga + go func(${1} ${2:type}) { + ${3:/* code */} + }(${4}) From eddf0273c72e46d8fa8d1c7ae2839e254bb9b546 Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 28 Jul 2013 15:13:24 +0400 Subject: [PATCH 0159/1587] (eruby.snippets): add number_to_currency helper snippet --- snippets/eruby.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index d99cf0b6e..e3f421366 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -103,6 +103,8 @@ snippet lipp <%= link_to "${1:Link text...}", ${2:model}s_path %> snippet lt <%= link_to "${1:name}", ${2:dest} %> +snippet ntc + <%= number_to_currency(${1}) %> snippet ofcfs <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %> snippet rf From 4e23383bea3d888c8b17c339b6c3ffa8244f5317 Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Mon, 29 Jul 2013 15:04:04 +0400 Subject: [PATCH 0160/1587] (haml.snippets): add number_to_currency helper snippet --- snippets/haml.snippets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index 939158d55..fd66e7423 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -27,4 +27,5 @@ snippet ife snippet ifp - if ${1:condition}.presence? ${2} - +snippet ntc + = number_to_currency(${1}) From 737508c613654a2e0411966f6c4678d414972273 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Wed, 31 Jul 2013 01:36:35 +0200 Subject: [PATCH 0161/1587] UltiSnips JS: fix placeholders, remove trailing ;, they are optional --- UltiSnips/javascript.snippets | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index 7eb18d770..439ec874c 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -27,46 +27,46 @@ endsnippet snippet proto "Prototype (proto)" ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{ - ${0:// body...} -}; + ${0} +} endsnippet snippet for "for (...) {...} (faster)" for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){ ${3:$1[$2]}$0 -}; +} endsnippet snippet for "for (...) {...}" for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) { ${3:$1[$2]}$0 -}; +} endsnippet snippet fun "function (fun)" function ${1:function_name} (${2:argument}) { - ${0:// body...} + ${0} } endsnippet # for one line if .. else you usually use a ? b : c snippet ife "if ___ else" if (${1}) { - {$2} + ${2} } else { - {$3} -}; + ${3} +} endsnippet snippet if "if" if (${1}) { - {$2} -}; + ${2} +} endsnippet snippet timeout "setTimeout function" -setTimeout(function() {$0}${2:}, ${1:10}); +setTimeout(function() {$0}${2:}, ${1:10}) endsnippet # vim:ft=snippets: From fdf1e6e174758f149459a0c7599321f63bd27913 Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Wed, 31 Jul 2013 21:56:59 +0800 Subject: [PATCH 0162/1587] remove old php snippet which Ultisnip already include, add something new --- UltiSnips/php.snippets | 270 +++++++---------------------------------- 1 file changed, 41 insertions(+), 229 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 3245568e0..5f2b9bbea 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -1,258 +1,70 @@ -## Snippets from SnipMate, taken from -## https://github.com/scrooloose/snipmate-snippets.git +snippet ${3});${4} -endsnippet - -snippet def "def" -define('${1}'${2});${3} -endsnippet - -snippet do "do" -do { - ${2} -} while (${1});" -endsnippet - -snippet doc_f "doc_f" -/** - * $2 - * @return ${4:void} - * @author ${5:`!v g:snips_author`} - **/ -${1:public }function ${2:someFunc}(${3}) -{${6} -} -endsnippet - -snippet doc_i "doc_i" -/** - * $1 - * @package ${2:default} - * @author ${3:`!v g:snips_author`} - **/ -interface ${1:someClass} -{${4} -} // END interface $1" -endsnippet - -snippet el "else" -else { - ${1} -} -endsnippet - -snippet for "for" -for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4} -} -endsnippet - -snippet foreachk "foreachk" -foreach ($${1:variable} as $${2:key} => $${3:value}){ - ${4} -} -endsnippet -snippet get "get" -$_GET['${1}']${2} endsnippet -snippet if "if" -if (${1}) { - ${2} -} -endsnippet - -snippet inc "inc" -include '${1:file}';${2} -endsnippet - -snippet log "log" -error_log(var_export(${1}, true));${2} -endsnippet - -snippet post "post" -$_POST['${1}']${2} -endsnippet - -snippet req1 "req1" -require_once '${1:file}';${2} +snippet vdd "php var_dump and die" b +var_dump(); die(); endsnippet -snippet session "session" -$_SESSION['${1}']${2} -endsnippet - -snippet t "t" -$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} -endsnippet - -snippet var "var" -var_export(${1});${2} -endsnippet - -snippet getter "PHP Class Getter" !b -/* - * Getter for $1 - */ -public function get${1/\w+\s*/\u$0/}() -{ - return $this->$1;$2 -} -$4 -endsnippet - -snippet setter "PHP Class Setter" !b -/* - * Setter for $1 - */ -public function set${1/\w+\s*/\u$0/}($$1) -{ - $this->$1 = $$1;$3 - ${4:return $this;} -} -$0 +snippet ns "php namespace" b +namespace ${1:`!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`}; endsnippet -snippet gs "PHP Class Getter Setter" !b -protected $$1 +snippet nc "php namespace and class" b +namespace ${1:`!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`}; -/* - * Getter for $1 - */ -public function get${1/\w+\s*/\u$0/}() -{ - return $this->$1;$2 -} - -/* - * Setter for $1 +/** + * ${3:@author `whoami`}$4 */ -public function set${1/\w+\s*/\u$0/}($$1) -{ - $this->$1 = $$1;$3 - ${4:return $this;} -} -$0 -endsnippet - -snippet pub "Public function" !b -public function ${1:name}(${2:$param}) +class ${2:`!p +snip.rv = re.match(r'.*(?=\.)', fn).group().capitalize() +`} { - ${VISUAL}${3:return null;} } -$0 endsnippet -snippet pro "Protected function" !b -protected function ${1:name}(${2:$param}) +snippet st "php static function" b +${1:public} static function $2($3) { - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pri "Private function" !b -private function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pubs "Public static function" !b -public static function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pros "Protected static function" !b -protected static function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} -} -$0 -endsnippet - -snippet pris "Private static function" !b -private static function ${1:name}(${2:$param}) -{ - ${VISUAL}${3:return null;} + ${4} } -$0 endsnippet -snippet fu "Function snip" !b -function ${1:name}(${2:$param}) +snippet __ "php constructor" b +${1:public} function __construct($2) { - ${VISUAL}${3:return null;} -} -$0 -endsnippet -# :vim:ft=snippets - -snippet fore "Foreach loop" -foreach ($${1:variable} as $${3:value}){ - ${VISUAL}${4} -} -$0 -endsnippet - -snippet new "New class instance" !b -$$1 = new $1($2); -$0 -endsnippet - - -snippet ife "if else" -if (${1:/* condition */}) { - ${2} -} else { - ${3} + ${3} } -$0 endsnippet +snippet sg "Setter and Getter" b -snippet class "Class declaration template" !b /** - * Class ${1:`!p snip.rv=snip.fn.capitalize().split('.')[0]`} - * @author $2 + * @var ${3:`!p snip.rv = t[2].capitalize()`}${4} */ -class $1 +${1:protected} $$2; + +public function set`!p snip.rv = t[2].capitalize()`(`!p +if re.match(r'[A-Z].*', t[3]): + snip.rv = t[3] + ' ' +else: + snip.rv = '' +`$$2) { - public function ${3:__construct}(${4:$options}) - { - ${4} - } -} -$0 -endsnippet + $this->$2 = $$2; -snippet pr "Dumb debug helper in HTML" -echo '
    ' . var_export($1, 1) . '
    ';$0 -endsnippet - -snippet pc "Dumb debug helper in cli" -var_export($1);$0 -endsnippet - -# Symfony 2 based snippets -snippet sfa "Symfony 2 Controller action" -/** -* @Route("/${1:route_name}", name="$1") -* @Template() -*/ -public function $1Action($2) -{ - $3 - return ${4:array();}$0 + return $this; } endsnippet - -# :vim:ft=snippets: - From 04a98ad3872c80c8b2f3f0eeb50b9b76a7770275 Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Thu, 1 Aug 2013 22:42:37 +0800 Subject: [PATCH 0163/1587] hotfix: move cursor in var_dump call, correct the case of class name --- UltiSnips/php.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 5f2b9bbea..45fd094e9 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -5,7 +5,7 @@ snippet Date: Fri, 2 Aug 2013 22:12:04 +0800 Subject: [PATCH 0164/1587] add symfony2 snippets --- UltiSnips/php.snippets | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 45fd094e9..0e866d928 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -4,7 +4,7 @@ snippet $2; +} +endsnippet + +snippet if "php if" !b +if (${1}) { + ${2} +} endsnippet From ea27dc46277072ff8f894a4b4c02f113c329a29c Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Fri, 2 Aug 2013 22:16:05 +0800 Subject: [PATCH 0165/1587] fixup --- UltiSnips/php/symfony2.snippets | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 UltiSnips/php/symfony2.snippets diff --git a/UltiSnips/php/symfony2.snippets b/UltiSnips/php/symfony2.snippets new file mode 100644 index 000000000..53df3d3df --- /dev/null +++ b/UltiSnips/php/symfony2.snippets @@ -0,0 +1,75 @@ +snippet contr "symfony2 controller" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Request; + +/** + * ${1:@author `whoami`}${2} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends Controller +{ +} +endsnippet + +snippet act "symfony2 action" b +/** + * @Route("${3}", name="${4}") + * @Method({${5:"GET"}}) + * @Template() + */ +public function ${1}Action(${2}) +{ + ${6} + return []; +} +endsnippet + +snippet comm "symfony2 command" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * ${3:@author `whoami`}${4} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends ContainerAwareCommand +{ + protected function configure() + { + $this + ->setName('${1}') + ->setDescription('${2}') + ->setDefinition([ + new InputArgument('', InputArgument::REQUIRED, ''), + new InputOption('', null, InputOption::VALUE_NONE, ''), + ]) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + } +} +endsnippet From a490c1ee8ddbe9c70efc579c96d8bb0f6d055fa4 Mon Sep 17 00:00:00 2001 From: Kevin Schaul Date: Fri, 2 Aug 2013 18:00:59 -0400 Subject: [PATCH 0166/1587] Added snippets for d3 (javascript) Based on Shan Carter's snippets for Sublime https://github.com/shancarter/sublime-text-d3 --- snippets/javascript.d3.snippets | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 snippets/javascript.d3.snippets diff --git a/snippets/javascript.d3.snippets b/snippets/javascript.d3.snippets new file mode 100644 index 000000000..a3f7fa7a5 --- /dev/null +++ b/snippets/javascript.d3.snippets @@ -0,0 +1,30 @@ +snippet .attr + .attr("${1}", ${2}) +snippet .style + .style("${1}", ${2}) +snippet axis + d3.svg.axis() + .orient(${1}) + .scale(${2}) +snippet fd + function(d) { ${1} } +snippet fdi + function(d, i) { ${1} } +snippet marginconvention + var ${1:margin} = { top: ${2:10}, right: ${3:10}, bottom: ${4:10}, left: ${5:10} }; + var ${6:width} = ${7:970} - $1.left - $1.right; + var ${8:height} = ${9:500} - $1.top - $1.bottom; + + var ${10:svg} = d3.select("${11}").append("svg") + .attr("width", $6) + .attr("height", $8) + .append("g") + .attr("transform", "translate(" + $1.left + "," + $1.top + ")") +snippet nest + d3.nest() + .key(${1}) + .entries(${2}) +snippet scale + d3.scale.linear() + .domain(${1}) + .range(${2}) From b4fe1eb09d24289f4f27708253b06e6cef2df967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Sun, 4 Aug 2013 03:52:18 +0200 Subject: [PATCH 0167/1587] fix underline length if you're hasty and type more than three '='s/'-'s, the underline will be longer than the title above. To fix this we need to subtract the (remaining) length of the current line from the length of the title. --- snippets/markdown.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/markdown.snippets b/snippets/markdown.snippets index 9788959f6..bfbff2553 100644 --- a/snippets/markdown.snippets +++ b/snippets/markdown.snippets @@ -23,11 +23,11 @@ snippet ![:* ![${1:id}]: ${2:`@*`} "${3:title}" snippet === - `repeat('=', strlen(getline(line(".") - 1)))` + `repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))` ${1} snippet --- - `repeat('-', strlen(getline(line(".") - 1)))` + `repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))` ${1} From 4b0712a65269e4927296d0ff4ff05bd952f98119 Mon Sep 17 00:00:00 2001 From: ZPH Date: Wed, 7 Aug 2013 21:34:23 -0400 Subject: [PATCH 0168/1587] Converted snipmate elixir snippets into ultisnip Credit belongs to @iurifq for the snippets Translation from snipmate to ultisnip format @zph --- UltiSnips/elixir.snippets | 168 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 UltiSnips/elixir.snippets diff --git a/UltiSnips/elixir.snippets b/UltiSnips/elixir.snippets new file mode 100644 index 000000000..ae7ea2011 --- /dev/null +++ b/UltiSnips/elixir.snippets @@ -0,0 +1,168 @@ +# Credit: @iurifg + +snippet do +do + ${1} +end +endsnippet + +snippet if "if .. do .. end" +if ${1:condition} do + ${2:expression} +end +endsnippet + +snippet if "if .. do: .." +if ${1:condition}, do: ${2:expression} +endsnippet + +snippet ife "if .. do .. else .. end" +if ${1:condition} do + ${2:expression} +else + ${3:expression} +end +endsnippet + +snippet ife "if .. do: .. else:" +if ${1:condition}, do: ${2}, else: ${3} +endsnippet + +snippet unless "unless .. do .. end" +unless ${1} do + ${2} +end +endsnippet + +snippet unless "unless .. do: .." +unless ${1:condition}, do: ${2} +endsnippet + +snippet unlesse "unless .. do .. else .. end" +unless ${1:condition} do + ${2} +else + ${3} +end +endsnippet + +snippet unlesse "unless .. do: .. else:" +unless ${1:condition}, do: ${2}, else: ${3} +endsnippet + +snippet cond +"cond do" +${1} -> + ${2} +end +endsnippet + +snippet case +case ${1} do +${2} -> + ${3} +end +endsnippet + +snippet def +def ${1:name} do + ${2} +end +endsnippet + +snippet defin "def function(n), do: n" +def ${1:name}, do: ${2} +endsnippet + +snippet defg +def ${1:name} when ${2:guard-condition} do + ${3} +end +endsnippet + +snippet defim +defimpl ${1:protocol_name}, for: ${2:data_type} do + ${3} +end +endsnippet + +snippet defma +defmacro ${1:name} do + ${2} +end +endsnippet + +snippet defmo +defmodule ${1:module_name} do + ${2} +end +endsnippet + +snippet defp +defp ${1:name} do + ${2} +end +endsnippet + +snippet defpr +defprotocol ${1:name}, [${2:function}] +endsnippet + +snippet defr +defrecord ${1:record_name}, ${2:fields} +endsnippet + +snippet doc +@doc """ +${1} +""" +endsnippet + +snippet fn +fn(${1:args}) -> ${2} end +endsnippet + +snippet fun +function do + ${1} +end +endsnippet + +snippet mdoc +@moduledoc """ +${1} +""" +endsnippet + +snippet rec +receive do +${1} -> + ${2} +end +endsnippet + +snippet req +require ${1:module_name} +endsnippet + +snippet imp +import ${1:module_name} +endsnippet + +snippet ali "alias old-module to shorthand" +alias ${1:module_name} +endsnippet + +snippet test +test "${1:test_name}" do + ${2} +end +endsnippet + +snippet try "try .. rescue .. end" +try do + ${1} +rescue + ${2} -> ${3} +end +endsnippet From c0cddc9f864232e6dbfef7d8787363e6f1cffddb Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Wed, 31 Jul 2013 22:31:05 +0200 Subject: [PATCH 0169/1587] ruby: count from 1, not 0 (I think its very important to think about the name) add static_var snippet --- UltiSnips/ruby.snippets | 4 ++-- snippets/php.snippets | 7 +++++++ snippets/ruby.snippets | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/UltiSnips/ruby.snippets b/UltiSnips/ruby.snippets index 306c7e10d..0b6836cb3 100644 --- a/UltiSnips/ruby.snippets +++ b/UltiSnips/ruby.snippets @@ -432,8 +432,8 @@ end endsnippet snippet dov "do || ... end" i -do |${0:v}| - $1 +do |${1:v}| + $2 end endsnippet diff --git a/snippets/php.snippets b/snippets/php.snippets index b85d96e6c..29b1b45f1 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -405,3 +405,10 @@ snippet aw array_walk($${1:foo}, function(&$${2:v}, $${3:k}) { $$2 = ${4}; }); + +# static var assign once +snippet static_var + static $${1} = null; + if (is_null($$1)){ + $$1 = ${2}; + } diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 73db3667d..01358828b 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -422,8 +422,8 @@ snippet do # not be worth adding another snippet. should 0/1 placeholders change order? # its a good idea to think about the var name, so use it first snippet dov - do |${0:v}| - ${1} + do |${1:v}| + ${2} end snippet : :${1:key} => ${2:"value"}${3} From 8024cfcecdc4bf8ad601d5eae9f7ca52426579a4 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 8 Aug 2013 11:24:27 +0200 Subject: [PATCH 0170/1587] while -> wh, see #230 and README.md --- README.md | 3 ++- UltiSnips/ocaml.snippets | 2 +- UltiSnips/perl.snippets | 2 +- UltiSnips/ruby.snippets | 2 +- UltiSnips/sh.snippets | 2 +- UltiSnips/tcl.snippets | 2 +- snippets/actionscript.snippets | 2 +- snippets/autoit.snippets | 2 +- snippets/falcon.snippets | 2 +- snippets/htmltornado.snippets | 2 +- snippets/processing.snippets | 2 +- snippets/ruby.snippets | 2 +- snippets/scala.snippets | 2 +- 13 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 35eac1bc7..6d3e41db4 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ if : if without else ife: if $1 else $2 eif : else if ($1) { .. } el : else .. +wh : while (cond) ... ``` If you're not satisfied with these defaults, open a ticket that we implement @@ -89,7 +90,7 @@ Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks Open questions: What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. ? -What about wh(ile), which trigger? +Which additional policies to add? Discuss at: https://github.com/honza/vim-snippets/issues/230 diff --git a/UltiSnips/ocaml.snippets b/UltiSnips/ocaml.snippets index 14926c899..157eb91a3 100644 --- a/UltiSnips/ocaml.snippets +++ b/UltiSnips/ocaml.snippets @@ -59,7 +59,7 @@ if ${1} then ${2} endsnippet -snippet while "while" +snippet wh "while" while ${1} do ${2} done diff --git a/UltiSnips/perl.snippets b/UltiSnips/perl.snippets index 6a9e8f9d1..e183b115e 100644 --- a/UltiSnips/perl.snippets +++ b/UltiSnips/perl.snippets @@ -117,7 +117,7 @@ unless ($1) { endsnippet -snippet while "while" +snippet wh "while" while ($1) { ${2:# body...} } diff --git a/UltiSnips/ruby.snippets b/UltiSnips/ruby.snippets index 0b6836cb3..90001b1a4 100644 --- a/UltiSnips/ruby.snippets +++ b/UltiSnips/ruby.snippets @@ -455,7 +455,7 @@ endsnippet -snippet while "while ... end" +snippet wh "while ... end" while ${1:expression} ${0} end diff --git a/UltiSnips/sh.snippets b/UltiSnips/sh.snippets index 915c0df9a..cce06ef3d 100644 --- a/UltiSnips/sh.snippets +++ b/UltiSnips/sh.snippets @@ -79,7 +79,7 @@ until ${2:[[ ${1:condition} ]]}; do done endsnippet -snippet while "while ... (done)" +snippet wh "while ... (done)" while ${2:[[ ${1:condition} ]]}; do ${0:#statements} done diff --git a/UltiSnips/tcl.snippets b/UltiSnips/tcl.snippets index c5ae37ba2..fd53d2652 100644 --- a/UltiSnips/tcl.snippets +++ b/UltiSnips/tcl.snippets @@ -40,7 +40,7 @@ switch ${1:-exact} -- ${2:\$var} { endsnippet -snippet while "while... (while)" b +snippet wh "while... (while)" b while {${1}} { ${2} } diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index 5385d115d..1aeca1c93 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -75,7 +75,7 @@ snippet do do { ${2} } while (${1:cond}) -snippet while +snippet wh while ${1:cond}{ ${2} } diff --git a/snippets/autoit.snippets b/snippets/autoit.snippets index c266e339e..b214fd2b2 100644 --- a/snippets/autoit.snippets +++ b/snippets/autoit.snippets @@ -41,7 +41,7 @@ snippet select {$4:; Else code} EndSelect # While loop -snippet while +snippet wh While (${1:condition}) ${2:; code...} WEnd diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 78257b6e9..50c3694c9 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -65,7 +65,7 @@ snippet forto end # While Loop -snippet while +snippet wh while ${1:conidition} ${2} end diff --git a/snippets/htmltornado.snippets b/snippets/htmltornado.snippets index e80499ce9..c52f0e890 100644 --- a/snippets/htmltornado.snippets +++ b/snippets/htmltornado.snippets @@ -49,7 +49,7 @@ snippet try {% finallly %} ${3} {% end %} -snippet while +snippet wh {% while ${1:condition} %} ${2} {% end %} diff --git a/snippets/processing.snippets b/snippets/processing.snippets index 27f3e005a..2aec1b122 100755 --- a/snippets/processing.snippets +++ b/snippets/processing.snippets @@ -63,7 +63,7 @@ snippet for ${4:$1[$2]} }; #loop while -snippet while +snippet wh while (${1:/* condition */}) { ${2} } diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 01358828b..06a7820e9 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -75,7 +75,7 @@ snippet unless unless ${1:condition} ${2} end -snippet while +snippet wh while ${1:condition} ${2} end diff --git a/snippets/scala.snippets b/snippets/scala.snippets index e3999f850..1cbd36815 100644 --- a/snippets/scala.snippets +++ b/snippets/scala.snippets @@ -33,7 +33,7 @@ snippet eif ${4} } #while loop -snippet while +snippet wh while (${1:obj}) { ${2} } From 552aaa4dd02aa645d917dc8d45391afcd3ef50cb Mon Sep 17 00:00:00 2001 From: Kevin Mees Date: Fri, 9 Aug 2013 15:35:41 +0200 Subject: [PATCH 0171/1587] Converted Coffeescript SnipMate snippets to Livescript --- snippets/ls.snippets | 98 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 snippets/ls.snippets diff --git a/snippets/ls.snippets b/snippets/ls.snippets new file mode 100644 index 000000000..e4a1149f4 --- /dev/null +++ b/snippets/ls.snippets @@ -0,0 +1,98 @@ +# Closure loop +snippet forinlet + for ${1:name} in ${2:array} + let $1 + ${3} +# Array comprehension +snippet fora + for ${1:name} in ${2:array} + ${3} +# Object comprehension +snippet foro + for ${1:key}, ${2:value} of ${3:object} + ${4} +# Range comprehension (inclusive) +snippet forr + for ${1:name} from ${2:start} to ${3:finish} + ${4} +snippet forrb + for ${1:name} from ${2:start} to ${3:finish} by ${4:step} + ${5} +# Range comprehension (exclusive) +snippet forrex + for ${1:name} from ${2:start} til ${3:finish} + ${4} +snippet forrexb + for ${1:name} from ${2:start} til ${3:finish} by ${4:step} + ${5} +# Function +snippet fun + (${1:args}) -> + ${2} +# Function (bound) +snippet bfun + (${1:args}) ~> + ${2} +# Class +snippet cla class .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + ${2} +snippet cla class .. constructor: .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} + (${2:args}) -> + ${3} + + ${4} +snippet cla class .. extends .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + ${3} +snippet cla class .. extends .. constructor: .. + class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} + (${3:args}) -> + ${4} + + ${5} +# If +snippet if + if ${1:condition} + ${2} +# If __ Else +snippet ife + if ${1:condition} + ${2} + else + ${3} +# Else if +snippet elif + else if ${1:condition} + ${2} +# Ternary If +snippet ifte + if ${1:condition} then ${2:value} else ${3:other} +# Unless +snippet unl + ${1:action} unless ${2:condition} +# Switch +snippet swi + switch ${1:object} + case ${2:value} + ${3} + default void + +# Log +snippet log + console.log ${1} + +# Try __ Catch +snippet try + try + ${1} + catch ${2:error} + ${3} +# Require +snippet req + ${2:$1} = require '${1}'${3} + +# Export +snippet exp + ${1:root} = exports ? this From 1fd1d3b53f856aa2b60df3fa13985aef46780dd4 Mon Sep 17 00:00:00 2001 From: Kevin Mees Date: Fri, 9 Aug 2013 15:36:34 +0200 Subject: [PATCH 0172/1587] Added livescript match snippet --- snippets/ls.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/ls.snippets b/snippets/ls.snippets index e4a1149f4..37440f9a6 100644 --- a/snippets/ls.snippets +++ b/snippets/ls.snippets @@ -78,6 +78,10 @@ snippet swi case ${2:value} ${3} default void +snippet mat + match ${1:object} + | ${2:value} => ${3} + | otherwise => void # Log snippet log From 1df60aadd24b5bf9b358bea8a35ea134260a2865 Mon Sep 17 00:00:00 2001 From: Kevin Mees Date: Fri, 9 Aug 2013 15:37:35 +0200 Subject: [PATCH 0173/1587] Added livescript req! snippet --- snippets/ls.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/ls.snippets b/snippets/ls.snippets index 37440f9a6..9d044ebe1 100644 --- a/snippets/ls.snippets +++ b/snippets/ls.snippets @@ -96,6 +96,9 @@ snippet try # Require snippet req ${2:$1} = require '${1}'${3} +# Require! +snippet req! + require! ${1} # Export snippet exp From 883916a91d1ee1ac2280baa1974818ab79a57dce Mon Sep 17 00:00:00 2001 From: Kevin Mees Date: Fri, 9 Aug 2013 15:41:50 +0200 Subject: [PATCH 0174/1587] Added livescript str snippet --- snippets/ls.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/ls.snippets b/snippets/ls.snippets index 9d044ebe1..909b35ee6 100644 --- a/snippets/ls.snippets +++ b/snippets/ls.snippets @@ -86,6 +86,9 @@ snippet mat # Log snippet log console.log ${1} +# stringify +snippet str + JSON.stringify ${1}, void, 2 # Try __ Catch snippet try From 89c6f17ee986ea76a0d47de3c70f13f58e60c41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Garci=CC=81a?= Date: Tue, 13 Aug 2013 23:51:47 -0700 Subject: [PATCH 0175/1587] Added Ember.js snippets --- UltiSnips/javascript_ember.snippets | 88 +++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 UltiSnips/javascript_ember.snippets diff --git a/UltiSnips/javascript_ember.snippets b/UltiSnips/javascript_ember.snippets new file mode 100644 index 000000000..543a26adc --- /dev/null +++ b/UltiSnips/javascript_ember.snippets @@ -0,0 +1,88 @@ +################################################################### +# Ember snippets # +################################################################### + +# Application +snippet eapp "App.Name = Ember.Application.create({});" +${1:App.Name} = Ember.Application.create({}); +endsnippet + +# Models +snippet emod "App.ModelName = Ember.Model.extend({...});" +${1:model_name} = Ember.Model.extend({ + ${0://Properties here...} +}); +endsnippet + +# View +snippet eview "App.ViewName = Ember.Model.extend({...});" +${1:view_name} = Ember.View.extend({ + ${0://Properties here...} +}); +endsnippet + +# Controller +snippet econtroller "App.ControllerName = Ember.Model.extend({...});" +${1:controller_name} = Ember.ObjectController.extend({ + ${0://Properties here...} +}); +endsnippet + +# Route +snippet eroute "App.RouteName = Ember.Route.extend({...});" +${1:route_name} = Ember.Route.extend({ + ${0://Properties here...} +}); +endsnippet + +snippet eview "App.ViewName = Ember.Model.create({...});" +${1:view_name} = Ember.View.create({ + ${0://Properties here...} +}); +endsnippet + +# Object +snippet eobj "App.ObjectName = Ember.Object.extend({...});" +${1:object_name} = Ember.Object.create({ + ${0://Properties here...} +}); +endsnippet + +# Mixin +snippet emix "App.MixinName = Ember.Model.extend({...});" +${1:view_name} = Ember.Mixin.create({ + ${0://Properties here...} +}); +endsnippet + +# Ember getter and setter +snippet eget "this.get('property');" +${1:this}.get('${2:property}'); +endsnippet + +snippet eset "this.set('property', value);" +${1:this}.set('${2:property}', ${3:value}); +endsnippet + +# Computer properties +snippet cpro "property_name: function() {...}.property()," +${1:property_name}: function() { + ${0://body...} +}.property('${3:argumenet}'), +endsnippet + +snippet cpro ": function() {...}.property('property')," +${1:property_name}: function() { + ${0://body...} +}.property(), +endsnippet + + +# Observes +snippet proo "property_name: function() {...}.property()" +${1:property_name}: function() { + ${0://body...} +}.observes('${3:property}'), +endsnippet + +# vim:ft=snippets: From db20c6140bc9927ca1d1e662018dcf3be62e1e90 Mon Sep 17 00:00:00 2001 From: carme Date: Wed, 14 Aug 2013 22:07:31 +0900 Subject: [PATCH 0176/1587] fixed conflict ruby snippets. --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 06a7820e9..43084f675 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -854,7 +854,7 @@ snippet format format.${1:js|xml|html} { ${2} } snippet wc where(${1:"conditions"}${2:, bind_var}) -snippet wh +snippet wf where(${1:field} => ${2:value}) snippet xdelete xhr :delete, :${1:destroy}, :id => ${2:1}${3} From 62166691a8a84f17f88d5eeb570d525ca2f1f6c0 Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Thu, 15 Aug 2013 12:32:07 -0700 Subject: [PATCH 0177/1587] add link_to, mail_to to haml snippets --- snippets/haml.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index fd66e7423..c369d59fe 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -19,6 +19,12 @@ snippet rpl = render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1} snippet rpo = render :partial => "${1:item}", :object => ${2:@$1} +snippet l link_to + = link_to ${1:name}, ${2:url} +snippet m mail_to + = mail_to ${1:email_address}, ${2:name} +snippet m mail_to subject body + = mail_to ${1:email_address}, ${2:name}, :subject => ${3:subject}, :body snippet ife - if ${1:condition} ${2} From 85a4bc5fc1b08b5980a24b174137ac641dad0ceb Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Thu, 15 Aug 2013 15:04:30 -0700 Subject: [PATCH 0178/1587] fix typo in haml mail_to --- snippets/haml.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index c369d59fe..2054636d6 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -24,7 +24,7 @@ snippet l link_to snippet m mail_to = mail_to ${1:email_address}, ${2:name} snippet m mail_to subject body - = mail_to ${1:email_address}, ${2:name}, :subject => ${3:subject}, :body + = mail_to ${1:email_address}, ${2:name}, :subject => ${3:subject}, :body => ${4:body} snippet ife - if ${1:condition} ${2} From 790355c688755ac3f837e48db59533e34fee50bd Mon Sep 17 00:00:00 2001 From: Mike Foley Date: Thu, 15 Aug 2013 17:34:23 -0700 Subject: [PATCH 0179/1587] remap haml triggers: mail_to = mt/mts, link_to = lt --- snippets/haml.snippets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index 2054636d6..046608784 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -19,12 +19,12 @@ snippet rpl = render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1} snippet rpo = render :partial => "${1:item}", :object => ${2:@$1} -snippet l link_to - = link_to ${1:name}, ${2:url} -snippet m mail_to +snippet lt + = link_to ${1:name}, ${2:dest} +snippet mt = mail_to ${1:email_address}, ${2:name} -snippet m mail_to subject body - = mail_to ${1:email_address}, ${2:name}, :subject => ${3:subject}, :body => ${4:body} +snippet mts + = mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4} snippet ife - if ${1:condition} ${2} From 0f452a4875eb9cbffb359cfc23877835b5782216 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Sat, 17 Aug 2013 13:14:05 -0700 Subject: [PATCH 0180/1587] Fix ruby `super_call` snippet There was no tab in the beginning of the line and snippet wasn't working. --- snippets/ruby.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 43084f675..4c93c74f1 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -1075,4 +1075,4 @@ snippet isres snippet isresw it { should respond_to(:${1}).with(${2}).arguments } snippet super_call - ${1:super_class}.instance_method(:${2:method}).bind(self).call + ${1:super_class}.instance_method(:${2:method}).bind(self).call From 786f9a66fa7d1361bfd78486392ff54d57fc5a0d Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Mon, 19 Aug 2013 11:58:09 +0800 Subject: [PATCH 0181/1587] snip `nc` auto detect `Abstract` and `Interface` --- UltiSnips/php.snippets | 20 ++++++++++++++++++-- UltiSnips/php/symfony2.snippets | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 0e866d928..8b6a8ae76 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -18,7 +18,7 @@ if m: endsnippet -snippet nc "php namespace and class" b +snippet nc "php namespace and class or interface" b namespace ${1:`!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) @@ -29,7 +29,17 @@ if m: /** * ${3:@author `whoami`}${4} */ -class ${2:`!p +`!p +m = re.search(r'Abstract', path) +if m: + snip.rv = 'abstract ' +``!p +m = re.search(r'Interface', path) +if m: + snip.rv = 'interface' +else: + snip.rv = 'class' +` ${2:`!p snip.rv = re.match(r'.*(?=\.)', fn).group() `} { @@ -80,3 +90,9 @@ if (${1}) { ${2} } endsnippet + +snippet /** "php comment block" b +/** + * @${1} + */ +endsnippet diff --git a/UltiSnips/php/symfony2.snippets b/UltiSnips/php/symfony2.snippets index 53df3d3df..df928bf56 100644 --- a/UltiSnips/php/symfony2.snippets +++ b/UltiSnips/php/symfony2.snippets @@ -1,3 +1,5 @@ +# sugguestion? report bugs? +# go to https://github.com/chrisyue/vim-snippets/issues snippet contr "symfony2 controller" b namespace `!p abspath = os.path.abspath(path) @@ -23,6 +25,18 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() endsnippet snippet act "symfony2 action" b +/** + * @Route("${3}", name="${4}") + * @Method({${5:"POST"}}) + */ +public function ${1}Action(${2}) +{ + ${6} + return $this->redirect($this->generate('home', [], false)); +} +endsnippet + +snippet actt "symfony2 action and template" b /** * @Route("${3}", name="${4}") * @Method({${5:"GET"}}) @@ -32,7 +46,8 @@ public function ${1}Action(${2}) { ${6} return []; -} +}`!p +abspath = os.path.abspath(path)` endsnippet snippet comm "symfony2 command" b From 1eb75e363e8bfebd046ce22f328871590818f48b Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Wed, 21 Aug 2013 11:28:30 +0800 Subject: [PATCH 0182/1587] `nc` support trait --- UltiSnips/php.snippets | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 8b6a8ae76..5122f1ca2 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -34,9 +34,10 @@ m = re.search(r'Abstract', path) if m: snip.rv = 'abstract ' ``!p -m = re.search(r'Interface', path) -if m: +if re.search(r'Interface', path): snip.rv = 'interface' +elif re.search(r'Trait', path): + snip.rv = 'trait' else: snip.rv = 'class' ` ${2:`!p From 481f74b86c111ac66c6821fd44850406d2539231 Mon Sep 17 00:00:00 2001 From: "Simeon F. Willbanks" Date: Wed, 21 Aug 2013 09:01:21 -0700 Subject: [PATCH 0183/1587] Add snippets for declaring and initializing a single variable, both longhand and shorthand. --- snippets/go.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/go.snippets b/snippets/go.snippets index 94610fc8d..7e2ad4ca7 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -1,3 +1,8 @@ +# variables +snippet v + ${1} := ${2} +snippet vr + var ${1} ${2} = ${3} # append snippet ap append(${1:slice}, ${2:value}) From ff7606bdc5edcb1722009891e94f305acabfddd7 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Wed, 21 Aug 2013 16:31:32 -0700 Subject: [PATCH 0184/1587] Ruby `pry` snippet inserts only one line Problem: pry snippet inserts 2 lines instead of one. The other line is used as a document header margin (for source code readability). --- snippets/ruby.snippets | 1 - 1 file changed, 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 4c93c74f1..1da6f3b47 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -585,7 +585,6 @@ snippet debug require 'ruby-debug'; debugger; true; snippet pry require 'pry'; binding.pry - ############################################# # Rails snippets - for pure Ruby, see above # ############################################# From 2f9163ddb59b1c5ea81f4df3bc1747d47c2cbfc8 Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Fri, 23 Aug 2013 13:59:47 +0800 Subject: [PATCH 0185/1587] add symfony2 DataTransformer and EventSubscriber --- UltiSnips/php/symfony2.snippets | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/UltiSnips/php/symfony2.snippets b/UltiSnips/php/symfony2.snippets index df928bf56..c38ca790c 100644 --- a/UltiSnips/php/symfony2.snippets +++ b/UltiSnips/php/symfony2.snippets @@ -88,3 +88,68 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } } endsnippet + +snippet subs "symfony2 subscriber" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +/** + * ${1:@author `whoami`}${2} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` implements EventSubscriberInterface +{ + public function __construct() + { + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return []; + } +} +endsnippet + +snippet transf "symfony2 form data transformer" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * ${3:@author `whoami`}${4} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` implements DataTransformerInterface +{ + /** + * {@inheritDoc} + */ + public function transform(${1}) + { + } + + /** + * {@inheritDoc} + */ + public function reverseTransform(${2}) + { + } +} +endsnippet From 702844eb2b6a3280b61aa3cfeee0873569747c5b Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Mon, 26 Aug 2013 21:11:23 +0800 Subject: [PATCH 0186/1587] add phpunit snippets --- UltiSnips/php.snippets | 8 ++++++++ UltiSnips/php/phpunit.snippets | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 UltiSnips/php/phpunit.snippets diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 5122f1ca2..96cae3549 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -92,6 +92,14 @@ if (${1}) { } endsnippet +snippet ife "php ife" !b +if (${1}) { + ${2} +} else { + +} +endsnippet + snippet /** "php comment block" b /** * @${1} diff --git a/UltiSnips/php/phpunit.snippets b/UltiSnips/php/phpunit.snippets new file mode 100644 index 000000000..6609f3fa6 --- /dev/null +++ b/UltiSnips/php/phpunit.snippets @@ -0,0 +1,30 @@ +# sugguestion? report bugs? +# please go to https://github.com/chrisyue/vim-snippets/issues +snippet test "phpunit test class" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +/** + * @author `whoami` + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends \PHPUnit_Framework_TestCase +{ + public function test${1}() + { + ${2} + } +} +endsnippet + +snippet exp "phpunit expects" i +expects($this->${1:once}()) + ->method('${2}') + ->with($this->equalTo(${3})${4}) + ->will($this->returnValue(${5})); +endsnippet From 5d4cad3316509b7538fdcae5e302a369dd7fc40e Mon Sep 17 00:00:00 2001 From: Martxel Lasa Date: Mon, 26 Aug 2013 19:43:20 +0200 Subject: [PATCH 0187/1587] Fix html5 snippet indentation and meta tag. --- UltiSnips/html.snippets | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets index bb0747890..fd11d70b8 100644 --- a/UltiSnips/html.snippets +++ b/UltiSnips/html.snippets @@ -281,16 +281,16 @@ snippet html5 "HTML5 Template" - ${1} - + ${1} + -
    - ${2} -
    -
    - ${4} -
    +
    + ${2} +
    +
    + ${4} +
    endsnippet From 4c7fba87d59e45b319645061e77679c6eec6253d Mon Sep 17 00:00:00 2001 From: William Ma Date: Wed, 28 Aug 2013 04:41:41 +1000 Subject: [PATCH 0188/1587] fixed auto iterator in cpp --- snippets/cpp.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index e95d35342..1fa9ec876 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -116,9 +116,9 @@ snippet iter # auto iterator snippet itera - for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { - ${2:std::cout << *$1 << std::endl;} - }${3} + for (auto ${1:i} = ${2:container}.begin(); $1 != $2.end(); ++$1) { + ${3:std::cout << *$1 << std::endl;} + }${4} ## ## Lambdas # lamda (one line) From 5386637570b9e61063207929accfa6d3f181fe6a Mon Sep 17 00:00:00 2001 From: yuhuanbo Date: Sat, 31 Aug 2013 12:55:47 +0800 Subject: [PATCH 0189/1587] add symfony2 doctrine entity template --- UltiSnips/php/symfony2.snippets | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/UltiSnips/php/symfony2.snippets b/UltiSnips/php/symfony2.snippets index c38ca790c..0c7951ae2 100644 --- a/UltiSnips/php/symfony2.snippets +++ b/UltiSnips/php/symfony2.snippets @@ -153,3 +153,32 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } } endsnippet + +snippet ent "symfony2 doctrine entity" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Doctrine\ORM\Mapping as ORM; + +/** + * ${3:@author `whoami`}${4} + * + * @ORM\Entity() + * @ORM\Table(name="`!p snip.rv = re.match(r'.*(?=\.)', fn).group().lower()`") + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` +{ + /** + * @ORM\Column(type="integer") + * @ORM\GeneratedValue + * @ORM\Id + */ + private $id; +} +endsnippet From 7f9c4f58076d057e10348f2ba9329c9e1f36b116 Mon Sep 17 00:00:00 2001 From: Adnan Zafar Date: Thu, 25 Jul 2013 17:17:32 -0400 Subject: [PATCH 0190/1587] Modify snippets to support zero tabstop --- snippets/_.snippets | 24 +- snippets/actionscript.snippets | 40 +- snippets/apache.snippets | 12 +- snippets/autoit.snippets | 34 +- snippets/c.snippets | 60 +-- snippets/chef.snippets | 22 +- snippets/clojure.snippets | 62 +-- snippets/cmake.snippets | 20 +- snippets/coffee.snippets | 46 +- snippets/cpp.snippets | 54 +-- snippets/cs.snippets | 158 +++---- snippets/css.snippets | 372 +++++++-------- snippets/dart.snippets | 50 +-- snippets/diff.snippets | 2 +- snippets/django.snippets | 64 +-- snippets/elixir.snippets | 56 +-- snippets/erlang.snippets | 34 +- snippets/eruby.snippets | 98 ++-- snippets/falcon.snippets | 22 +- snippets/go.snippets | 70 +-- snippets/haml.snippets | 16 +- snippets/haskell.snippets | 52 +-- snippets/html.snippets | 522 ++++++++++----------- snippets/html_minimal.snippets | 24 +- snippets/htmldjango.snippets | 94 ++-- snippets/htmltornado.snippets | 32 +- snippets/java.snippets | 114 ++--- snippets/javascript-jquery.snippets | 416 ++++++++--------- snippets/javascript.snippets | 62 +-- snippets/jsp.snippets | 64 +-- snippets/ledger.snippets | 2 +- snippets/lua.snippets | 10 +- snippets/make.snippets | 2 +- snippets/mako.snippets | 32 +- snippets/markdown.snippets | 44 +- snippets/objc.snippets | 112 ++--- snippets/openfoam.snippets | 10 +- snippets/perl.snippets | 90 ++-- snippets/php.snippets | 152 +++---- snippets/plsql.snippets | 44 +- snippets/po.snippets | 2 +- snippets/processing.snippets | 416 ++++++++--------- snippets/progress.snippets | 16 +- snippets/puppet.snippets | 80 ++-- snippets/python.snippets | 72 +-- snippets/r.snippets | 90 ++-- snippets/rst.snippets | 42 +- snippets/ruby.snippets | 672 ++++++++++++++-------------- snippets/scala.snippets | 134 +++--- snippets/sh.snippets | 16 +- snippets/snippets.snippets | 4 +- snippets/sql.snippets | 24 +- snippets/tcl.snippets | 38 +- snippets/tex.snippets | 128 +++--- snippets/textile.snippets | 12 +- snippets/vim.snippets | 22 +- snippets/xslt.snippets | 48 +- snippets/yii-chtml.snippets | 122 ++--- snippets/yii.snippets | 84 ++-- snippets/zsh.snippets | 32 +- 60 files changed, 2624 insertions(+), 2624 deletions(-) diff --git a/snippets/_.snippets b/snippets/_.snippets index 6204aee5d..6a3d8b280 100644 --- a/snippets/_.snippets +++ b/snippets/_.snippets @@ -2,7 +2,7 @@ # (c) holds no legal value ;) snippet c) - Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2} + Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved. snippet date `strftime("%Y-%m-%d")` snippet ddate @@ -30,7 +30,7 @@ snippet GPL2 You should have received a copy of the GNU General Public License along with this program; if not, see . - ${3} + ${0} snippet LGPL2 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -48,7 +48,7 @@ snippet LGPL2 You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . - ${3} + ${0} snippet GPL3 ${1:one line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -66,7 +66,7 @@ snippet GPL3 You should have received a copy of the GNU General Public License along with this program. If not, see . - ${3} + ${0} snippet LGPL3 ${1:One line to give the program's name and a brief description.} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -84,7 +84,7 @@ snippet LGPL3 You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . - ${3} + ${0} snippet BSD2 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -114,7 +114,7 @@ snippet BSD2 are those of the authors and should not be interpreted as representing official policies, either expressedor implied, of $2. - ${4} + ${0} snippet BSD3 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -142,7 +142,7 @@ snippet BSD3 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ${4} + ${0} snippet BSD4 ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -173,7 +173,7 @@ snippet BSD4 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ${4} + ${0} snippet MIT ${1:one line to give the program's name and a brief description} Copyright (C) `strftime("%Y")` ${2:copyright holder} @@ -196,7 +196,7 @@ snippet MIT TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ${3} + ${0} snippet APACHE ${1:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${2:copyright holder} @@ -213,7 +213,7 @@ snippet APACHE See the License for the specific language governing permissions and limitations under the License. - ${3} + ${0} snippet BEERWARE ${2:one line to give the program's name and a brief description} Copyright `strftime("%Y")` ${3:copyright holder} @@ -223,13 +223,13 @@ snippet BEERWARE can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer or coffee in return - ${4} + ${0} snippet WTFPL DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 - Copyright `strftime("%Y")` ${1:copyright holder} + Copyright `strftime("%Y")` ${0:copyright holder} Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long diff --git a/snippets/actionscript.snippets b/snippets/actionscript.snippets index 1aeca1c93..6b1d8ebe6 100644 --- a/snippets/actionscript.snippets +++ b/snippets/actionscript.snippets @@ -20,7 +20,7 @@ snippet main } snippet class - ${1:public|internal} class ${2:name} ${3:extends } { + ${1:public|internal} class ${2:name} ${0:extends } { public function $2 ( ) { ("start"); } @@ -28,7 +28,7 @@ snippet class snippet all package name { - ${1:public|internal|final} class ${2:name} ${3:extends } { + ${1:public|internal|final} class ${2:name} ${0:extends } { private|public| static const FOO = "abc"; private|public| static var BAR = "abc"; @@ -55,48 +55,48 @@ snippet all snippet switch switch(${1}){ case ${2}: - ${3} + ${0} break; default: } snippet case case ${1}: - ${2} + ${0} break; snippet package package ${1:package}{ - ${2} + ${0} } snippet wh while ${1:cond}{ - ${2} + ${0} } snippet do do { - ${2} + ${0} } while (${1:cond}) snippet wh while ${1:cond}{ - ${2} + ${0} } snippet for enumerate names for (${1:var} in ${2:object}){ - ${3} + ${0} } snippet for enumerate values for each (${1:var} in ${2:object}){ - ${3} + ${0} } snippet get_set function get ${1:name} { return ${2} } function set $1 (newValue) { - ${3} + ${0} } snippet interface interface name { - function method(${1}):${2:returntype}; + function method(${1}):${0:returntype}; } snippet try try { @@ -104,34 +104,34 @@ snippet try } catch (error:ErrorType) { ${2} } finally { - ${3} + ${0} } # For Loop (same as c.snippet) snippet for for (..) {..} for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4} + ${0} } # Custom For Loop snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5} + ${0} } # If Condition snippet if if (${1:/* condition */}) { - ${2} + ${0} } snippet el else { - ${1} + ${0} } # Ternary conditional snippet t - ${1:/* condition */} ? ${2:a} : ${3:b} + ${1:/* condition */} ? ${2:a} : ${0:b} snippet fun function ${1:function_name}(${2})${3} { - ${4} + ${0} } # FlxSprite (usefull when using the flixel library) snippet FlxSprite @@ -150,7 +150,7 @@ snippet FlxSprite override public function update():void { super.update(); - ${5} + ${0} } } } diff --git a/snippets/apache.snippets b/snippets/apache.snippets index 6f0c8873f..db3256e95 100644 --- a/snippets/apache.snippets +++ b/snippets/apache.snippets @@ -2,34 +2,34 @@ # snippet dir - DirectoryIndex ${2:index.html} + DirectoryIndex ${0:index.html} Order Deny,Allow Deny from All # snippet filesmatch - ${2} + ${0} # snippet ifmodule - ${2} + ${0} # snippet limitexcept - ${2} + ${0} # snippet proxy - ${2} + ${0} # snippet virtualhost ServerAdmin ${3:webmaster@example.com} DocumentRoot ${4:/www/example.com} - ServerName ${5:www.example.com} + ServerName ${0:www.example.com} diff --git a/snippets/autoit.snippets b/snippets/autoit.snippets index b214fd2b2..f973fbc37 100644 --- a/snippets/autoit.snippets +++ b/snippets/autoit.snippets @@ -1,19 +1,19 @@ snippet if If ${1:condition} Then - ${2:; True code} + ${0:; True code} EndIf snippet el Else - ${1} + ${0} snippet eif ElseIf ${1:condition} Then - ${2:; True code} + ${0:; True code} # If/Else block snippet ife If ${1:condition} Then ${2:; True code} Else - ${3:; Else code} + ${0:; Else code} EndIf # If/ElseIf/Else block - because there is eif this is not really neccessary snippet ifelif @@ -22,45 +22,45 @@ snippet ifelif ElseIf ${3:condition 2} Then ${4:; True code} Else - ${5:; Else code} + ${0:; Else code} EndIf # Switch block snippet switch Switch (${1:condition}) - Case {$2:case1}: - {$3:; Case 1 code} + Case ${2:case1}: + ${3:; Case 1 code} Case Else: - {$4:; Else code} + ${0:; Else code} EndSwitch # Select block snippet select Select (${1:condition}) - Case {$2:case1}: - {$3:; Case 1 code} + Case ${2:case1}: + ${3:; Case 1 code} Case Else: - {$4:; Else code} + ${0:; Else code} EndSelect # While loop snippet wh While (${1:condition}) - ${2:; code...} + ${0:; code...} WEnd # For loop snippet for For ${1:n} = ${3:1} to ${2:count} - ${4:; code...} + ${0:; code...} Next # New Function snippet func Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${4:Return} + ${0:Return} EndFunc # Message box snippet msg - MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"}) + MsgBox(${0:MsgType}, ${1:"Title"}, ${2:"Message Text"}) # Debug Message snippet debug - MsgBox(0, "Debug", ${1:"Debug Message"}) + MsgBox(0, "Debug", ${0:"Debug Message"}) # Show Variable Debug Message snippet showvar - MsgBox(0, "${1:VarName}", $1) + MsgBox(0, "${0:VarName}", $1) diff --git a/snippets/c.snippets b/snippets/c.snippets index 757802438..96e19a0ab 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -3,29 +3,29 @@ snippet main int main(int argc, const char *argv[]) { - ${1} + ${0} return 0; } # main(void) snippet mainn int main(void) { - ${1} + ${0} return 0; } ## ## Preprocessor # #include <...> snippet inc - #include <${1:stdio}.h>${2} + #include <${1:stdio}.h> # #include "..." snippet Inc - #include "${1:`vim_snippets#Filename("$1.h")`}"${2} + #include "${1:`vim_snippets#Filename("$1.h")`}" # ifndef...define...endif snippet ndef #ifndef $1 #define ${1:SYMBOL} ${2:value} - #endif${3} + #endif # define snippet def #define @@ -33,11 +33,11 @@ snippet def snippet ifdef #ifdef ${1:FOO} ${2:#define } - #endif${3} + #endif # if snippet #if #if ${1:FOO} - ${2} + ${0} #endif # header include guard snippet once @@ -45,7 +45,7 @@ snippet once #define $1 - ${2} + ${0} #endif /* end of include guard: $1 */ ## @@ -54,20 +54,20 @@ snippet once snippet if if (${1:/* condition */}) { ${2} - }${3} + } # else snippet el else { ${1} - }${2} + } # else if snippet elif else if (${1:/* condition */}) { ${2} - }${3} + } # ifi snippet ifi - if (${1:/* condition */}) ${2};${3} + if (${1:/* condition */}) ${2}; # ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b} @@ -79,41 +79,41 @@ snippet switch ${4:break;}${5} default: ${6} - }${7} + } # switch without default snippet switchndef switch (${1:/* variable */}) { case ${2:/* variable case */}: ${3} ${4:break;}${5} - }${6} + } # case snippet case case ${1:/* variable case */}: ${2} - ${3:break;}${4} + ${3:break;} ## ## Loops # for snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4} - }${5} + } # for (custom) snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { ${5} - }${6} + } # while snippet wh while (${1:/* condition */}) { ${2} - }${3} + } # do... while snippet do do { ${2} - } while (${1:/* condition */});${3} + } while (${1:/* condition */}); ## ## Functions # function definition @@ -121,38 +121,38 @@ snippet fun ${1:void} ${2:function_name}(${3}) { ${4} - }${5} + } # function declaration snippet fund - ${1:void} ${2:function_name}(${3});${4} + ${1:void} ${2:function_name}(${3}); ## ## Types # typedef snippet td - typedef ${1:int} ${2:MyCustomType};${3} + typedef ${1:int} ${2:MyCustomType}; # struct snippet st struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { ${2:/* data */} - }${3: /* optional variable list */};${4} + }${3: /* optional variable list */}; # typedef struct snippet tds typedef struct ${2:_$1 }{ ${3:/* data */} - } ${1:`vim_snippets#Filename('$1_t', 'name')`};${4} + } ${1:`vim_snippets#Filename('$1_t', 'name')`}; # typedef enum snippet tde typedef enum { ${1:/* data */} - } ${2:foo};${3} + } ${2:foo}; ## ## Input/Output # printf snippet pr - printf("${1:%s}\n"${2});${3} + printf("${1:%s}\n"${2}); # fprintf (again, this isn't as nice as TextMate's version, but it works) snippet fpr - fprintf(${1:stderr}, "${2:%s}\n"${3});${4} + fprintf(${1:stderr}, "${2:%s}\n"${3}); # getopt snippet getopt int choice; @@ -207,14 +207,14 @@ snippet getopt { while ( optind < argc ) { - ${4} + ${0} } } ## ## Miscellaneous # This is kind of convenient snippet . - [${1}]${2} + [${1}] # GPL snippet gpl /* @@ -234,4 +234,4 @@ snippet gpl * Copyright (C) ${1:Author}, `strftime("%Y")` */ - ${2} + ${0} diff --git a/snippets/chef.snippets b/snippets/chef.snippets index d44f535ec..429146ad6 100644 --- a/snippets/chef.snippets +++ b/snippets/chef.snippets @@ -17,7 +17,7 @@ snippet cookbook_file ${14:#}${15: action :create} # Create this file (Default) ${16:#}${17: action :create_if_missing} # Create only if it doesn't exist yet - ${18:#}${19: action :delete} # Delete this file + ${18:#}${0: action :delete} # Delete this file end snippet execute @@ -34,7 +34,7 @@ snippet execute ${18:#}umask ${19:nil} # Umask for files created by the command ${20:#}${21:action :run} # Run this command (Default) - ${22:#}${23:action :nothing} # Do not run this command + ${22:#}${0:action :nothing} # Do not run this command end snippet link @@ -46,7 +46,7 @@ snippet link ${8:#}group ${9} # The group of the symlink ${10:#}${11:action :create} # Create a link (Default) - ${12:#}${13:action :delete} # Delete a link + ${12:#}${0:action :delete} # Delete a link end snippet package @@ -61,7 +61,7 @@ snippet package ${12:#}${13:action :install} # Install a package - if version is provided, install that specific version (Default) ${14:#}${15:action :upgrade} # Upgrade a package - if version is provided, upgrade to that specific version ${16:#}${17:action :remove} # Remove a package - ${18:#}${19:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself) + ${18:#}${0:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself) end snippet service @@ -83,7 +83,7 @@ snippet service ${26:#}${27:action :start} # Start this service ${28:#}${29:action :stop} # Stop this service ${30:#}${31:action :restart} # Restart this service - ${32:#}${33:action :reload} # Reload the configuration for this service + ${32:#}${0:action :reload} # Reload the configuration for this service end snippet file @@ -97,7 +97,7 @@ snippet file ${12:#}${13:action :create} # Create this file (Default) ${14:#}${15:action :delete} # Delete this file - ${16:#}${17:action :touch} # Touch this file (update the mtime/atime) + ${16:#}${0:action :touch} # Touch this file (update the mtime/atime) end snippet directory @@ -109,7 +109,7 @@ snippet directory ${10:#}recursive ${11:false} # When deleting the directory, delete it recursively. When creating the directory, create recursively (ie, mkdir -p) ${12:#}${13:action :create} # Create this directory (Default) - ${14:#}${15:action :delete} # Delete this directory + ${14:#}${0:action :delete} # Delete this directory end snippet template @@ -127,7 +127,7 @@ snippet template ${20:#}${21:action :create} # Create the file (Default) ${22:#}${23:action :delete} # Delete this file - ${24:#}${25:action :touch} # Touch this file (update the mtime/atime) + ${24:#}${0:action :touch} # Touch this file (update the mtime/atime) end snippet svn @@ -144,7 +144,7 @@ snippet svn ${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default) ${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available - ${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts + ${22:#}${0:action :export} # Export the source, excluding or removing any version control artifacts end snippet git @@ -162,7 +162,7 @@ snippet git ${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default) ${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available - ${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts + ${24:#}${0:action :export} # Export the source, excluding or removing any version control artifacts end snippet deploy @@ -200,5 +200,5 @@ snippet deploy ${60:#}${61::deploy} # Deploy the application (Default) ${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place - ${64:#}${65::rollback} # Rollback the application to the previous release + ${64:#}${0::rollback} # Rollback the application to the previous release end diff --git a/snippets/clojure.snippets b/snippets/clojure.snippets index 59867b755..6fd653fcc 100644 --- a/snippets/clojure.snippets +++ b/snippets/clojure.snippets @@ -1,90 +1,90 @@ snippet comm (comment - ${1} + ${0} ) snippet condp (condp ${1:pred} ${2:expr} - ${3}) + ${0}) snippet def - (def ${1}) + (def ${0}) snippet defm (defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}] - ${5}) + ${0}) snippet defmm - (defmulti ${1:name} "${2:doc-string}" ${3:dispatch-fn}) + (defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn}) snippet defma - (defmacro ${1:name} "${2:doc-string}" ${3:dispatch-fn}) + (defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn}) snippet defn (defn ${1:name} "${2:doc-string}" [${3:arg-list}] - ${4}) + ${0}) snippet defp (defprotocol ${1:name} - ${2}) + ${0}) snippet defr (defrecord ${1:name} [${2:fields}] ${3:protocol} - ${4}) + ${0}) snippet deft (deftest ${1:name} (is (= ${2:assertion}))) - ${3}) + ${0}) snippet is - (is (= ${1} ${2})) + (is (= ${1} ${0})) snippet defty (deftype ${1:Name} [${2:fields}] ${3:Protocol} - ${4}) + ${0}) snippet doseq (doseq [${1:elem} ${2:coll}] - ${3}) + ${0}) snippet fn - (fn [${1:arg-list}] ${2}) + (fn [${1:arg-list}] ${0}) snippet if (if ${1:test-expr} ${2:then-expr} - ${3:else-expr}) + ${0:else-expr}) snippet if-let (if-let [${1:result} ${2:test-expr}] (${3:then-expr} $1) - (${4:else-expr})) + (${0:else-expr})) snippet imp (:import [${1:package}]) - & {:keys [${1:keys}] :or {${2:defaults}}} + & {:keys [${1:keys}] :or {${0:defaults}}} snippet let (let [${1:name} ${2:expr}] - ${3}) + ${0}) snippet letfn (letfn [(${1:name) [${2:args}] - ${3})]) + ${0})]) snippet map - (map ${1:func} ${2:coll}) + (map ${1:func} ${0:coll}) snippet mapl - (map #(${1:lambda}) ${2:coll}) + (map #(${1:lambda}) ${0:coll}) snippet met (${1:name} [${2:this} ${3:args}] - ${4}) + ${0}) snippet ns (ns ${1:name} - ${2}) + ${0}) snippet dotimes (dotimes [_ 10] (time (dotimes [_ ${1:times}] - ${2}))) + ${0}))) snippet pmethod - (${1:name} [${2:this} ${3:args}]) + (${1:name} [${2:this} ${0:args}]) snippet refer - (:refer-clojure :exclude [${1}]) + (:refer-clojure :exclude [${0}]) snippet require - (:require [${1:namespace} :as [${2}]]) + (:require [${1:namespace} :as [${0}]]) snippet use - (:use [${1:namespace} :only [${2}]]) + (:use [${1:namespace} :only [${0}]]) snippet print - (println ${1}) + (println ${0}) snippet reduce (reduce ${1:(fn [p n] ${3})} ${2}) snippet when - (when ${1:test} ${2:body}) + (when ${1:test} ${0:body}) snippet when-let (when-let [${1:result} ${2:test}] - ${3:body}) + ${0:body}) diff --git a/snippets/cmake.snippets b/snippets/cmake.snippets index 0c3a21576..ef2256a40 100644 --- a/snippets/cmake.snippets +++ b/snippets/cmake.snippets @@ -8,7 +8,7 @@ snippet cmake ${$2_INCLUDE_DIR} ) - ADD_SUBDIRECTORY(${3:src}) + ADD_SUBDIRECTORY(${0:src}) ADD_EXECUTABLE($1) @@ -18,41 +18,41 @@ snippet cmake snippet include INCLUDE_DIRECTORIES( - ${${1:INCLUDE_DIR}} + ${${0:INCLUDE_DIR}} ) snippet find - FIND_PACKAGE(${1:LIBRARY}) + FIND_PACKAGE(${0:LIBRARY}) snippet glob - FILE(GLOB ${1:SRCS} *.${2:cpp}) + FILE(GLOB ${1:SRCS} *.${0:cpp}) snippet subdir - ADD_SUBDIRECTORY(${1:src}) + ADD_SUBDIRECTORY(${0:src}) snippet lib ADD_LIBRARY(${1:lib} ${2:STATIC} - ${${3:SRCS}} + ${${0:SRCS}} ) snippet link TARGET_LINK_LIBRARIES(${1:bin} - ${2:somelib} + ${0:somelib} ) snippet bin ADD_EXECUTABLE(${1:bin}) snippet set - SET(${1:var} ${2:val}) + SET(${1:var} ${0:val}) snippet dep ADD_DEPENDENCIES(${1:target} - ${2:dep} + ${0:dep} ) snippet props SET_TARGET_PROPERTIES(${1:target} ${2:PROPERTIES} ${3:COMPILE_FLAGS} - ${4:"-O3 -Wall -pedantic"} + ${0:"-O3 -Wall -pedantic"} ) diff --git a/snippets/coffee.snippets b/snippets/coffee.snippets index 8e2f20e0b..aca6e81aa 100644 --- a/snippets/coffee.snippets +++ b/snippets/coffee.snippets @@ -2,94 +2,94 @@ snippet forindo for ${1:name} in ${2:array} do ($1) -> - ${3:// body} + ${0:// body} # Array comprehension snippet fora for ${1:name} in ${2:array} - ${3:# body...} + ${0:# body...} # Object comprehension snippet foro for ${1:key}, ${2:value} of ${3:object} - ${4:# body...} + ${0:# body...} # Range comprehension (inclusive) snippet forr for ${1:name} in [${2:start}..${3:finish}] - ${4:# body...} + ${0:# body...} snippet forrb for ${1:name} in [${2:start}..${3:finish}] by ${4:step} - ${5:# body...} + ${0:# body...} # Range comprehension (exclusive) snippet forrex for ${1:name} in [${2:start}...${3:finish}] - ${4:# body...} + ${0:# body...} snippet forrexb for ${1:name} in [${2:start}...${3:finish}] by ${4:step} - ${5:# body...} + ${0:# body...} # Function snippet fun (${1:args}) -> - ${2:# body...} + ${0:# body...} # Function (bound) snippet bfun (${1:args}) => - ${2:# body...} + ${0:# body...} # Class snippet cla class .. class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - ${2} + ${0} snippet cla class .. constructor: .. class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} constructor: (${2:args}) -> ${3} - ${4} + ${0} snippet cla class .. extends .. class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} - ${3} + ${0} snippet cla class .. extends .. constructor: .. class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} constructor: (${3:args}) -> ${4} - ${5} + ${0} # If snippet if if ${1:condition} - ${2:# body...} + ${0:# body...} # If __ Else snippet ife if ${1:condition} ${2:# body...} else - ${3:# body...} + ${0:# body...} # Else if snippet eif else if ${1:condition} - ${2:# body...} + ${0:# body...} # Ternary If snippet ifte - if ${1:condition} then ${2:value} else ${3:other} + if ${1:condition} then ${2:value} else ${0:other} # Unless snippet unl - ${1:action} unless ${2:condition} + ${1:action} unless ${0:condition} # Switch snippet swi switch ${1:object} when ${2:value} - ${3:# body...} + ${0:# body...} # Log snippet log - console.log ${1} + console.log ${0} # Try __ Catch snippet try try ${1} catch ${2:error} - ${3} + ${0} # Require snippet req - ${2:$1} = require '${1:sys}'${3} + ${2:$1} = require '${1:sys}' # Export snippet exp - ${1:root} = exports ? this + ${0:root} = exports ? this diff --git a/snippets/cpp.snippets b/snippets/cpp.snippets index 1fa9ec876..cdccf1eba 100644 --- a/snippets/cpp.snippets +++ b/snippets/cpp.snippets @@ -1,52 +1,52 @@ ## STL Collections # std::array snippet array - std::array<${1:T}, ${2:N}> ${3};${4} + std::array<${1:T}, ${2:N}> ${3}; # std::vector snippet vector - std::vector<${1:T}> ${2};${3} + std::vector<${1:T}> ${2}; # std::deque snippet deque - std::deque<${1:T}> ${2};${3} + std::deque<${1:T}> ${2}; # std::forward_list snippet flist - std::forward_list<${1:T}> ${2};${3} + std::forward_list<${1:T}> ${2}; # std::list snippet list - std::list<${1:T}> ${2};${3} + std::list<${1:T}> ${2}; # std::set snippet set - std::set<${1:T}> ${2};${3} + std::set<${1:T}> ${2}; # std::map snippet map - std::map<${1:Key}, ${2:T}> ${3};${4} + std::map<${1:Key}, ${2:T}> ${3}; # std::multiset snippet mset - std::multiset<${1:T}> ${2};${3} + std::multiset<${1:T}> ${2}; # std::multimap snippet mmap - std::multimap<${1:Key}, ${2:T}> ${3};${4} + std::multimap<${1:Key}, ${2:T}> ${3}; # std::unordered_set snippet uset - std::unordered_set<${1:T}> ${2};${3} + std::unordered_set<${1:T}> ${2}; # std::unordered_map snippet umap - std::unordered_map<${1:Key}, ${2:T}> ${3};${4} + std::unordered_map<${1:Key}, ${2:T}> ${3}; # std::unordered_multiset snippet umset - std::unordered_multiset<${1:T}> ${2};${3} + std::unordered_multiset<${1:T}> ${2}; # std::unordered_multimap snippet ummap - std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4} + std::unordered_multimap<${1:Key}, ${2:T}> ${3}; # std::stack snippet stack - std::stack<${1:T}> ${2};${3} + std::stack<${1:T}> ${2}; # std::queue snippet queue - std::queue<${1:T}> ${2};${3} + std::queue<${1:T}> ${2}; # std::priority_queue snippet pqueue - std::priority_queue<${1:T}> ${2};${3} + std::priority_queue<${1:T}> ${2}; ## ## Access Modifiers # private @@ -75,57 +75,57 @@ snippet cl ~$1(); private: - ${3:/* data */} + ${0:/* data */} }; # member function implementation snippet mfun ${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5} + ${0} } # namespace snippet ns namespace ${1:`vim_snippets#Filename('', 'my')`} { - ${2} + ${0} } /* namespace $1 */ ## ## Input/Output # std::cout snippet cout - std::cout << ${1} << std::endl;${2} + std::cout << ${1} << std::endl; # std::cin snippet cin - std::cin >> ${1};${2} + std::cin >> ${1}; ## ## Iteration # for i snippet fori for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4} - }${5} + } # foreach snippet fore for (${1:auto} ${2:i} : ${3:container}) { ${4} - }${5} + } # iterator snippet iter for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { ${6} - }${7} + } # auto iterator snippet itera for (auto ${1:i} = ${2:container}.begin(); $1 != $2.end(); ++$1) { ${3:std::cout << *$1 << std::endl;} - }${4} + } ## ## Lambdas # lamda (one line) snippet ld - [${1}](${2}){${3}}${4} + [${1}](${2}){${3}} # lambda (multi-line) snippet lld [${1}](${2}){ ${3} - }${4} + } diff --git a/snippets/cs.snippets b/snippets/cs.snippets index 9a915f094..e537bce4c 100644 --- a/snippets/cs.snippets +++ b/snippets/cs.snippets @@ -59,203 +59,203 @@ # entry point snippet sim public static int Main(string[] args) { - ${1} + ${0} return 0; } snippet simc public class Application { public static int Main(string[] args) { - ${1} + ${0} return 0; } } # if condition snippet if if (${1}) { - ${2} + ${0} } snippet el else { - ${1} + ${0} } snippet ifs if (${1}) - ${2} + ${0} # ternary conditional snippet t - ${1} ? ${2} : ${3} + ${1} ? ${2} : ${0} snippet ? - ${1} ? ${2} : ${3} + ${1} ? ${2} : ${0} # do while loop snippet do do { - ${2} + ${0} } while (${1}); # while loop snippet wh while (${1}) { - ${2} + ${0} } # for loop snippet for for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) { - ${4} + ${0} } # foreach snippet fore foreach (var ${1:entry} in ${2}) { - ${3} + ${0} } snippet foreach foreach (var ${1:entry} in ${2}) { - ${3} + ${0} } snippet each foreach (var ${1:entry} in ${2}) { - ${3} + ${0} } # interfaces snippet interface public interface ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet if+ public interface ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } # class bodies snippet class public class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet cls ${2:public} class ${1:`vim_snippets#Filename()`} { - ${3} + ${0} } snippet cls+ public class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet cls+^ public static class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet cls& internal class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet cls&^ internal static class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet cls| protected class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } snippet cls|% protected abstract class ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } # constructor snippet ctor public ${1:`vim_snippets#Filename()`}() { - ${2} + ${0} } # properties - auto properties by default. # default type is int with layout get / set. snippet prop - ${1:public} ${2:int} ${3:} { get; set; }${4} + ${1:public} ${2:int} ${3:} { get; set; } snippet p - ${1:public} ${2:int} ${3:} { get; set; }${4} + ${1:public} ${2:int} ${3:} { get; set; } snippet p+ - public ${1:int} ${2:} { get; set; }${3} + public ${1:int} ${2:} { get; set; } snippet p+& - public ${1:int} ${2:} { get; internal set; }${3} + public ${1:int} ${2:} { get; internal set; } snippet p+| - public ${1:int} ${2:} { get; protected set; }${3} + public ${1:int} ${2:} { get; protected set; } snippet p+- - public ${1:int} ${2:} { get; private set; }${3} + public ${1:int} ${2:} { get; private set; } snippet p& - internal ${1:int} ${2:} { get; set; }${3} + internal ${1:int} ${2:} { get; set; } snippet p&| - internal ${1:int} ${2:} { get; protected set; }${3} + internal ${1:int} ${2:} { get; protected set; } snippet p&- - internal ${1:int} ${2:} { get; private set; }${3} + internal ${1:int} ${2:} { get; private set; } snippet p| - protected ${1:int} ${2:} { get; set; }${3} + protected ${1:int} ${2:} { get; set; } snippet p|- - protected ${1:int} ${2:} { get; private set; }${3} + protected ${1:int} ${2:} { get; private set; } snippet p- - private ${1:int} ${2:} { get; set; }${3} + private ${1:int} ${2:} { get; set; } # property - bool snippet pi - ${1:public} int ${2:} { get; set; }${3} + ${1:public} int ${2:} { get; set; } snippet pi+ - public int ${1} { get; set; }${2} + public int ${1} { get; set; } snippet pi+& - public int ${1} { get; internal set; }${2} + public int ${1} { get; internal set; } snippet pi+| - public int ${1} { get; protected set; }${2} + public int ${1} { get; protected set; } snippet pi+- - public int ${1} { get; private set; }${2} + public int ${1} { get; private set; } snippet pi& - internal int ${1} { get; set; }${2} + internal int ${1} { get; set; } snippet pi&| - internal int ${1} { get; protected set; }${2} + internal int ${1} { get; protected set; } snippet pi&- - internal int ${1} { get; private set; }${2} + internal int ${1} { get; private set; } snippet pi| - protected int ${1} { get; set; }${2} + protected int ${1} { get; set; } snippet pi|- - protected int ${1} { get; private set; }${2} + protected int ${1} { get; private set; } snippet pi- - private int ${1} { get; set; }${2} + private int ${1} { get; set; } # property - bool snippet pb - ${1:public} bool ${2:} { get; set; }${3} + ${1:public} bool ${2:} { get; set; } snippet pb+ - public bool ${1} { get; set; }${2} + public bool ${1} { get; set; } snippet pb+& - public bool ${1} { get; internal set; }${2} + public bool ${1} { get; internal set; } snippet pb+| - public bool ${1} { get; protected set; }${2} + public bool ${1} { get; protected set; } snippet pb+- - public bool ${1} { get; private set; }${2} + public bool ${1} { get; private set; } snippet pb& - internal bool ${1} { get; set; }${2} + internal bool ${1} { get; set; } snippet pb&| - internal bool ${1} { get; protected set; }${2} + internal bool ${1} { get; protected set; } snippet pb&- - internal bool ${1} { get; private set; }${2} + internal bool ${1} { get; private set; } snippet pb| - protected bool ${1} { get; set; }${2} + protected bool ${1} { get; set; } snippet pb|- - protected bool ${1} { get; private set; }${2} + protected bool ${1} { get; private set; } snippet pb- - private bool ${1} { get; set; }${2} + private bool ${1} { get; set; } # property - string snippet ps - ${1:public} string ${2:} { get; set; }${3} + ${1:public} string ${2:} { get; set; } snippet ps+ - public string ${1} { get; set; }${2} + public string ${1} { get; set; } snippet ps+& - public string ${1} { get; internal set; }${2} + public string ${1} { get; internal set; } snippet ps+| - public string ${1} { get; protected set; }${2} + public string ${1} { get; protected set; } snippet ps+- - public string ${1} { get; private set; }${2} + public string ${1} { get; private set; } snippet ps& - internal string ${1} { get; set; }${2} + internal string ${1} { get; set; } snippet ps&| - internal string ${1} { get; protected set; }${2} + internal string ${1} { get; protected set; } snippet ps&- - internal string ${1} { get; private set; }${2} + internal string ${1} { get; private set; } snippet ps| - protected string ${1} { get; set; }${2} + protected string ${1} { get; set; } snippet ps|- - protected string ${1} { get; private set; }${2} + protected string ${1} { get; private set; } snippet ps- - private string ${1} { get; set; }${2} + private string ${1} { get; set; } # members - void snippet m ${1:public} ${2:void} ${3:}(${4:}) { @@ -343,32 +343,32 @@ snippet ms- # structure snippet struct public struct ${1:`vim_snippets#Filename()`} { - ${2} + ${0} } # enumeration snippet enum public enum ${1} { - ${2} + ${0} } # preprocessor directives snippet #if #if - ${1} + ${0} #endif # inline xml documentation snippet /// /// - /// ${1} + /// ${0} /// snippet
    - ${1} + ${0}
    snippet area - ${4} + ${0} snippet area+ ${4} - area+${5} + area+ snippet area:c - ${3} + ${0} snippet area:d - ${3} + ${0} snippet area:p - ${3} + ${0} snippet area:r - ${3} + ${0} snippet article
    - ${1} + ${0}
    snippet article.
    - ${2} + ${0}
    snippet article#
    - ${2} + ${0}
    snippet aside snippet aside. snippet aside# snippet audio - snippet b - ${1} + ${0} snippet base - + snippet bdi - ${1} + ${0} snippet bdo - ${2} + ${0} snippet bdo:l - ${1} + ${0} snippet bdo:r - ${1} + ${0} snippet blockquote
    - ${1} + ${0}
    snippet body - ${1} + ${0} snippet br -
    ${1} +
    snippet button - + snippet button. - + snippet button# - + snippet button:s - + snippet button:r - + snippet canvas - ${1} + ${0} snippet caption - ${1} + ${0} snippet cite - ${1} + ${0} snippet code - ${1} + ${0} snippet col - ${1} + snippet col+ - col+${1} + col+ snippet colgroup - ${1} + ${0} snippet colgroup+ - col+${1} + col+${0} snippet command - + snippet command:c - + snippet command:r - + snippet datagrid - ${1} + ${0} snippet datalist - ${1} + ${0} snippet datatemplate - ${1} + ${0} snippet dd -
    ${1}
    +
    ${0}
    snippet dd. -
    ${2}
    +
    ${0}
    snippet dd# -
    ${2}
    +
    ${0}
    snippet del - ${1} + ${0} snippet details -
    ${1}
    +
    ${0}
    snippet dfn - ${1} + ${0} snippet dialog - ${1} + ${0} snippet div
    - ${1} + ${0}
    snippet div.
    - ${2} + ${0}
    snippet div#
    - ${2} + ${0}
    snippet dl
    - ${1} + ${0}
    snippet dl.
    - ${2} + ${0}
    snippet dl#
    - ${2} + ${0}
    snippet dl+
    ${1}
    ${2}
    - dt+${3} + dt+${0}
    snippet dt -
    ${1}
    +
    ${0}
    snippet dt. -
    ${2}
    +
    ${0}
    snippet dt# -
    ${2}
    +
    ${0}
    snippet dt+
    ${1}
    ${2}
    - dt+${3} + dt+${0} snippet em - ${1} + ${0} snippet embed - snippet fieldset
    - ${1} + ${0}
    snippet fieldset.
    - ${2} + ${0}
    snippet fieldset#
    - ${2} + ${0}
    snippet fieldset+
    ${1} ${2}
    - fieldset+${3} + fieldset+${0} snippet figcaption -
    ${1}
    +
    ${0}
    snippet figure -
    ${1}
    +
    ${0}
    snippet footer
    - ${1} + ${0}
    snippet footer.
    - ${2} + ${0}
    snippet footer#
    - ${2} + ${0}
    snippet form
    - ${3} + ${0}
    snippet form.
    - ${4} + ${0}
    snippet form#
    - ${4} + ${0}
    snippet h1 -

    ${1}

    +

    ${0}

    snippet h1. -

    ${2}

    +

    ${0}

    snippet h1# -

    ${2}

    +

    ${0}

    snippet h2 -

    ${1}

    +

    ${0}

    snippet h2. -

    ${2}

    +

    ${0}

    snippet h2# -

    ${2}

    +

    ${0}

    snippet h3 -

    ${1}

    +

    ${0}

    snippet h3. -

    ${2}

    +

    ${0}

    snippet h3# -

    ${2}

    +

    ${0}

    snippet h4 -

    ${1}

    +

    ${0}

    snippet h4. -

    ${2}

    +

    ${0}

    snippet h4# -

    ${2}

    +

    ${0}

    snippet h5 -
    ${1}
    +
    ${0}
    snippet h5. -
    ${2}
    +
    ${0}
    snippet h5# -
    ${2}
    +
    ${0}
    snippet h6 -
    ${1}
    +
    ${0}
    snippet h6. -
    ${2}
    +
    ${0}
    snippet h6# -
    ${2}
    +
    ${0}
    snippet head ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} - ${2} + ${0} snippet header
    - ${1} + ${0}
    snippet header.
    - ${2} + ${0}
    snippet header#
    - ${2} + ${0}
    snippet hgroup
    - ${1} + ${0}
    snippet hgroup.
    - ${1} + ${0} snippet html5 @@ -454,175 +454,175 @@ snippet html5 ${2:meta} - ${3:body} + ${0:body} snippet i - ${1} + ${0} snippet iframe - ${2} + snippet iframe. - ${3} + snippet iframe# - ${3} + snippet img - ${2}${3} + ${2} snippet img. - ${3}${4} + ${3} snippet img# - ${3}${4} + ${3} snippet input - ${5} + snippet input. - ${6} + snippet input:text - ${4} + snippet input:submit - ${4} + snippet input:hidden - ${4} + snippet input:button - ${4} + snippet input:image - ${5} + snippet input:checkbox - ${3} + snippet input:radio - ${3} + snippet input:color - ${4} + snippet input:date - ${4} + snippet input:datetime - ${4} + snippet input:datetime-local - ${4} + snippet input:email - ${4} + snippet input:file - ${4} + snippet input:month - ${4} + snippet input:number - ${4} + snippet input:password - ${4} + snippet input:range - ${4} + snippet input:reset - ${4} + snippet input:search - ${4} + snippet input:time - ${4} + snippet input:url - ${4} + snippet input:week - ${4} + snippet ins - ${1} + ${0} snippet kbd - ${1} + ${0} snippet keygen - ${1} + ${0} snippet label - + snippet label:i - ${7} + snippet label:s snippet legend - ${1} + ${0} snippet legend+ - ${1} + ${0} snippet li -
  • ${1}
  • +
  • ${0}
  • snippet li. -
  • ${2}
  • +
  • ${0}
  • snippet li+
  • ${1}
  • - li+${2} + li+ snippet lia -
  • ${1}
  • +
  • ${1}
  • snippet lia+
  • ${1}
  • - lia+${3} + lia+ snippet link - ${5} + snippet link:atom - ${2} + snippet link:css - ${3} + snippet link:favicon - ${2} + snippet link:rss - ${2} + snippet link:touch - ${2} + snippet map - ${2} + ${0} snippet map. - ${3} + ${0} snippet map# ${5}${6} - ${7} + snippet mark - ${1} + ${0} snippet menu - ${1} + ${0} snippet menu:c - ${1} + ${0} snippet menu:t - ${1} + ${0} snippet meta - ${3} + snippet meta:compat - ${3} + snippet meta:refresh - ${3} + snippet meta:utf - ${3} + snippet meter - ${1} + ${0} snippet nav snippet nav. snippet nav# snippet noscript snippet object ${3} - ${4} + # Embed QT Movie snippet movie - ${6} + snippet ol
      - ${1} + ${0}
    snippet ol.
      - ${2} + ${0}
    snippet ol+
    1. ${1}
    2. - li+${2} + li+${0}
    snippet opt - + snippet opt+ - opt+${3} + opt+${0} snippet optt - + snippet optgroup - opt+${3} + opt+${0} snippet output - ${1} + ${0} snippet p -

    ${1}

    +

    ${0}

    snippet param - ${3} + snippet pre
    -		${1}
    +		${0}
     	
    snippet progress - ${1} + ${0} snippet q - ${1} + ${0} snippet rp - ${1} + ${0} snippet rt - ${1} + ${0} snippet ruby - ${1} + ${0} snippet s - ${1} + ${0} snippet samp - ${1} + ${0} snippet script snippet scriptsrc - + snippet section
    - ${1} + ${0}
    snippet section.
    - ${2} + ${0}
    snippet section#
    - ${2} + ${0}
    snippet select snippet select. snippet small - ${1} + ${0} snippet source - + snippet span - ${1} + ${0} snippet span. - ${2} + ${0} snippet span# - ${2} + ${0} snippet strong - ${1} + ${0} snippet style snippet sub - ${1} + ${0} snippet summary - ${1} + ${0} snippet sup - ${1} + ${0} snippet table - ${2} + ${0}
    snippet table. - ${3} + ${0}
    snippet table# - ${3} + ${0}
    snippet tbody - ${1} + ${0} snippet td - ${1} + ${0} snippet td. - ${2} + ${0} snippet td# - ${2} + ${0} snippet td+ ${1} - td+${2} + td+${0} snippet textarea - ${6} + snippet tfoot - ${1} + ${0} snippet th - ${1} + ${0} snippet th. - ${2} + ${0} snippet th# - ${2} + ${0} snippet th+ ${1} - th+${2} + th+${0} snippet thead - ${1} + ${0} snippet time - + snippet title - ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} + ${0:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} snippet tr - ${1} + ${0} snippet tr+ ${1} - td+${2} + td+${0} snippet track - - ${2} + ${0} snippet ul#
      - ${2} + ${0}
    snippet ul+
    • ${1}
    • - li+${2} + li+${0}
    snippet var - ${1} + ${0} snippet video -
    snippet hr -
    +
    snippet html ${0} @@ -493,59 +493,59 @@ snippet iframe. snippet iframe# snippet img - ${2} + ${2} snippet img. - ${3} + ${3} snippet img# - ${3} + ${3} snippet input - + snippet input. - + snippet input:text - + snippet input:submit - + snippet input:hidden - + snippet input:button - + snippet input:image - + snippet input:checkbox - + snippet input:radio - + snippet input:color - + snippet input:date - + snippet input:datetime - + snippet input:datetime-local - + snippet input:email - + snippet input:file - + snippet input:month - + snippet input:number - + snippet input:password - + snippet input:range - + snippet input:reset - + snippet input:search - + snippet input:time - + snippet input:url - + snippet input:week - + snippet ins ${0} snippet kbd @@ -579,19 +579,19 @@ snippet lia+
  • ${1}
  • lia+ snippet link - + snippet link:atom - + snippet link:s - + snippet link:css - + snippet link:favicon - + snippet link:rss - + snippet link:touch - + snippet main
    ${0} @@ -610,7 +610,7 @@ snippet map# snippet map+ - ${5}${6} + ${5}${6} snippet mark ${0} @@ -627,17 +627,17 @@ snippet menu:t ${0} snippet meta - + snippet meta:s - + snippet meta:d - + snippet meta:compat - + snippet meta:refresh - + snippet meta:utf - + snippet meter ${0} snippet nav @@ -665,13 +665,13 @@ snippet movie - - + + + pluginspage="http://www.apple.com/quicktime/download/"> snippet ol
      @@ -711,7 +711,7 @@ snippet p. snippet p#

      ${0}

      snippet param - + snippet pre
       		${0}
      @@ -774,7 +774,7 @@ snippet select+
       snippet small
       	${0}
       snippet source
      -	
      +	
       snippet span
       	${0}
       snippet span.
      @@ -876,4 +876,4 @@ snippet var
       snippet video
       	

    ${2:$1}${3} + ${2:$1} snippet ${2}${3} + ${2} snippet ${1}{${2} + ${1}{ snippet ${2} + snippet ${1}${2} + ${1} snippet ${1}${2} + ${1} diff --git a/snippets/css.snippets b/snippets/css.snippets index 72212d2d8..8886643a4 100644 --- a/snippets/css.snippets +++ b/snippets/css.snippets @@ -1,50 +1,50 @@ snippet . ${1} { - ${2} + ${0} } snippet ! !important snippet bdi:m+ - -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; + -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; snippet bdi:m - -moz-border-image: ${1}; + -moz-border-image: ${0}; snippet bdrz:m - -moz-border-radius: ${1}; + -moz-border-radius: ${0}; snippet bxsh:m+ - -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet bxsh:m - -moz-box-shadow: ${1}; + -moz-box-shadow: ${0}; snippet bdi:w+ - -webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; + -webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; snippet bdi:w - -webkit-border-image: ${1}; + -webkit-border-image: ${0}; snippet bdrz:w - -webkit-border-radius: ${1}; + -webkit-border-radius: ${0}; snippet bxsh:w+ - -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet bxsh:w - -webkit-box-shadow: ${1}; + -webkit-box-shadow: ${0}; snippet @f @font-face { font-family: ${1}; - src: url(${2}); + src: url(${0}); } snippet @i - @import url(${1}); + @import url(${0}); snippet @m @media ${1:print} { - ${2} + ${0} } snippet bg+ - background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${5:no-repeat}; + background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${0:no-repeat}; snippet bga - background-attachment: ${1}; + background-attachment: ${0}; snippet bga:f background-attachment: fixed; snippet bga:s background-attachment: scroll; snippet bgbk - background-break: ${1}; + background-break: ${0}; snippet bgbk:bb background-break: bounding-box; snippet bgbk:c @@ -52,7 +52,7 @@ snippet bgbk:c snippet bgbk:eb background-break: each-box; snippet bgcp - background-clip: ${1}; + background-clip: ${0}; snippet bgcp:bb background-clip: border-box; snippet bgcp:cb @@ -62,15 +62,15 @@ snippet bgcp:nc snippet bgcp:pb background-clip: padding-box; snippet bgc - background-color: #${1:FFF}; + background-color: #${0:FFF}; snippet bgc:t background-color: transparent; snippet bgi - background-image: url(${1}); + background-image: url(${0}); snippet bgi:n background-image: none; snippet bgo - background-origin: ${1}; + background-origin: ${0}; snippet bgo:bb background-origin: border-box; snippet bgo:cb @@ -78,13 +78,13 @@ snippet bgo:cb snippet bgo:pb background-origin: padding-box; snippet bgpx - background-position-x: ${1}; + background-position-x: ${0}; snippet bgpy - background-position-y: ${1}; + background-position-y: ${0}; snippet bgp - background-position: ${1:0} ${2:0}; + background-position: ${1:0} ${0:0}; snippet bgr - background-repeat: ${1}; + background-repeat: ${0}; snippet bgr:n background-repeat: no-repeat; snippet bgr:x @@ -94,7 +94,7 @@ snippet bgr:y snippet bgr:r background-repeat: repeat; snippet bgz - background-size: ${1}; + background-size: ${0}; snippet bgz:a background-size: auto; snippet bgz:ct @@ -102,67 +102,67 @@ snippet bgz:ct snippet bgz:cv background-size: cover; snippet bg - background: ${1}; + background: ${0}; snippet bg:ie - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${2:crop}'); + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${0:crop}'); snippet bg:n background: none; snippet bd+ - border: ${1:1px} ${2:solid} #${3:000}; + border: ${1:1px} ${2:solid} #${0:000}; snippet bdb+ - border-bottom: ${1:1px} ${2:solid} #${3:000}; + border-bottom: ${1:1px} ${2:solid} #${0:000}; snippet bdbc - border-bottom-color: #${1:000}; + border-bottom-color: #${0:000}; snippet bdbi - border-bottom-image: url(${1}); + border-bottom-image: url(${0}); snippet bdbi:n border-bottom-image: none; snippet bdbli - border-bottom-left-image: url(${1}); + border-bottom-left-image: url(${0}); snippet bdbli:c border-bottom-left-image: continue; snippet bdbli:n border-bottom-left-image: none; snippet bdblrz - border-bottom-left-radius: ${1}; + border-bottom-left-radius: ${0}; snippet bdbri - border-bottom-right-image: url(${1}); + border-bottom-right-image: url(${0}); snippet bdbri:c border-bottom-right-image: continue; snippet bdbri:n border-bottom-right-image: none; snippet bdbrrz - border-bottom-right-radius: ${1}; + border-bottom-right-radius: ${0}; snippet bdbs - border-bottom-style: ${1}; + border-bottom-style: ${0}; snippet bdbs:n border-bottom-style: none; snippet bdbw - border-bottom-width: ${1}; + border-bottom-width: ${0}; snippet bdb - border-bottom: ${1}; + border-bottom: ${0}; snippet bdb:n border-bottom: none; snippet bdbk - border-break: ${1}; + border-break: ${0}; snippet bdbk:c border-break: close; snippet bdcl - border-collapse: ${1}; + border-collapse: ${0}; snippet bdcl:c border-collapse: collapse; snippet bdcl:s border-collapse: separate; snippet bdc - border-color: #${1:000}; + border-color: #${0:000}; snippet bdci - border-corner-image: url(${1}); + border-corner-image: url(${0}); snippet bdci:c border-corner-image: continue; snippet bdci:n border-corner-image: none; snippet bdf - border-fit: ${1}; + border-fit: ${0}; snippet bdf:c border-fit: clip; snippet bdf:of @@ -178,55 +178,55 @@ snippet bdf:sp snippet bdf:st border-fit: stretch; snippet bdi - border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch}; + border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; snippet bdi:n border-image: none; snippet bdl+ - border-left: ${1:1px} ${2:solid} #${3:000}; + border-left: ${1:1px} ${2:solid} #${0:000}; snippet bdlc - border-left-color: #${1:000}; + border-left-color: #${0:000}; snippet bdli - border-left-image: url(${1}); + border-left-image: url(${0}); snippet bdli:n border-left-image: none; snippet bdls - border-left-style: ${1}; + border-left-style: ${0}; snippet bdls:n border-left-style: none; snippet bdlw - border-left-width: ${1}; + border-left-width: ${0}; snippet bdl - border-left: ${1}; + border-left: ${0}; snippet bdl:n border-left: none; snippet bdlt - border-length: ${1}; + border-length: ${0}; snippet bdlt:a border-length: auto; snippet bdrz - border-radius: ${1}; + border-radius: ${0}; snippet bdr+ - border-right: ${1:1px} ${2:solid} #${3:000}; + border-right: ${1:1px} ${2:solid} #${0:000}; snippet bdrc - border-right-color: #${1:000}; + border-right-color: #${0:000}; snippet bdri - border-right-image: url(${1}); + border-right-image: url(${0}); snippet bdri:n border-right-image: none; snippet bdrs - border-right-style: ${1}; + border-right-style: ${0}; snippet bdrs:n border-right-style: none; snippet bdrw - border-right-width: ${1}; + border-right-width: ${0}; snippet bdr - border-right: ${1}; + border-right: ${0}; snippet bdr:n border-right: none; snippet bdsp - border-spacing: ${1}; + border-spacing: ${0}; snippet bds - border-style: ${1}; + border-style: ${0}; snippet bds:ds border-style: dashed; snippet bds:dtds @@ -254,69 +254,69 @@ snippet bds:s snippet bds:w border-style: wave; snippet bdt+ - border-top: ${1:1px} ${2:solid} #${3:000}; + border-top: ${1:1px} ${2:solid} #${0:000}; snippet bdtc - border-top-color: #${1:000}; + border-top-color: #${0:000}; snippet bdti - border-top-image: url(${1}); + border-top-image: url(${0}); snippet bdti:n border-top-image: none; snippet bdtli - border-top-left-image: url(${1}); + border-top-left-image: url(${0}); snippet bdtli:c border-corner-image: continue; snippet bdtli:n border-corner-image: none; snippet bdtlrz - border-top-left-radius: ${1}; + border-top-left-radius: ${0}; snippet bdtri - border-top-right-image: url(${1}); + border-top-right-image: url(${0}); snippet bdtri:c border-top-right-image: continue; snippet bdtri:n border-top-right-image: none; snippet bdtrrz - border-top-right-radius: ${1}; + border-top-right-radius: ${0}; snippet bdts - border-top-style: ${1}; + border-top-style: ${0}; snippet bdts:n border-top-style: none; snippet bdtw - border-top-width: ${1}; + border-top-width: ${0}; snippet bdt - border-top: ${1}; + border-top: ${0}; snippet bdt:n border-top: none; snippet bdw - border-width: ${1}; + border-width: ${0}; snippet bd - border: ${1}; + border: ${0}; snippet bd:n border: none; snippet b - bottom: ${1}; + bottom: ${0}; snippet b:a bottom: auto; snippet bxsh+ - box-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet bxsh - box-shadow: ${1}; + box-shadow: ${0}; snippet bxsh:n box-shadow: none; snippet bxz - box-sizing: ${1}; + box-sizing: ${0}; snippet bxz:bb box-sizing: border-box; snippet bxz:cb box-sizing: content-box; snippet cps - caption-side: ${1}; + caption-side: ${0}; snippet cps:b caption-side: bottom; snippet cps:t caption-side: top; snippet cl - clear: ${1}; + clear: ${0}; snippet cl:b clear: both; snippet cl:l @@ -326,23 +326,23 @@ snippet cl:n snippet cl:r clear: right; snippet cp - clip: ${1}; + clip: ${0}; snippet cp:a clip: auto; snippet cp:r - clip: rect(${1:0} ${2:0} ${3:0} ${4:0}); + clip: rect(${1:0} ${2:0} ${3:0} ${0:0}); snippet c - color: #${1:000}; + color: #${0:000}; snippet ct - content: ${1}; + content: ${0}; snippet ct:a - content: attr(${1}); + content: attr(${0}); snippet ct:cq content: close-quote; snippet ct:c - content: counter(${1}); + content: counter(${0}); snippet ct:cs - content: counters(${1}); + content: counters(${0}); snippet ct:ncq content: no-close-quote; snippet ct:noq @@ -352,11 +352,11 @@ snippet ct:n snippet ct:oq content: open-quote; snippet coi - counter-increment: ${1}; + counter-increment: ${0}; snippet cor - counter-reset: ${1}; + counter-reset: ${0}; snippet cur - cursor: ${1}; + cursor: ${0}; snippet cur:a cursor: auto; snippet cur:c @@ -374,7 +374,7 @@ snippet cur:p snippet cur:t cursor: text; snippet d - display: ${1}; + display: ${0}; snippet d:mib display: -moz-inline-box; snippet d:mis @@ -414,7 +414,7 @@ snippet d:tbr snippet d:tb display: table; snippet ec - empty-cells: ${1}; + empty-cells: ${0}; snippet ec:h empty-cells: hide; snippet ec:s @@ -422,7 +422,7 @@ snippet ec:s snippet exp expression() snippet fl - float: ${1}; + float: ${0}; snippet fl:l float: left; snippet fl:n @@ -430,9 +430,9 @@ snippet fl:n snippet fl:r float: right; snippet f+ - font: ${1:1em} ${2:Arial},${3:sans-serif}; + font: ${1:1em} ${2:Arial},${0:sans-serif}; snippet fef - font-effect: ${1}; + font-effect: ${0}; snippet fef:eb font-effect: emboss; snippet fef:eg @@ -442,13 +442,13 @@ snippet fef:n snippet fef:o font-effect: outline; snippet femp - font-emphasize-position: ${1}; + font-emphasize-position: ${0}; snippet femp:a font-emphasize-position: after; snippet femp:b font-emphasize-position: before; snippet fems - font-emphasize-style: ${1}; + font-emphasize-style: ${0}; snippet fems:ac font-emphasize-style: accent; snippet fems:c @@ -460,27 +460,27 @@ snippet fems:dt snippet fems:n font-emphasize-style: none; snippet fem - font-emphasize: ${1}; + font-emphasize: ${0}; snippet ff - font-family: ${1}; + font-family: ${0}; snippet ff:c - font-family: ${1:'Monotype Corsiva','Comic Sans MS'},cursive; + font-family: ${0:'Monotype Corsiva','Comic Sans MS'},cursive; snippet ff:f - font-family: ${1:Capitals,Impact},fantasy; + font-family: ${0:Capitals,Impact},fantasy; snippet ff:m - font-family: ${1:Monaco,'Courier New'},monospace; + font-family: ${0:Monaco,'Courier New'},monospace; snippet ff:ss - font-family: ${1:Helvetica,Arial},sans-serif; + font-family: ${0:Helvetica,Arial},sans-serif; snippet ff:s - font-family: ${1:Georgia,'Times New Roman'},serif; + font-family: ${0:Georgia,'Times New Roman'},serif; snippet fza - font-size-adjust: ${1}; + font-size-adjust: ${0}; snippet fza:n font-size-adjust: none; snippet fz - font-size: ${1}; + font-size: ${0}; snippet fsm - font-smooth: ${1}; + font-smooth: ${0}; snippet fsm:aw font-smooth: always; snippet fsm:a @@ -488,7 +488,7 @@ snippet fsm:a snippet fsm:n font-smooth: never; snippet fst - font-stretch: ${1}; + font-stretch: ${0}; snippet fst:c font-stretch: condensed; snippet fst:e @@ -508,7 +508,7 @@ snippet fst:uc snippet fst:ue font-stretch: ultra-expanded; snippet fs - font-style: ${1}; + font-style: ${0}; snippet fs:i font-style: italic; snippet fs:n @@ -516,13 +516,13 @@ snippet fs:n snippet fs:o font-style: oblique; snippet fv - font-variant: ${1}; + font-variant: ${0}; snippet fv:n font-variant: normal; snippet fv:sc font-variant: small-caps; snippet fw - font-weight: ${1}; + font-weight: ${0}; snippet fw:b font-weight: bold; snippet fw:br @@ -532,31 +532,31 @@ snippet fw:lr snippet fw:n font-weight: normal; snippet f - font: ${1}; + font: ${0}; snippet h - height: ${1}; + height: ${0}; snippet h:a height: auto; snippet l - left: ${1}; + left: ${0}; snippet l:a left: auto; snippet lts - letter-spacing: ${1}; + letter-spacing: ${0}; snippet lh - line-height: ${1}; + line-height: ${0}; snippet lisi - list-style-image: url(${1}); + list-style-image: url(${0}); snippet lisi:n list-style-image: none; snippet lisp - list-style-position: ${1}; + list-style-position: ${0}; snippet lisp:i list-style-position: inside; snippet lisp:o list-style-position: outside; snippet list - list-style-type: ${1}; + list-style-type: ${0}; snippet list:c list-style-type: circle; snippet list:dclz @@ -574,75 +574,75 @@ snippet list:s snippet list:ur list-style-type: upper-roman; snippet lis - list-style: ${1}; + list-style: ${0}; snippet lis:n list-style: none; snippet mb - margin-bottom: ${1}; + margin-bottom: ${0}; snippet mb:a margin-bottom: auto; snippet ml - margin-left: ${1}; + margin-left: ${0}; snippet ml:a margin-left: auto; snippet mr - margin-right: ${1}; + margin-right: ${0}; snippet mr:a margin-right: auto; snippet mt - margin-top: ${1}; + margin-top: ${0}; snippet mt:a margin-top: auto; snippet m - margin: ${1}; + margin: ${0}; snippet m:4 - margin: ${1:0} ${2:0} ${3:0} ${4:0}; + margin: ${1:0} ${2:0} ${3:0} ${0:0}; snippet m:3 - margin: ${1:0} ${2:0} ${3:0}; + margin: ${1:0} ${2:0} ${0:0}; snippet m:2 - margin: ${1:0} ${2:0}; + margin: ${1:0} ${0:0}; snippet m:0 margin: 0; snippet m:a margin: auto; snippet mah - max-height: ${1}; + max-height: ${0}; snippet mah:n max-height: none; snippet maw - max-width: ${1}; + max-width: ${0}; snippet maw:n max-width: none; snippet mih - min-height: ${1}; + min-height: ${0}; snippet miw - min-width: ${1}; + min-width: ${0}; snippet op - opacity: ${1}; + opacity: ${0}; snippet op:ie - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100}); + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100}); snippet op:ms - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100})'; + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})'; snippet orp - orphans: ${1}; + orphans: ${0}; snippet o+ - outline: ${1:1px} ${2:solid} #${3:000}; + outline: ${1:1px} ${2:solid} #${0:000}; snippet oc - outline-color: ${1:#000}; + outline-color: ${0:#000}; snippet oc:i outline-color: invert; snippet oo - outline-offset: ${1}; + outline-offset: ${0}; snippet os - outline-style: ${1}; + outline-style: ${0}; snippet ow - outline-width: ${1}; + outline-width: ${0}; snippet o - outline: ${1}; + outline: ${0}; snippet o:n outline: none; snippet ovs - overflow-style: ${1}; + overflow-style: ${0}; snippet ovs:a overflow-style: auto; snippet ovs:mq @@ -654,7 +654,7 @@ snippet ovs:p snippet ovs:s overflow-style: scrollbar; snippet ovx - overflow-x: ${1}; + overflow-x: ${0}; snippet ovx:a overflow-x: auto; snippet ovx:h @@ -664,7 +664,7 @@ snippet ovx:s snippet ovx:v overflow-x: visible; snippet ovy - overflow-y: ${1}; + overflow-y: ${0}; snippet ovy:a overflow-y: auto; snippet ovy:h @@ -674,7 +674,7 @@ snippet ovy:s snippet ovy:v overflow-y: visible; snippet ov - overflow: ${1}; + overflow: ${0}; snippet ov:a overflow: auto; snippet ov:h @@ -684,25 +684,25 @@ snippet ov:s snippet ov:v overflow: visible; snippet pb - padding-bottom: ${1}; + padding-bottom: ${0}; snippet pl - padding-left: ${1}; + padding-left: ${0}; snippet pr - padding-right: ${1}; + padding-right: ${0}; snippet pt - padding-top: ${1}; + padding-top: ${0}; snippet p - padding: ${1}; + padding: ${0}; snippet p:4 - padding: ${1:0} ${2:0} ${3:0} ${4:0}; + padding: ${1:0} ${2:0} ${3:0} ${0:0}; snippet p:3 - padding: ${1:0} ${2:0} ${3:0}; + padding: ${1:0} ${2:0} ${0:0}; snippet p:2 - padding: ${1:0} ${2:0}; + padding: ${1:0} ${0:0}; snippet p:0 padding: 0; snippet pgba - page-break-after: ${1}; + page-break-after: ${0}; snippet pgba:aw page-break-after: always; snippet pgba:a @@ -712,7 +712,7 @@ snippet pgba:l snippet pgba:r page-break-after: right; snippet pgbb - page-break-before: ${1}; + page-break-before: ${0}; snippet pgbb:aw page-break-before: always; snippet pgbb:a @@ -722,13 +722,13 @@ snippet pgbb:l snippet pgbb:r page-break-before: right; snippet pgbi - page-break-inside: ${1}; + page-break-inside: ${0}; snippet pgbi:a page-break-inside: auto; snippet pgbi:av page-break-inside: avoid; snippet pos - position: ${1}; + position: ${0}; snippet pos:a position: absolute; snippet pos:f @@ -738,7 +738,7 @@ snippet pos:r snippet pos:s position: static; snippet q - quotes: ${1}; + quotes: ${0}; snippet q:en quotes: '\201C' '\201D' '\2018' '\2019'; snippet q:n @@ -746,7 +746,7 @@ snippet q:n snippet q:ru quotes: '\00AB' '\00BB' '\201E' '\201C'; snippet rz - resize: ${1}; + resize: ${0}; snippet rz:b resize: both; snippet rz:h @@ -756,17 +756,17 @@ snippet rz:n snippet rz:v resize: vertical; snippet r - right: ${1}; + right: ${0}; snippet r:a right: auto; snippet tbl - table-layout: ${1}; + table-layout: ${0}; snippet tbl:a table-layout: auto; snippet tbl:f table-layout: fixed; snippet tal - text-align-last: ${1}; + text-align-last: ${0}; snippet tal:a text-align-last: auto; snippet tal:c @@ -776,7 +776,7 @@ snippet tal:l snippet tal:r text-align-last: right; snippet ta - text-align: ${1}; + text-align: ${0}; snippet ta:c text-align: center; snippet ta:l @@ -784,7 +784,7 @@ snippet ta:l snippet ta:r text-align: right; snippet td - text-decoration: ${1}; + text-decoration: ${0}; snippet td:l text-decoration: line-through; snippet td:n @@ -794,7 +794,7 @@ snippet td:o snippet td:u text-decoration: underline; snippet te - text-emphasis: ${1}; + text-emphasis: ${0}; snippet te:ac text-emphasis: accent; snippet te:a @@ -810,7 +810,7 @@ snippet te:dt snippet te:n text-emphasis: none; snippet th - text-height: ${1}; + text-height: ${0}; snippet th:a text-height: auto; snippet th:f @@ -820,11 +820,11 @@ snippet th:m snippet th:t text-height: text-size; snippet ti - text-indent: ${1}; + text-indent: ${0}; snippet ti:- text-indent: -9999px; snippet tj - text-justify: ${1}; + text-justify: ${0}; snippet tj:a text-justify: auto; snippet tj:d @@ -840,23 +840,23 @@ snippet tj:k snippet tj:t text-justify: tibetan; snippet to+ - text-outline: ${1:0} ${2:0} #${3:000}; + text-outline: ${1:0} ${2:0} #${0:000}; snippet to - text-outline: ${1}; + text-outline: ${0}; snippet to:n text-outline: none; snippet tr - text-replace: ${1}; + text-replace: ${0}; snippet tr:n text-replace: none; snippet tsh+ - text-shadow: ${1:0} ${2:0} ${3:0} #${4:000}; + text-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; snippet tsh - text-shadow: ${1}; + text-shadow: ${0}; snippet tsh:n text-shadow: none; snippet tt - text-transform: ${1}; + text-transform: ${0}; snippet tt:c text-transform: capitalize; snippet tt:l @@ -866,7 +866,7 @@ snippet tt:n snippet tt:u text-transform: uppercase; snippet tw - text-wrap: ${1}; + text-wrap: ${0}; snippet tw:no text-wrap: none; snippet tw:n @@ -876,11 +876,11 @@ snippet tw:s snippet tw:u text-wrap: unrestricted; snippet t - top: ${1}; + top: ${0}; snippet t:a top: auto; snippet va - vertical-align: ${1}; + vertical-align: ${0}; snippet va:bl vertical-align: baseline; snippet va:b @@ -898,7 +898,7 @@ snippet va:tt snippet va:t vertical-align: top; snippet v - visibility: ${1}; + visibility: ${0}; snippet v:c visibility: collapse; snippet v:h @@ -906,7 +906,7 @@ snippet v:h snippet v:v visibility: visible; snippet whsc - white-space-collapse: ${1}; + white-space-collapse: ${0}; snippet whsc:ba white-space-collapse: break-all; snippet whsc:bs @@ -918,7 +918,7 @@ snippet whsc:l snippet whsc:n white-space-collapse: normal; snippet whs - white-space: ${1}; + white-space: ${0}; snippet whs:n white-space: normal; snippet whs:nw @@ -930,13 +930,13 @@ snippet whs:pw snippet whs:p white-space: pre; snippet wid - widows: ${1}; + widows: ${0}; snippet w - width: ${1}; + width: ${0}; snippet w:a width: auto; snippet wob - word-break: ${1}; + word-break: ${0}; snippet wob:ba word-break: break-all; snippet wob:bs @@ -948,9 +948,9 @@ snippet wob:l snippet wob:n word-break: normal; snippet wos - word-spacing: ${1}; + word-spacing: ${0}; snippet wow - word-wrap: ${1}; + word-wrap: ${0}; snippet wow:no word-wrap: none; snippet wow:n @@ -960,7 +960,7 @@ snippet wow:s snippet wow:u word-wrap: unrestricted; snippet z - z-index: ${1}; + z-index: ${0}; snippet z:a z-index: auto; snippet zoo diff --git a/snippets/dart.snippets b/snippets/dart.snippets index a74520022..0093f2bfb 100644 --- a/snippets/dart.snippets +++ b/snippets/dart.snippets @@ -1,82 +1,82 @@ snippet lib #library('${1}'); - ${2} + ${0} snippet im #import('${1}'); - ${2} + ${0} snippet so #source('${1}'); - ${2} + ${0} snippet main static void main() { - ${1} + ${0} } snippet st - static ${1} + static ${0} snippet fi - final ${1} + final ${0} snippet re - return ${1} + return ${0} snippet br break; snippet th - throw ${1} + throw ${0} snippet cl - class ${1:`vim_snippets#Filename("", "untitled")`} ${2} + class ${1:`vim_snippets#Filename("", "untitled")`} ${0} snippet in - interface ${1:`vim_snippets#Filename("", "untitled")`} ${2} + interface ${1:`vim_snippets#Filename("", "untitled")`} ${0} snippet imp - implements ${1} + implements ${0} snippet ext - extends ${1} + extends ${0} snippet if if (${1:true}) { - ${2} + ${0} } snippet ife if (${1:true}) { ${2} } else { - ${3} + ${0} } snippet el else snippet sw switch (${1}) { - ${2} + ${0} } snippet cs case ${1}: - ${2} + ${0} snippet de default: - ${1} + ${0} snippet for for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) { - ${4:$1[$2]} + ${0:$1[$2]} } snippet fore for (final ${2:item} in ${1:itemList}) { - ${3} + ${0} } snippet wh while (${1:/* condition */}) { - ${2} + ${0} } snippet dowh do { - ${2} - } while (${1:/* condition */}); + ${0} + } while (${0:/* condition */}); snippet as - assert(${1:/* condition */}); + assert(${0:/* condition */}); snippet try try { - ${2} + ${0} } catch (${1:Exception e}) { } snippet tryf try { - ${2} + ${0} } catch (${1:Exception e}) { } finally { } diff --git a/snippets/diff.snippets b/snippets/diff.snippets index 7ba288ded..89bc31d7e 100644 --- a/snippets/diff.snippets +++ b/snippets/diff.snippets @@ -7,5 +7,5 @@ snippet header DEP-3 style header Author: ${6:`g:snips_author`} Reviewed-by: ${7:name and email} Last-Update: ${8:`strftime("%Y-%m-%d")`} - Applied-Upstream: ${9:upstream version|url|commit} + Applied-Upstream: ${0:upstream version|url|commit} diff --git a/snippets/django.snippets b/snippets/django.snippets index 5c72b2b9e..cad80eb24 100644 --- a/snippets/django.snippets +++ b/snippets/django.snippets @@ -9,65 +9,65 @@ # can either not specify them, or override them, e.g. auto_now_add=False. snippet auto - ${1:FIELDNAME} = models.AutoField(${2}) + ${1:FIELDNAME} = models.AutoField(${0}) snippet bool - ${1:FIELDNAME} = models.BooleanField(${2:default=True}) + ${1:FIELDNAME} = models.BooleanField(${0:default=True}) snippet char - ${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True}) + ${1:FIELDNAME} = models.CharField(max_length=${2}${0:, blank=True}) snippet comma - ${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${3:, blank=True}) + ${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${0:, blank=True}) snippet date - ${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) + ${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True}) snippet datetime - ${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) + ${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True}) snippet decimal - ${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3}) + ${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${0}) snippet email - ${1:FIELDNAME} = models.EmailField(max_length=${2:75}${3:, blank=True}) + ${1:FIELDNAME} = models.EmailField(max_length=${2:75}${0:, blank=True}) snippet file - ${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${3:, max_length=100}) + ${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${0:, max_length=100}) snippet filepath - ${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${6:, blank=True, }) + ${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${0:, blank=True, }) snippet float - ${1:FIELDNAME} = models.FloatField(${2}) + ${1:FIELDNAME} = models.FloatField(${0}) snippet image - ${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100}) + ${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${0:, max_length=100}) snippet int - ${1:FIELDNAME} = models.IntegerField(${2}) + ${1:FIELDNAME} = models.IntegerField(${0}) snippet ip - ${1:FIELDNAME} = models.IPAddressField(${2}) + ${1:FIELDNAME} = models.IPAddressField(${0}) snippet nullbool - ${1:FIELDNAME} = models.NullBooleanField(${2}) + ${1:FIELDNAME} = models.NullBooleanField(${0}) snippet posint - ${1:FIELDNAME} = models.PositiveIntegerField(${2}) + ${1:FIELDNAME} = models.PositiveIntegerField(${0}) snippet possmallint - ${1:FIELDNAME} = models.PositiveSmallIntegerField(${2}) + ${1:FIELDNAME} = models.PositiveSmallIntegerField(${0}) snippet slug - ${1:FIELDNAME} = models.SlugField(max_length=${2:50}${3:, blank=True}) + ${1:FIELDNAME} = models.SlugField(max_length=${2:50}${0:, blank=True}) snippet smallint - ${1:FIELDNAME} = models.SmallIntegerField(${2}) + ${1:FIELDNAME} = models.SmallIntegerField(${0}) snippet text - ${1:FIELDNAME} = models.TextField(${2:blank=True}) + ${1:FIELDNAME} = models.TextField(${0:blank=True}) snippet time - ${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) + ${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True}) snippet url - ${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${4:, blank=True}) + ${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${0:, blank=True}) snippet xml - ${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${3:, blank=True}) + ${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${0:, blank=True}) # Relational Fields snippet fk - ${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''}) + ${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${0:, to_field=''}) snippet m2m - ${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''}) + ${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${0:, db_table=''}) snippet o2o - ${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''}) + ${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${0:, to_field=''}) # Code Skeletons snippet form class ${1:FormName}(forms.Form): """${2:docstring}""" - ${3} + ${0} snippet model class ${1:ModelName}(models.Model): @@ -85,24 +85,24 @@ snippet model @models.permalink def get_absolute_url(self): - return ('${7:view_or_url_name}' ${8}) + return ('${7:view_or_url_name}' ${0}) snippet modeladmin class ${1:ModelName}Admin(admin.ModelAdmin): - ${2} + ${0} admin.site.register($1, $1Admin) snippet tabularinline - class ${1:ModelName}Inline(admin.TabularInline): + class ${0:ModelName}Inline(admin.TabularInline): model = $1 snippet stackedinline - class ${1:ModelName}Inline(admin.StackedInline): + class ${0:ModelName}Inline(admin.StackedInline): model = $1 snippet r2r return render_to_response('${1:template.html}', { ${2} - }${3:, context_instance=RequestContext(request)} + }${0:, context_instance=RequestContext(request)} ) diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets index eb3319e0d..54aa180b3 100644 --- a/snippets/elixir.snippets +++ b/snippets/elixir.snippets @@ -1,127 +1,127 @@ snippet do do - ${1} + ${0} end snippet if if .. do .. end if ${1} do - ${2} + ${0} end snippet if if .. do: .. - if ${1:condition}, do: ${2} + if ${1:condition}, do: ${0} snippet ife if .. do .. else .. end if ${1:condition} do ${2} else - ${3} + ${0} end snippet ife if .. do: .. else: - if ${1:condition}, do: ${2}, else: ${3} + if ${1:condition}, do: ${2}, else: ${0} snippet unless unless .. do .. end unless ${1} do - ${2} + ${0} end snippet unless unless .. do: .. - unless ${1:condition}, do: ${2} + unless ${1:condition}, do: ${0} snippet unlesse unless .. do .. else .. end unless ${1:condition} do ${2} else - ${3} + ${0} end snippet unlesse unless .. do: .. else: - unless ${1:condition}, do: ${2}, else: ${3} + unless ${1:condition}, do: ${2}, else: ${0} snippet cond cond do ${1} -> - ${2} + ${0} end snippet case case ${1} do ${2} -> - ${3} + ${0} end snippet def def ${1:name} do - ${2} + ${0} end snippet defim defimpl ${1:protocol_name}, for: ${2:data_type} do - ${3} + ${0} end snippet defma defmacro ${1:name} do - ${2} + ${0} end snippet defmo defmodule ${1:module_name} do - ${2} + ${0} end snippet defp defp ${1:name} do - ${2} + ${0} end snippet defpr - defprotocol ${1:name}, [${2:function}] + defprotocol ${1:name}, [${0:function}] snippet defr - defrecord ${1:record_name}, ${2:fields} + defrecord ${1:record_name}, ${0:fields} snippet doc @doc """ - ${1} + ${0} """ snippet fn - fn(${1:args}) -> ${2} end + fn(${1:args}) -> ${0} end snippet fun function do - ${1} + ${0} end snippet mdoc @moduledoc """ - ${1} + ${0} """ snippet rec receive do ${1} -> - ${2} + ${0} end snippet req - require ${1:module_name} + require ${0:module_name} snippet imp - import ${1:module_name} + import ${0:module_name} snippet ali - alias ${1:module_name} + alias ${0:module_name} snippet test test "${1:test_name}" do - ${2} + ${0} end snippet try try .. rescue .. end try do ${1} rescue - ${2} -> ${3} + ${2} -> ${0} end diff --git a/snippets/erlang.snippets b/snippets/erlang.snippets index cfad09a36..799d7f57c 100644 --- a/snippets/erlang.snippets +++ b/snippets/erlang.snippets @@ -5,62 +5,62 @@ snippet mod -compile([export_all]). start() -> - ${2} + ${0} stop() -> ok. # define directive snippet def - -define(${1:macro}, ${2:body}).${3} + -define(${1:macro}, ${2:body}). # export directive snippet exp - -export([${1:function}/${2:arity}]). + -export([${1:function}/${0:arity}]). # include directive snippet inc - -include("${1:file}").${2} + -include("${1:file}"). # behavior directive snippet beh - -behaviour(${1:behaviour}).${2} + -behaviour(${1:behaviour}). # if expression snippet if if ${1:guard} -> - ${2:body} + ${0:body} end # case expression snippet case case ${1:expression} of ${2:pattern} -> - ${3:body}; + ${0:body}; end # anonymous function snippet fun - fun (${1:Parameters}) -> ${2:body} end${3} + fun (${1:Parameters}) -> ${2:body} end # try...catch snippet try try ${1} catch - ${2:_:_} -> ${3:got_some_exception} + ${2:_:_} -> ${0:got_some_exception} end # record directive snippet rec -record(${1:record}, { - ${2:field}=${3:value}}).${4} + ${2:field}=${3:value}}). # todo comment snippet todo - %% TODO: ${1} + %% TODO: ${0} ## Snippets below (starting with '%') are in EDoc format. ## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details # doc comment snippet %d - %% @doc ${1} + %% @doc ${0} # end of doc comment snippet %e %% @end # specification comment snippet %s - %% @spec ${1} + %% @spec ${0} # private function marker snippet %p %% @private @@ -73,7 +73,7 @@ snippet application -export([start/2, stop/1]). start(_Type, _StartArgs) -> - case ${2:root_supervisor}:start_link() of + case ${0:root_supervisor}:start_link() of {ok, Pid} -> {ok, Pid}; Other -> @@ -100,14 +100,14 @@ snippet supervisor supervisor:start_link({local, ?SERVER}, ?MODULE, []). init([]) -> - Server = {${2:my_server}, {$2, start_link, []}, + Server = {${0:my_server}, {$2, start_link, []}, permanent, 2000, worker, [$2]}, Children = [Server], RestartStrategy = {one_for_one, 0, 1}, {ok, {RestartStrategy, Children}}. # OTP gen_server snippet gen_server - -module(${1:`vim_snippets#Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename('', 'my')`}). -behaviour(gen_server). @@ -159,7 +159,7 @@ snippet gen_server %%%=================================================================== # common_test test_SUITE snippet testsuite - -module(${1:`vim_snippets#Filename('', 'my')`}). + -module(${0:`vim_snippets#Filename('', 'my')`}). -include_lib("common_test/include/ct.hrl"). diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index e3f421366..95418350d 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -4,124 +4,124 @@ # Rails ***************************** snippet rc - <% ${1} %> + <% ${0} %> snippet rce - <%= ${1} %>${2} + <%= ${1} %> snippet % - <% ${1} %> + <% ${0} %> snippet = - <%= ${1} %>${2} + <%= ${1} %> snippet end - <% end %>${1} + <% end %> snippet ead <% ${1}.each do |${2}| %> - ${3} + ${0} <% end %> snippet for <% for ${2:item} in ${1} %> - ${3} + ${0} <% end %> snippet rp - <%= render :partial => '${1:item}' %> + <%= render :partial => '${0:item}' %> snippet rpl - <%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %> + <%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'${0} } %> snippet rps - <%= render :partial => '${1:item}', :status => ${2:500} %> + <%= render :partial => '${1:item}', :status => ${0:500} %> snippet rpc - <%= render :partial => '${1:item}', :collection => ${2:items} %> + <%= render :partial => '${1:item}', :collection => ${0:items} %> snippet lia - <%= link_to '${1:link text...}', :action => '${2:index}' %> + <%= link_to '${1:link text...}', :action => '${0:index}' %> snippet liai - <%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %> + <%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${0:@item} %> snippet lic - <%= link_to '${1:link text...}', :controller => '${2:items}' %> + <%= link_to '${1:link text...}', :controller => '${0:items}' %> snippet lica - <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %> + <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${0:index}' %> snippet licai - <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %> + <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${0:@item} %> snippet yield - <%= yield ${1::content_symbol} %>${2} + <%= yield ${1::content_symbol} %> snippet conf <% content_for :${1:head} do %> - ${2} + ${0} <% end %> snippet cs <%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %> snippet ct - <%= content_tag '${1:DIV}', ${2:content}${3:,options} %> + <%= content_tag '${1:DIV}', ${2:content}${0:,options} %> snippet ff <%= form_for @${1:model} do |f| %> - ${2} + ${0} <% end %> snippet ffi - <%= ${1:f}.input :${2:attribute} %> + <%= ${1:f}.input :${0:attribute} %> snippet ffcb - <%= ${1:f}.check_box :${2:attribute} %> + <%= ${1:f}.check_box :${0:attribute} %> snippet ffe <% error_messages_for :${1:model} %> <%= form_for @${2:model} do |f| %> - ${3} + ${0} <% end %> snippet ffff - <%= ${1:f}.file_field :${2:attribute} %> + <%= ${1:f}.file_field :${0:attribute} %> snippet ffhf - <%= ${1:f}.hidden_field :${2:attribute} %> + <%= ${1:f}.hidden_field :${0:attribute} %> snippet ffl - <%= ${1:f}.label :${2:attribute}, '${3:$2}' %> + <%= ${1:f}.label :${2:attribute}, '${0:$2}' %> snippet ffpf - <%= ${1:f}.password_field :${2:attribute} %> + <%= ${1:f}.password_field :${0:attribute} %> snippet ffrb - <%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %> + <%= ${1:f}.radio_button :${2:attribute}, :${0:tag_value} %> snippet ffs - <%= ${1:f}.submit "${2:submit}" %> + <%= ${1:f}.submit "${0:submit}" %> snippet ffta - <%= ${1:f}.text_area :${2:attribute} %> + <%= ${1:f}.text_area :${0:attribute} %> snippet fftf - <%= ${1:f}.text_field :${2:attribute} %> + <%= ${1:f}.text_field :${0:attribute} %> snippet fields <%= fields_for :${1:model}, @$1 do |${2:f}| %> - ${3} + ${0} <% end %> snippet i18 - I18n.t('${1:type.key}')${2} + I18n.t('${1:type.key}') snippet it - <%= image_tag "${1}"${2} %> + <%= image_tag "${1}"${0} %> snippet jit - <%= javascript_include_tag ${1::all} %> + <%= javascript_include_tag ${0::all} %> snippet jsit - <%= javascript_include_tag "${1}" %> + <%= javascript_include_tag "${0}" %> snippet lim - <%= link_to ${1:model}.${2:name}, ${3:$1}_path(${4:$1}) %> + <%= link_to ${1:model}.${2:name}, ${3:$1}_path(${0:$1}) %> snippet linp - <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${5:@$3}) %> + <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${0:@$3}) %> snippet linpp - <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}) %> + <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${0:@$2}) %> snippet lip - <%= link_to "${1:Link text...}", ${2:model}_path(${3:@$2}) %> + <%= link_to "${1:Link text...}", ${2:model}_path(${0:@$2}) %> snippet lipp - <%= link_to "${1:Link text...}", ${2:model}s_path %> + <%= link_to "${1:Link text...}", ${0:model}s_path %> snippet lt - <%= link_to "${1:name}", ${2:dest} %> + <%= link_to "${1:name}", ${0:dest} %> snippet ntc <%= number_to_currency(${1}) %> snippet ofcfs - <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %> + <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %> snippet rf - <%= render :file => "${1:file}"${2} %> + <%= render :file => "${1:file}"${0} %> snippet rt - <%= render :template => "${1:file}"${2} %> + <%= render :template => "${1:file}"${0} %> snippet slt - <%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %> + <%= stylesheet_link_tag ${1::all}, :cache => ${0:true} %> snippet sslt - <%= stylesheet_link_tag "${1}" %> + <%= stylesheet_link_tag "${0}" %> snippet if <% if ${1} %> - ${2} + ${0} <% end %> snippet ife <% if ${1} %> ${2} <% else %> - ${3} + ${0} <% end %> diff --git a/snippets/falcon.snippets b/snippets/falcon.snippets index 50c3694c9..c523980d6 100644 --- a/snippets/falcon.snippets +++ b/snippets/falcon.snippets @@ -3,30 +3,30 @@ snippet #! # Import snippet imp - import ${1:module} + import ${0:module} # Function snippet fun function ${2:function_name}(${3}) - ${4} + ${0} end # Class snippet class class ${1:class_name}(${2:class_params}) - ${3:/* members/methods */} + ${0:/* members/methods */} end # If snippet if if ${1:condition} - ${2} + ${0} end # If else snippet ife if ${1:condition} - ${2} + ${0} else ${1} end @@ -34,13 +34,13 @@ snippet ife # If else if snippet eif elif ${1:condition} - ${2} + ${0} # Switch case snippet switch switch ${1:expression} case ${2:item} - case ${3:item} + case ${0:item} default end @@ -48,24 +48,24 @@ snippet switch snippet select select ${1:variable} case ${2:TypeSpec} - case ${3:TypeSpec} + case ${0:TypeSpec} default end # For/in Loop snippet forin for ${1:element} in ${2:container} - ${3} + ${0} end # For/to Loop snippet forto for ${1:lowerbound} to ${2:upperbound} - ${3} + ${0} end # While Loop snippet wh while ${1:conidition} - ${2} + ${0} end diff --git a/snippets/go.snippets b/snippets/go.snippets index 7e2ad4ca7..03f7649d8 100644 --- a/snippets/go.snippets +++ b/snippets/go.snippets @@ -5,7 +5,7 @@ snippet vr var ${1} ${2} = ${3} # append snippet ap - append(${1:slice}, ${2:value}) + append(${1:slice}, ${0:value}) # bool snippet bl bool @@ -17,31 +17,31 @@ snippet br break # channel snippet ch - chan ${1:int} + chan ${0:int} # case snippet cs case ${1:value}: - ${2} + ${0} # const snippet c - const ${1:NAME} = ${2:0} + const ${1:NAME} = ${0:0} # constants with iota snippet co const ( ${1:NAME1} = iota - ${2:NAME2} + ${0:NAME2} ) # continue snippet cn continue # defer snippet df - defer ${1:func}() + defer ${0:func}() # defer recover snippet dfr defer func() { if err := recover(); err != nil { - ${1} + ${0} } }() # gpl @@ -63,7 +63,7 @@ snippet gpl * Copyright (C) ${1:Author}, `strftime("%Y")` */ - ${2} + ${0} # int snippet i int @@ -71,7 +71,7 @@ snippet i snippet im import ( "${1:package}" - )${2} + ) # interface snippet in interface{} @@ -79,23 +79,23 @@ snippet in snippet inf interface ${1:name} { ${2:/* methods */} - }${3} + } # if condition snippet if if ${1:/* condition */} { ${2} - }${3} + } # else snippet snippet el else { ${1} - }${2} + } # error snippet snippet ir if err != nil { return err } - ${1} + ${0} # false snippet f false @@ -118,64 +118,64 @@ snippet ie } else { ${3} } - ${4} + ${0} # for loop snippet fo for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { ${4} } - ${5} + ${0} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { ${4} } - ${5} + ${0} # function simple snippet fun func ${1:funcName}(${2}) ${3:error} { ${4} } - ${5} + ${0} # function on receiver snippet fum func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5} } - ${6} + ${0} # log printf snippet lf - log.Printf("%${1:s}", ${2:var})${3} + log.Printf("%${1:s}", ${2:var}) # log printf snippet lp - log.Println("${1}")${2} + log.Println("${1}") # make snippet mk - make(${1:[]string}, ${2:0}) + make(${1:[]string}, ${0:0}) # map snippet mp - map[${1:string}]${2:int} + map[${1:string}]${0:int} # main() snippet main func main() { ${1} } - ${2} + ${0} # new snippet nw - new(${1:type}) + new(${0:type}) # panic snippet pn - panic("${1:msg}") + panic("${0:msg}") # print snippet pr - fmt.Printf("%${1:s}\n", ${2:var})${3} + fmt.Printf("%${1:s}\n", ${2:var}) # range snippet rn - range ${1} + range ${0} # return snippet rt - return ${1} + return ${0} # result snippet rs result @@ -187,7 +187,7 @@ snippet sl case ${4:v2} := <-${5:chan2} ${6} default: - ${7} + ${0} } # string snippet sr @@ -197,7 +197,7 @@ snippet st struct ${1:name} { ${2:/* data */} } - ${3} + ${0} # switch snippet sw switch ${1:var} { @@ -206,21 +206,21 @@ snippet sw case ${4:value2}: ${5} default: - ${6} + ${0} } snippet sp - fmt.Sprintf("%${1:s}", ${2:var})${3} + fmt.Sprintf("%${1:s}", ${2:var}) # true snippet t true # variable declaration snippet v - var ${1:t} ${2:string} + var ${1:t} ${0:string} # goroutine named function snippet g - go ${1:funcName}(${2}) + go ${1:funcName}(${0}) # goroutine anonymous function snippet ga go func(${1} ${2:type}) { ${3:/* code */} - }(${4}) + }(${0}) diff --git a/snippets/haml.snippets b/snippets/haml.snippets index 046608784..09217c6c4 100644 --- a/snippets/haml.snippets +++ b/snippets/haml.snippets @@ -5,20 +5,20 @@ snippet t ${1:headers} %tr %td - ${2:headers} + ${0:headers} snippet ul %ul %li - ${1:item} + ${0:item} %li snippet rp - = render :partial => "${1:item}" + = render :partial => "${0:item}" snippet rpc - = render :partial => "${1:item}", :collection => ${2:@$1s} + = render :partial => "${1:item}", :collection => ${0:@$1s} snippet rpl - = render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1} + = render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} snippet rpo - = render :partial => "${1:item}", :object => ${2:@$1} + = render :partial => "${1:item}", :object => ${0:@$1} snippet lt = link_to ${1:name}, ${2:dest} snippet mt @@ -29,9 +29,9 @@ snippet ife - if ${1:condition} ${2} - else - ${3} + ${0} snippet ifp - if ${1:condition}.presence? - ${2} + ${0} snippet ntc = number_to_currency(${1}) diff --git a/snippets/haskell.snippets b/snippets/haskell.snippets index 3857d8b4e..f5f159845 100644 --- a/snippets/haskell.snippets +++ b/snippets/haskell.snippets @@ -1,5 +1,5 @@ snippet lang - {-# LANGUAGE ${1:OverloadedStrings} #-} + {-# LANGUAGE ${0:OverloadedStrings} #-} snippet info -- | -- Module : ${1:Module.Namespace} @@ -10,26 +10,26 @@ snippet info -- Stability : ${6:experimental} -- Portability : ${7:unknown} -- - -- ${8:Description} + -- ${0:Description} -- snippet import - import ${1:Data.Text} + import ${0:Data.Text} snippet import2 - import ${1:Data.Text} (${2:head}) + import ${1:Data.Text} (${0:head}) snippet importq - import qualified ${1:Data.Text} as ${2:T} + import qualified ${1:Data.Text} as ${0:T} snippet inst instance ${1:Monoid} ${2:Type} where - ${3} + ${0} snippet type - type ${1:Type} = ${2:Type} + type ${1:Type} = ${0:Type} snippet data - data ${1:Type} = ${2:$1} ${3:Int} + data ${1:Type} = ${2:$1} ${0:Int} snippet newtype - newtype ${1:Type} = ${2:$1} ${3:Int} + newtype ${1:Type} = ${2:$1} ${0:Int} snippet class class ${1:Class} a where - ${2} + ${0} snippet module module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` ( ) where @@ -37,46 +37,46 @@ snippet module snippet const ${1:name} :: ${2:a} - $1 = ${3:undefined} + $1 = ${0:undefined} snippet fn ${1:fn} :: ${2:a} -> ${3:a} - $1 ${4} = ${5:undefined} + $1 ${4} = ${0:undefined} snippet fn2 ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} - $1 ${5} = ${6:undefined} + $1 ${5} = ${0:undefined} snippet ap - ${1:map} ${2:fn} ${3:list} + ${1:map} ${2:fn} ${0:list} snippet do do snippet λ - \${1:x} -> ${2} + \${1:x} -> ${0} snippet \ - \${1:x} -> ${2} + \${1:x} -> ${0} snippet <- - ${1:a} <- ${2:m a} + ${1:a} <- ${0:m a} snippet ← - ${1:a} <- ${2:m a} + ${1:a} <- ${0:m a} snippet -> - ${1:m a} -> ${2:a} + ${1:m a} -> ${0:a} snippet → - ${1:m a} -> ${2:a} + ${1:m a} -> ${0:a} snippet tup - (${1:a}, ${2:b}) + (${1:a}, ${0:b}) snippet tup2 - (${1:a}, ${2:b}, ${3:c}) + (${1:a}, ${2:b}, ${0:c}) snippet tup3 - (${1:a}, ${2:b}, ${3:c}, ${4:d}) + (${1:a}, ${2:b}, ${3:c}, ${0:d}) snippet rec ${1:Record} { ${2:recFieldA} = ${3:undefined} - , ${4:recFieldB} = ${5:undefined} + , ${4:recFieldB} = ${0:undefined} } snippet case case ${1:something} of - ${2} -> ${3} + ${2} -> ${0} snippet let let ${1} = ${2} in ${3} snippet where where - ${1:fn} = ${2:undefined} + ${1:fn} = ${0:undefined} diff --git a/snippets/html.snippets b/snippets/html.snippets index a83089c81..f25e1bc73 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -97,353 +97,353 @@ snippet docx "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> # Attributes snippet attr - ${1:attribute}="${2:property}" + ${1:attribute}="${0:property}" snippet attr+ - ${1:attribute}="${2:property}" attr+${3} + ${1:attribute}="${2:property}" attr+ snippet . - class="${1}"${2} + class="${1}" snippet # - id="${1}"${2} + id="${1}" snippet alt - alt="${1}"${2} + alt="${1}" snippet charset - charset="${1:utf-8}"${2} + charset="${1:utf-8}" snippet data - data-${1}="${2:$1}"${3} + data-${1}="${2:$1}" snippet for - for="${1}"${2} + for="${1}" snippet height - height="${1}"${2} + height="${1}" snippet href - href="${1:#}"${2} + href="${1:#}" snippet lang - lang="${1:en}"${2} + lang="${1:en}" snippet media - media="${1}"${2} + media="${1}" snippet name - name="${1}"${2} + name="${1}" snippet rel - rel="${1}"${2} + rel="${1}" snippet scope - scope="${1:row}"${2} + scope="${1:row}" snippet src - src="${1}"${2} + src="${1}" snippet title= - title="${1}"${2} + title="${1}" snippet type - type="${1}"${2} + type="${1}" snippet value - value="${1}"${2} + value="${1}" snippet width - width="${1}"${2} + width="${1}" # Elements snippet a - ${2:$1} + ${0:$1} snippet a. - ${3:$1} + ${0:$1} snippet a# - ${3:$1} + ${0:$1} snippet a:ext - ${2:$1} + ${0:$1} snippet a:mail - ${3:email me} + ${0:email me} snippet abbr - ${2} + ${0} snippet address