Skip to content

Commit

Permalink
Snippets: use tabs only, use consistent structure, add missing descri…
Browse files Browse the repository at this point in the history
…ptions
  • Loading branch information
kleinfreund committed May 27, 2015
1 parent 5ef4999 commit d35b74c
Show file tree
Hide file tree
Showing 45 changed files with 295 additions and 210 deletions.
11 changes: 7 additions & 4 deletions classes/class.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<snippet>
<content><![CDATA[class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} {
<description>Class</description>
<content><![CDATA[
class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} {
private:
${2:/* data */}
public:
${1/(\w+).*/$1/}(${3:/* args */}) ${4:= default;}
};]]></content>
<tabTrigger>class_</tabTrigger>
<scope>source.c++, source.objc++</scope>
};
]]></content>
<tabTrigger>class_</tabTrigger>
<scope>source.c++, source.objc++</scope>
</snippet>
11 changes: 7 additions & 4 deletions classes/class_template.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<snippet>
<content><![CDATA[template<typename ${1:T}>
<description>Class Template</description>
<content><![CDATA[
template<typename ${1:T}>
class ${2:${TM_FILENAME/(.+)\..+|.*/$1/:name}} {
private:
${3:/* data */}
public:
${2/(\w+).*/$1/}(${4:/* args */}) ${5:= default;}
};]]></content>
<tabTrigger>classtemp</tabTrigger>
<scope>source.c++, source.objc++</scope>
};
]]></content>
<tabTrigger>classtemp</tabTrigger>
<scope>source.c++, source.objc++</scope>
</snippet>
10 changes: 6 additions & 4 deletions classes/exception.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<snippet>
<description>Create exception</description>
<content><![CDATA[class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} : public ${2:std::runtime_error} {
<content><![CDATA[
class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} : public ${2:std::runtime_error} {
public:
${1/(\w+).*/$1/}(const std::string& str): ${2:std::runtime_error}(${3:str}) {}
};]]></content>
<tabTrigger>excep</tabTrigger>
<scope>source.c++, source.objc++</scope>
};
]]></content>
<tabTrigger>excep</tabTrigger>
<scope>source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions classes/struct.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<name>Struct</name>
<content><![CDATA[struct ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} {
<description>Struct</description>
<content><![CDATA[
struct ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} {
${0:/* data */}
};]]></content>
<tabTrigger>struct_</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
};
]]></content>
<tabTrigger>struct_</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions classes/struct_template.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<snippet>
<description>templated struct</description>
<content><![CDATA[template<typename ${1:T}>
<description>Templated Struct</description>
<content><![CDATA[
template<typename ${1:T}>
struct ${2:${TM_FILENAME/(.+)\..+|.*/$1/:name}} {
${0:/* code */}
};]]></content>
<tabTrigger>structtemp</tabTrigger>
<scope>source.c++, source.objc++</scope>
};
]]></content>
<tabTrigger>structtemp</tabTrigger>
<scope>source.c++, source.objc++</scope>
</snippet>
10 changes: 6 additions & 4 deletions conditional/if.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>if(…)</description>
<content><![CDATA[if(${1:/* condition */}) {
<content><![CDATA[
if(${1:/* condition */}) {
${0:/* code */}
}]]></content>
<tabTrigger>if_</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
}
]]></content>
<tabTrigger>if_</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions conditional/if_else.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<snippet>
<description>if(…) else</description>
<content><![CDATA[if(${1:/* condition */}) {
<description>if(…) else</description>
<content><![CDATA[
if(${1:/* condition */}) {
${2:/* code */}
}
else {
${0:/* code */}
}]]></content>
<tabTrigger>ifelse</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
}
]]></content>
<tabTrigger>ifelse</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions conditional/if_elseif_else.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<snippet>
<description>if(…) else if(…) else</description>
<content><![CDATA[if(${1:/* condition */}) {
<description>if(…) else if(…) else</description>
<content><![CDATA[
if(${1:/* condition */}) {
${2:/* code */}
}
else if(${3:/* condition */}) {
${4:/* code */}
}
else {
${0:/* code */}
}]]></content>
<tabTrigger>ifelif</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
}
]]></content>
<tabTrigger>ifelif</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functions/constexpr_function.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>constexpr function</description>
<content><![CDATA[constexpr ${1:int} ${2:function_name}(${3:/* args */}) {
<description>Constexpr Function</description>
<content><![CDATA[
constexpr ${1:int} ${2:function_name}(${3:/* args */}) {
return ${0:/* code */};
}]]></content>
<tabTrigger>confunct</tabTrigger>
<scope>source.c++</scope>
}
]]></content>
<tabTrigger>confunct</tabTrigger>
<scope>source.c++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functions/regular_function.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Regular function</description>
<content><![CDATA[${1:int} ${2:function_name}(${3:/* args */}) {
<description>Regular Function</description>
<content><![CDATA[
${1:int} ${2:function_name}(${3:/* args */}) {
${0:/* code */}
}]]></content>
<tabTrigger>funct</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
}
]]></content>
<tabTrigger>funct</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functions/templated_function.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<snippet>
<description>templated function</description>
<content><![CDATA[template<typename ${1:T}>
<description>Templated Function</description>
<content><![CDATA[
template<typename ${1:T}>
${2:int} ${3:function_name}(${4:/* args */}) noexcept {
$0
}]]></content>
<tabTrigger>tempfunc</tabTrigger>
<scope>source.c++</scope>
}
]]></content>
<tabTrigger>tempfunc</tabTrigger>
<scope>source.c++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functions/templated_function_auto.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<snippet>
<description>template auto function</description>
<content><![CDATA[template<typename ${1:T}>
<description>Template Auto Function</description>
<content><![CDATA[
template<typename ${1:T}>
auto ${2:function_name}(${3:/* args */}) -> decltype(${4:/* expression */}) {
${0:/* code */}
}]]></content>
<tabTrigger>tempfunca</tabTrigger>
<scope>source.c++, source.objc++</scope>
}
]]></content>
<tabTrigger>tempfunca</tabTrigger>
<scope>source.c++, source.objc++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functions/templated_function_auto_constexpr.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<snippet>
<description>template auto constexpr func</description>
<content><![CDATA[template<typename ${1:T}>
<description>Template Auto Constexpr Function</description>
<content><![CDATA[
template<typename ${1:T}>
constexpr auto ${2:function_name}(${3:/* args */}) noexcept -> decltype(${4:/* code */}) {
return ${4:/* code */};
}]]></content>
<tabTrigger>tempcfunca</tabTrigger>
<scope>source.c++</scope>
}
]]></content>
<tabTrigger>tempcfunca</tabTrigger>
<scope>source.c++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functions/templated_function_constexpr.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<snippet>
<description>template constexpr function</description>
<content><![CDATA[template<typename ${1:T}>
<description>Template Constexpr Function</description>
<content><![CDATA[
template<typename ${1:T}>
constexpr ${2:int} ${3:function_name}(${4:/* args */}) {
return ${5:/* code */};
}]]></content>
<tabTrigger>tempcfunc</tabTrigger>
<scope>source.c++</scope>
}
]]></content>
<tabTrigger>tempcfunc</tabTrigger>
<scope>source.c++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functors/binary_template_functor.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<snippet>
<description>Binary template functor</description>
<content><![CDATA[struct ${1:name} {
<description>Binary Template Functor</description>
<content><![CDATA[
struct ${1:name} {
template<typename T, typename U>
constexpr auto operator()(T&& t, U&& u) const noexcept -> decltype(${2:/* code */}) {
return ${2:/* code */};
}
};]]></content>
<tabTrigger>bintempfunctor</tabTrigger>
<scope>source.c++</scope>
};
]]></content>
<tabTrigger>bintempfunctor</tabTrigger>
<scope>source.c++</scope>
</snippet>
10 changes: 6 additions & 4 deletions functors/functor.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<snippet>
<description>Functor</description>
<content><![CDATA[struct ${1:name} {
<content><![CDATA[
struct ${1:name} {
${2:bool} operator()(${3:/* args */}) const noexcept {
${0:/* code */}
}
};]]></content>
<tabTrigger>functor</tabTrigger>
<scope>source.c++</scope>
};
]]></content>
<tabTrigger>functor</tabTrigger>
<scope>source.c++</scope>
</snippet>
12 changes: 7 additions & 5 deletions functors/unary_template_functor.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<snippet>
<description>Unary template functor</description>
<content><![CDATA[struct ${1:name} {
<description>Unary Template Functor</description>
<content><![CDATA[
struct ${1:name} {
template<typename T>
constexpr auto operator()(T&& t) const noexcept -> decltype(${2:/* code */}) {
return ${2:/* code */};
}
};]]></content>
<tabTrigger>tempfunctor</tabTrigger>
<scope>source.c++</scope>
};
]]></content>
<tabTrigger>tempfunctor</tabTrigger>
<scope>source.c++</scope>
</snippet>
8 changes: 5 additions & 3 deletions lambda/catchallbyref.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Lambda - catch all by reference</description>
<content><![CDATA[[&](${1:/* args */}) {
<description>Lambda – Catch All by Reference</description>
<content><![CDATA[
[&](${1:/* args */}) {
${2:/* code */}
}]]></content>
}
]]></content>
<tabTrigger>lamref</tabTrigger>
<scope>source.c++, source.c++11</scope>
</snippet>
10 changes: 6 additions & 4 deletions lambda/catchallbyvalue.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Lambda - catch all by value</description>
<content><![CDATA[[=](${1:/* args */}) {
<description>Lambda – Catch All by Value</description>
<content><![CDATA[
[=](${1:/* args */}) {
${2:/* code */}
}]]></content>
}
]]></content>
<tabTrigger>lamval</tabTrigger>
<scope>source.c++, source.c++11</scope>
</snippet>
</snippet>
10 changes: 6 additions & 4 deletions lambda/full.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Lambda - Full spec</description>
<content><![CDATA[[${1:/* capture */}](${2:/* args */}) ${3:mutable} ${4:noexcept} -> ${5:/* return */} {
<description>Lambda – Full Spec</description>
<content><![CDATA[
[${1:/* capture */}](${2:/* args */}) ${3:mutable} ${4:noexcept} -> ${5:/* return */} {
${6:/* code */}
}]]></content>
}
]]></content>
<tabTrigger>lamfull</tabTrigger>
<scope>source.c++, source.c++11</scope>
</snippet>
</snippet>
10 changes: 6 additions & 4 deletions lambda/lamret.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Lambda - Explicit return declaration</description>
<content><![CDATA[[${1:/* capture */}](${2:/* args */}) -> ${3:/* return */} {
<description>Lambda – Explicit Return Declaration</description>
<content><![CDATA[
[${1:/* capture */}](${2:/* args */}) -> ${3:/* return */} {
${4:/* code */}
}]]></content>
}
]]></content>
<tabTrigger>lamret</tabTrigger>
<scope>source.c++, source.c++11</scope>
</snippet>
</snippet>
10 changes: 6 additions & 4 deletions lambda/minimal.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Lambda - Minimal</description>
<content><![CDATA[[${1:/* capture */}] {
<description>Lambda – Minimal</description>
<content><![CDATA[
[${1:/* capture */}] {
${2:/* code */}
}]]></content>
}
]]></content>
<tabTrigger>lammin</tabTrigger>
<scope>source.c++, source.c++11</scope>
</snippet>
</snippet>
10 changes: 6 additions & 4 deletions loops/dowhileloop.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<snippet>
<description>Do While Loop</description>
<content><![CDATA[do {
<content><![CDATA[
do {
${0:/* code */}
} while (${1:/* condition */});]]></content>
<tabTrigger>do_</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
} while (${1:/* condition */});
]]></content>
<tabTrigger>do_</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
Loading

0 comments on commit d35b74c

Please sign in to comment.