mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-16 10:24:18 +00:00
restructuring classic snippets dir to conform to new parenting specs
This commit is contained in:
1
snippets/cc-mode/.yas-parents
Normal file
1
snippets/cc-mode/.yas-parents
Normal file
@@ -0,0 +1 @@
|
||||
text-mode
|
||||
3
snippets/cc-mode/c++-mode/beginend
Normal file
3
snippets/cc-mode/c++-mode/beginend
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : v.begin(), v.end()
|
||||
# --
|
||||
${1:v}.begin(), $1.end
|
||||
8
snippets/cc-mode/c++-mode/class
Normal file
8
snippets/cc-mode/c++-mode/class
Normal file
@@ -0,0 +1,8 @@
|
||||
#name : class ... { ... }
|
||||
# --
|
||||
class ${1:Name}
|
||||
{
|
||||
public:
|
||||
${1:$(yas/substr text "[^: ]*")}($2);
|
||||
virtual ~${1:$(yas/substr text "[^: ]*")}();
|
||||
};
|
||||
3
snippets/cc-mode/c++-mode/ns
Normal file
3
snippets/cc-mode/c++-mode/ns
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : namespace ...
|
||||
# --
|
||||
namespace
|
||||
3
snippets/cc-mode/c++-mode/template
Normal file
3
snippets/cc-mode/c++-mode/template
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : template <typename ...>
|
||||
# --
|
||||
template <typename ${T}>
|
||||
4
snippets/cc-mode/c++-mode/using
Normal file
4
snippets/cc-mode/c++-mode/using
Normal file
@@ -0,0 +1,4 @@
|
||||
#name : using namespace ...
|
||||
# --
|
||||
using namespace ${std};
|
||||
$0
|
||||
3
snippets/cc-mode/c-mode/fopen
Normal file
3
snippets/cc-mode/c-mode/fopen
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : FILE *fp = fopen(..., ...);
|
||||
# --
|
||||
FILE *${fp} = fopen(${"file"}, "${r}");
|
||||
6
snippets/cc-mode/c-mode/printf
Normal file
6
snippets/cc-mode/c-mode/printf
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name : printf
|
||||
# contributor : joaotavora
|
||||
# --
|
||||
printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")
|
||||
}$2${1:$(if (string-match "%" text) "\);" "")}
|
||||
7
snippets/cc-mode/csharp-mode/attrib
Normal file
7
snippets/cc-mode/csharp-mode/attrib
Normal file
@@ -0,0 +1,7 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : private attribute ....;
|
||||
# --
|
||||
/// <summary>
|
||||
/// $3
|
||||
/// </summary>
|
||||
private $1 $2;
|
||||
21
snippets/cc-mode/csharp-mode/attrib.1
Normal file
21
snippets/cc-mode/csharp-mode/attrib.1
Normal file
@@ -0,0 +1,21 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : private attribute ....; public property ... ... { ... }
|
||||
# --
|
||||
/// <summary>
|
||||
/// $3
|
||||
/// </summary>
|
||||
private $1 $2;
|
||||
|
||||
/// <summary>
|
||||
/// $4
|
||||
/// </summary>
|
||||
/// <value>$5</value>
|
||||
public $1 $2
|
||||
{
|
||||
get {
|
||||
return this.$2;
|
||||
}
|
||||
set {
|
||||
this.$2 = value;
|
||||
}
|
||||
}
|
||||
21
snippets/cc-mode/csharp-mode/attrib.2
Normal file
21
snippets/cc-mode/csharp-mode/attrib.2
Normal file
@@ -0,0 +1,21 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : private _attribute ....; public Property ... ... { ... }
|
||||
# --
|
||||
/// <summary>
|
||||
/// $3
|
||||
/// </summary>
|
||||
private $1 ${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")};
|
||||
|
||||
/// <summary>
|
||||
/// ${3:Description}
|
||||
/// </summary>
|
||||
/// <value><c>$1</c></value>
|
||||
public ${1:Type} ${2:Name}
|
||||
{
|
||||
get {
|
||||
return this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")};
|
||||
}
|
||||
set {
|
||||
this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")} = value;
|
||||
}
|
||||
}
|
||||
21
snippets/cc-mode/csharp-mode/class
Normal file
21
snippets/cc-mode/csharp-mode/class
Normal file
@@ -0,0 +1,21 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : class ... { ... }
|
||||
# --
|
||||
${5:public} class ${1:Name}
|
||||
{
|
||||
#region Ctor & Destructor
|
||||
/// <summary>
|
||||
/// ${3:Standard Constructor}
|
||||
/// </summary>
|
||||
public $1($2)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ${4:Default Destructor}
|
||||
/// </summary>
|
||||
public ~$1()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
6
snippets/cc-mode/csharp-mode/comment
Normal file
6
snippets/cc-mode/csharp-mode/comment
Normal file
@@ -0,0 +1,6 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : /// <summary> ... </summary>
|
||||
# --
|
||||
/// <summary>
|
||||
/// $1
|
||||
/// </summary>
|
||||
4
snippets/cc-mode/csharp-mode/comment.1
Normal file
4
snippets/cc-mode/csharp-mode/comment.1
Normal file
@@ -0,0 +1,4 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : /// <param name="..."> ... </param>
|
||||
# --
|
||||
/// <param name="$1">$2</param>
|
||||
4
snippets/cc-mode/csharp-mode/comment.2
Normal file
4
snippets/cc-mode/csharp-mode/comment.2
Normal file
@@ -0,0 +1,4 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : /// <param name="..."> ... </param>
|
||||
# --
|
||||
/// <returns>$1</returns>
|
||||
4
snippets/cc-mode/csharp-mode/comment.3
Normal file
4
snippets/cc-mode/csharp-mode/comment.3
Normal file
@@ -0,0 +1,4 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : /// <exception cref="..."> ... </exception>
|
||||
# --
|
||||
/// <exception cref="$1">$2</exception>
|
||||
10
snippets/cc-mode/csharp-mode/method
Normal file
10
snippets/cc-mode/csharp-mode/method
Normal file
@@ -0,0 +1,10 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : public void Method { ... }
|
||||
# --
|
||||
/// <summary>
|
||||
/// ${5:Description}
|
||||
/// </summary>${2:$(if (string= (upcase text) "VOID") "" (format "%s%s%s" "\n/// <returns><c>" text "</c></returns>"))}
|
||||
${1:public} ${2:void} ${3:MethodName}($4)
|
||||
{
|
||||
$0
|
||||
}
|
||||
7
snippets/cc-mode/csharp-mode/namespace
Normal file
7
snippets/cc-mode/csharp-mode/namespace
Normal file
@@ -0,0 +1,7 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : namespace .. { ... }
|
||||
# --
|
||||
namespace $1
|
||||
{
|
||||
$0
|
||||
}
|
||||
16
snippets/cc-mode/csharp-mode/prop
Normal file
16
snippets/cc-mode/csharp-mode/prop
Normal file
@@ -0,0 +1,16 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : property ... ... { ... }
|
||||
# --
|
||||
/// <summary>
|
||||
/// $5
|
||||
/// </summary>
|
||||
/// <value>$6</value>
|
||||
$1 $2 $3
|
||||
{
|
||||
get {
|
||||
return this.$4;
|
||||
}
|
||||
set {
|
||||
this.$4 = value;
|
||||
}
|
||||
}
|
||||
6
snippets/cc-mode/csharp-mode/region
Normal file
6
snippets/cc-mode/csharp-mode/region
Normal file
@@ -0,0 +1,6 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : #region ... #endregion
|
||||
# --
|
||||
#region $1
|
||||
$0
|
||||
#endregion
|
||||
4
snippets/cc-mode/csharp-mode/using
Normal file
4
snippets/cc-mode/csharp-mode/using
Normal file
@@ -0,0 +1,4 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : using ...;
|
||||
# --
|
||||
using $1;
|
||||
4
snippets/cc-mode/csharp-mode/using.1
Normal file
4
snippets/cc-mode/csharp-mode/using.1
Normal file
@@ -0,0 +1,4 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : using System;
|
||||
# --
|
||||
using System;
|
||||
4
snippets/cc-mode/csharp-mode/using.2
Normal file
4
snippets/cc-mode/csharp-mode/using.2
Normal file
@@ -0,0 +1,4 @@
|
||||
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
#name : using System....;
|
||||
# --
|
||||
using System.$1;
|
||||
6
snippets/cc-mode/do
Normal file
6
snippets/cc-mode/do
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : do { ... } while (...)
|
||||
# --
|
||||
do
|
||||
{
|
||||
$0
|
||||
} while (${1:condition});
|
||||
6
snippets/cc-mode/for
Normal file
6
snippets/cc-mode/for
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : for (...; ...; ...) { ... }
|
||||
# --
|
||||
for (${1:int i = 0}; ${2:i < N}; ${3:++i})
|
||||
{
|
||||
$0
|
||||
}
|
||||
6
snippets/cc-mode/if
Normal file
6
snippets/cc-mode/if
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : if (...) { ... }
|
||||
# --
|
||||
if (${1:condition})
|
||||
{
|
||||
$0
|
||||
}
|
||||
3
snippets/cc-mode/inc
Normal file
3
snippets/cc-mode/inc
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : #include "..."
|
||||
# --
|
||||
#include "$1"
|
||||
3
snippets/cc-mode/inc.1
Normal file
3
snippets/cc-mode/inc.1
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : #include <...>
|
||||
# --
|
||||
#include <$1>
|
||||
7
snippets/cc-mode/main
Normal file
7
snippets/cc-mode/main
Normal file
@@ -0,0 +1,7 @@
|
||||
#name: int main(argc, argv) { ... }
|
||||
# --
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
$0
|
||||
return 0;
|
||||
}
|
||||
13
snippets/cc-mode/objc-mode/prop
Normal file
13
snippets/cc-mode/objc-mode/prop
Normal file
@@ -0,0 +1,13 @@
|
||||
#name : foo { ... } ; setFoo { ... }
|
||||
# --
|
||||
- (${1:id})${2:foo}
|
||||
{
|
||||
return $2;
|
||||
}
|
||||
|
||||
- (void)set${2:$(capitalize text)}:($1)aValue
|
||||
{
|
||||
[$2 autorelease];
|
||||
$2 = [aValue retain];
|
||||
}
|
||||
$0
|
||||
8
snippets/cc-mode/once
Normal file
8
snippets/cc-mode/once
Normal file
@@ -0,0 +1,8 @@
|
||||
#name : #ifndef XXX; #define XXX; #endif
|
||||
# --
|
||||
#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif /* $1 */
|
||||
6
snippets/cc-mode/struct
Normal file
6
snippets/cc-mode/struct
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : struct ... { ... }
|
||||
# --
|
||||
struct ${1:name}
|
||||
{
|
||||
$0
|
||||
};
|
||||
Reference in New Issue
Block a user