diff options
Diffstat (limited to 'luasnip_snippets')
| -rw-r--r-- | luasnip_snippets/c.json | 283 | ||||
| -rw-r--r-- | luasnip_snippets/cpp.json | 328 | ||||
| -rw-r--r-- | luasnip_snippets/csharp.json | 396 | ||||
| -rw-r--r-- | luasnip_snippets/latex.json | 558 |
4 files changed, 1447 insertions, 118 deletions
diff --git a/luasnip_snippets/c.json b/luasnip_snippets/c.json index 611d918..8c51548 100644 --- a/luasnip_snippets/c.json +++ b/luasnip_snippets/c.json @@ -1,27 +1,268 @@ { - "def": { + "for": { + "prefix": "for", + "body": [ + "for (${1:size_t} ${2:i} = ${3:0}; $2 < ${4:length}; $2++) {", + "\t$0", + "}" + ], + "description": "Code snippet for 'for' loop" + }, + "forr": { + "prefix": "forr", + "body": [ + "for (${1:size_t} ${2:i} = ${3:length} - 1; $2 >= ${4:0}; $2--) {", + "\t$0", + "}" + ], + "description": "Code snippet for reverse 'for' loop" + }, + "while": { + "prefix": "while", + "body": ["while ($1) {", "\t$0", "}"], + "description": "" + }, + "if": { + "prefix": "if", + "body": ["if ($1) {", "\t$0", "}"], + "description": "Code snippet for if statement" + }, + "else": { + "prefix": "else", + "body": ["else {", "\t$0", "}"], + "description": "Code snippet for else statement" + }, + "else if": { + "prefix": "else if", + "body": ["else if ($1) {", "\t$0", "}"], + "description": "Code snippet for else-if statement" + }, + "enum": { + "prefix": "enum", + "body": ["enum ${1:MyEnum} {", "\t$0", "};"], + "description": "Code snippet for enum" + }, + "#ifdef": { + "prefix": "#ifdef", + "body": ["#ifdef ${1:DEBUG}", "$0", "#endif /* $1 */"], + "description": "Code snippet for #ifdef" + }, + "#ifndef": { + "prefix": "#ifndef", + "body": ["#ifndef ${1:DEBUG}", "$0", "#endif /* !$1 */"], + "description": "Code snippet for #ifndef" + }, + "#if": { + "prefix": "#if", + "body": ["#if ${1:0}", "$0", "#endif /* $1 */"], + "description": "Code snippet for #if" + }, + "struct": { + "prefix": "struct", + "body": ["struct ${1:MyStruct} {", "\t$0", "};"], + "description": "Code snippet for struct" + }, + "typedef struct": { + "prefix": "structt", + "body": ["typedef struct {", "\t$0", "} ${1:MyStruct};"], + "description": "Code snippet to define a type with struct" + }, + "switch": { + "prefix": "switch", + "body": ["switch (${1:switch_on}) {", "\tdefault:", "\t\t$0", "\t\tbreak;", "}"], + "description": "Code snippet for switch statement" + }, + "case": { + "prefix": "case", + "body": ["case $1:", "\t$0", "\tbreak;"], + "description": "Code snippet for case branch" + }, + "union": { + "prefix": "union", + "body": ["union ${1:MyUnion} {", "\t$0", "};"], + "description": "Code snippet for union" + }, + "#inc": { + "prefix": "#inc", + "body": ["#include \"$0\""], + "description": "Code snippet for #include \" \"" + }, + "#inc<": { + "prefix": "#inc<", + "body": ["#include <$0>"], + "description": "Code snippet for #include < >" + }, + "#def": { "prefix": "def", - "description": "#define ...", - "body": "#define $1", - "luasnip": { - "priority": -50 - } - }, - "mark": { - "prefix": "mark", - "description": "#pragma mark (mark)", - "body": [ - "#if 0", - "${1:#pragma mark -", - "}#pragma mark $2", - "#endif", + "body": ["#define $0"], + "description": "Code snippet for #define \" \"" + }, + "Main function template": { + "prefix": "main", + "body": [ + "int main (int argc, char *argv[])", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard main function for a C program" + }, + "Standard Starter Template": { + "prefix": "sst", + "body": [ + "#include <stdio.h>", + "", + "int main (int argc, char *argv[])", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard starter template for a C program" + }, + "Stdlib Variant Starter Template": { + "prefix": "libsst", + "body": [ + "#include <stdio.h>", + "#include <stdlib.h>", "", - "$0" - ] + "int main (int argc, char *argv[])", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard starter template for a C program with stdlib included" }, - "fund": { - "prefix": "fund", - "description": "function declaration", - "body": "${1:void} ${2:function_name}($3);" + "Do...while loop": { + "prefix": "do", + "body": ["do {", "\t$1", "} while($2);"], + "description": "Creates a do...while loop" + }, + "Create linked list": { + "prefix": "clist", + "body": [ + "typedef struct _node * Link;", + "typedef struct _node node;", + "struct _node {", + "\tint value;", + "\tLink next;", + "};" + ], + "description": "Creates a linked list template" + }, + "Create a function": { + "prefix": "func", + "body": ["${2:void} ${1:func}(${4:void})", "{", "\t$3", "}"], + "description": "Creates a function" + }, + "Create int function": { + "prefix": "intfunc", + "body": ["int $1 ()", "{", "\tint $2 = $3;$4", "\treturn $2;", "}"], + "description": "Creates a function that returns the int type" + }, + "Create float function": { + "prefix": "flfunc", + "body": ["float $1 ()", "{", "\tfloat $2 = $3;$4", "\treturn $2;", "}"], + "description": "Creates a function that returns the float type" + }, + "Create double function": { + "prefix": "doubfunc", + "body": ["double $1 ()", "{", "\tdouble $2 = $3;$4", "\treturn $2;", "}"], + "description": "Creates a function that returns the double type" + }, + "Create string function": { + "prefix": "strfunc", + "body": ["char[] $1 ()", "{", "\tchar[] $2 = {$3};$4", "\treturn $2;", "}"], + "description": "Creates a function that returns the char array type" + }, + "Create long function": { + "prefix": "longfunc", + "body": ["long $1 ()", "{", "\tlong $2 = $3;$4", "\treturn $3;", "}"], + "description": "Creates a function that returns the long type" + }, + "Print variable of type float (2 decimal places)": { + "prefix": "pflo", + "body": ["printf(\"$0 :>> %.2f\\n\", $0);"], + "description": "Calls printf() to log value of variable of type float rounded to 2 decimal places" + }, + "Print variable of type integer": { + "prefix": "pint", + "body": ["printf(\"$0 :>> %d\\n\", $0);"], + "description": "Calls printf() to log value of variable of type signed integer" + }, + "Print variable of type char": { + "prefix": "pcha", + "body": ["printf(\"$0 :>> %c\\n\", $0);"], + "description": "Calls printf() to log value of variable of type char" + }, + "Print variable of type pointer": { + "prefix": "ppoint", + "body": ["printf(\"$0 :>> %p\\n\", (void *) $0);"], + "description": "Calls printf() to log value of variable of type pointer" + }, + "Print variable of type size_t": { + "prefix": "psiz", + "body": ["printf(\"$0 :>> %zu\\n\", $0);"], + "description": "Calls printf() to log value of variable of type size_t" + }, + "printf": { + "prefix": "printf", + "body": ["printf(\"$1\\n\"$0);"], + "description": "Generic printf() snippet" + }, + "sprintf": { + "prefix": "sprintf", + "body": ["sprintf($1, \"$2\\n\"$0);"], + "description": "Generic sprintf() snippet" + }, + "fprintf": { + "prefix": "fprintf", + "body": ["fprintf(${1:stderr}, \"$2\\n\"$0);"], + "description": "Generic fprintf() snippet" + }, + "scanf": { + "prefix": "scanf", + "body": ["scanf(\"$1\"$0);"], + "description": "Generic scanf() snippet" + }, + "sscanf": { + "prefix": "sscanf", + "body": ["sscanf($1, \"$2\"$0);"], + "description": "Generic sscanf() snippet" + }, + "fscanf": { + "prefix": "fscanf", + "body": ["fscanf($1, \"$2\"$0);"], + "description": "Generic fscanf() snippet" + }, + "Allocate memory using malloc": { + "prefix": "mal", + "body": [ + "${1:int} *${2:v} = malloc(${3:1} * sizeof($1));", + "", + "if (!$2) {", + "\tfprintf(stderr, \"Memory allocation failed!\\n\");", + "\t$4;", + "}", + "$0", + "free($2);" + ], + "description": "Allocates memory to a pointer variable using malloc(), then deallocates using free()." + }, + "Allocate memory using calloc": { + "prefix": "cal", + "body": [ + "${1:int} *${2:v} = calloc(${3:1}, sizeof($1));", + "", + "if (!$2) {", + "\tfprintf(stderr, \"Memory allocation failed!\\n\");", + "\t$4;", + "}", + "$0", + "free($2);" + ], + "description": "Allocates memory to a pointer variable using calloc(), then deallocates using free()." } } diff --git a/luasnip_snippets/cpp.json b/luasnip_snippets/cpp.json index d9b0ba0..4e4f6b8 100644 --- a/luasnip_snippets/cpp.json +++ b/luasnip_snippets/cpp.json @@ -1,120 +1,254 @@ { - "main": { - "prefix": "main", + "for": { + "prefix": "for", "body": [ - "int main(int argc, char *argv[])", - "{", + "for (${1:size_t} ${2:i} = ${3:0}; $2 < ${4:length}; $2++) {", "\t$0", - "\treturn 0;", - "\\}" + "}" ], - "luasnip": { - "priority": -49 - } + "description": "Code snippet for 'for' loop" }, - "readfile": { - "prefix": "readfile", - "description": "read file (readF)", - "body": [ - "std::vector<char> v;", - "if (FILE *fp = fopen(${1:\"filename\"}, \"r\"))", - "{", - "\tchar buf[1024];", - "\twhile(size_t len = fread(buf, 1, sizeof(buf), fp))", - "\t\tv.insert(v.end(), buf, buf + len);", - "\tfclose(fp);", - "\\}" - ] - }, - "map": { - "prefix": "map", - "description": "std::map (map)", - "body": "std::map<${1:key}, ${2:value}> map$0;" - }, - "vector": { - "prefix": "vector", - "description": "std::vector (v)", - "body": "std::vector<${1:char}> v$0;" - }, - "tp": { - "prefix": "tp", - "description": "template <typename ..> (template)", - "body": "template <typename ${1:_InputIter}>" - }, - "boost_test": { - "prefix": "boost_test", - "description": "Boost test module", + "forr": { + "prefix": "forr", "body": [ - "#define BOOST_TEST_MODULE ${1:TestModuleName}", - "#include <boost/test/included/unit_test.hpp>", - "", - "BOOST_AUTO_TEST_CASE(${2:TestCaseName})", - "{", - "\t${0:TestDefinition}", - "\\}", - "" - ] + "for (${1:size_t} ${2:i} = ${3:length} - 1; $2 >= ${4:0}; $2--) {", + "\t$0", + "}" + ], + "description": "Code snippet for reverse 'for' loop" + }, + "do": { + "prefix": "do", + "body": ["do", "{", "\t$0", "} while($1);"], + "description": "Code snippet for do...while loop" + }, + "while": { + "prefix": "while", + "body": ["while ($1)", "{", "\t$2", "}"], + "description": "" + }, + "foreach": { + "prefix": "foreach", + "body": ["for(${1:auto} ${2:var} : ${3:collection_to_loop})", "{", "\t$0", "}"], + "description": "Code snippet for range-based for loop (c++11) statement" + }, + "if": { + "prefix": "if", + "body": ["if ($1) {", "\t$0", "}"], + "description": "Code snippet for if statement" + }, + "else": { + "prefix": "else", + "body": ["else {", "\t$0", "}"], + "description": "Code snippet for else statement" + }, + "else if": { + "prefix": "else if", + "body": ["else if ($1) {", "\t$0", "}"], + "description": "Code snippet for else-if statement" }, - "boost_suite": { - "prefix": "boost_suite", - "description": "Boost test suite module", + "enum": { + "prefix": "enum", + "body": ["enum ${1:MyEnum} {", "\t$0", "};"], + "description": "Code snippet for enum" + }, + "enum class": { + "prefix": "enum class", + "body": ["enum class ${1:MyClass} {$0};"], + "description": "Code snippet for enum class (c++11)" + }, + "class": { + "prefix": "class", "body": [ - "#define BOOST_TEST_MODULE ${1:TestModuleName}", - "#include <boost/test/included/unit_test.hpp>", + "class ${1:MyClass}", + "{", + "public:", + "\t$1();", + "\t$1($1 &&) = default;", + "\t$1(const $1 &) = default;", + "\t$1 &operator=($1 &&) = default;", + "\t$1 &operator=(const $1 &) = default;", + "\t~$1();", "", - "BOOST_AUTO_TEST_SUITE(${2:SuiteName})", + "private:", + "\t$2", + "};", "", - "BOOST_AUTO_TEST_CASE(${3:TestCaseName})", + "$1::$1()", "{", - "\t${0:TestDefinition}", - "\\}", + "}", "", - "BOOST_AUTO_TEST_SUITE_END()", - "" - ] + "$1::~$1()", + "{", + "}" + ], + "description": "Code snippet for class" }, - "boost_test_fixture": { - "prefix": "boost_test_fixture", - "description": "Boost test module with fixture", + "eclass": { + "prefix": "eclass", "body": [ - "#define BOOST_TEST_MODULE ${1:TestModuleName}", - "#include <boost/test/included/unit_test.hpp>", - "", - "struct ${2:FixtureName} {", - "\t$2() {\\}", - "\tvirtual ~$2() {\\}", - "\t/* define members here */", - "\\};", - "", - "BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2)", + "class ${1:MyClass}", "{", - "\t${0:TestDefinition}", - "\\}", + "public:", + "\t$2", + "private:", + "\t$3", + "};", "" - ] + ], + "description": "Code snippet for empty class" }, - "boost_suite_fixture": { - "prefix": "boost_suite_fixture", - "description": "Boost test suite with fixture", + "qclass": { + "prefix": "qclass", "body": [ - "#define BOOST_TEST_MODULE ${1:TestModuleName}", - "#include <boost/test/included/unit_test.hpp>", - "", - "struct ${2:FixtureName} {", - "\t$2() {\\}", - "\tvirtual ~$2() {\\}", - "\t/* define members here */", - "\\};", - "", - "BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2)", - "", - "BOOST_AUTO_TEST_CASE(${4:TestCaseName})", + "class ${1:MyClass} : public QObject", "{", - "\t${0:TestDefinition}", - "\\}", + "\tQ_OBJECT;", + "public:", + "\nexplicit $1(QObject *parent = nullptr);", + "\t$2", + "signals:", "", - "BOOST_AUTO_TEST_SUITE_END()", + "public slots:", + "};", "" - ] + ], + "description": "Code snippet for empty Qt class" + }, + "classi": { + "prefix": "classi", + "body": [ + "class ${1:MyClass}", + "{", + "public:", + "\t$1() = default;", + "\t$1($1 &&) = default;", + "\t$1(const $1 &) = default;", + "\t$1 &operator=($1 &&) = default;", + "\t$1 &operator=(const $1 &) = default;", + "\t~$1() = default;", + "", + "private:", + "\t$2", + "};" + ], + "description": "Code snippet for class with inline constructor/destructor" + }, + "interface": { + "prefix": "interface", + "body": ["__interface I${1:Interface}", "{", "\t$0", "};"], + "description": "Code snippet for interface (Visual C++)" + }, + "namespace": { + "prefix": "namespace", + "body": ["namespace ${1:MyNamespace}", "{", "\t$0", "}"] + }, + "#ifdef": { + "prefix": "#ifdef", + "body": ["#ifdef ${1:DEBUG}", "$0", "#endif // ${DEBUG}"], + "description": "Code snippet for #ifdef" + }, + "#ifndef": { + "prefix": "#ifndef", + "body": ["#ifndef ${1:DEBUG}", "$0", "#endif // !$1"], + "description": "Code snippet for #ifndef" + }, + "#if": { + "prefix": "#if", + "body": ["#if ${1:0}", "$0", "#endif // $1"], + "description": "Code snippet for #if" + }, + "struct": { + "prefix": "struct", + "body": ["struct ${1:MyStruct}", "{", "\t$0", "};"], + "description": "Code snippet for struct" + }, + "switch": { + "prefix": "switch", + "body": ["switch (${1:switch_on}) {", "\tdefault:", "\t\t$0", "\t\tbreak;", "}"], + "description": "Code snippet for switch statement" + }, + "try": { + "prefix": "try", + "body": [ + "try {", + "\t", + "}", + "catch (const std::exception&) {", + "\t$1", + "}" + ], + "description": "Code snippet for try catch" + }, + "union": { + "prefix": "union", + "body": ["union ${1:MyUnion}", "{", "\t$0", "};"], + "description": "Code snippet for union" + }, + "cout": { + "prefix": "cout", + "body": ["std::cout << \"${1:message}\" << std::endl;"], + "description": "Code snippet for printing to std::cout, provided the header is set" + }, + "cin": { + "prefix": "cin", + "body": ["std::cin >> $1;"], + "description": "Code snippet for std::cin, provided the header is set" + }, + "printf": { + "prefix": "printf", + "body": ["printf(\"$1\\n\"$0);"], + "description": "Generic printf() snippet" + }, + "sprintf": { + "prefix": "sprintf", + "body": ["sprintf($1, \"$2\\n\"$0);"], + "description": "Generic sprintf() snippet" + }, + "fprintf": { + "prefix": "fprintf", + "body": ["fprintf(${1:stderr}, \"$2\\n\"$0);"], + "description": "Generic fprintf() snippet" + }, + "scanf": { + "prefix": "scanf", + "body": ["scanf(\"$1\"$0);"], + "description": "Generic scanf() snippet" + }, + "sscanf": { + "prefix": "sscanf", + "body": ["sscanf($1, \"$2\"$0);"], + "description": "Generic sscanf() snippet" + }, + "fscanf": { + "prefix": "fscanf", + "body": ["fscanf($1, \"$2\"$0);"], + "description": "Generic fscanf() snippet" + }, + "#inc": { + "prefix": "#inc", + "body": ["#include \"$0\""], + "description": "Code snippet for #include \" \"" + }, + "#inc<": { + "prefix": "#inc<", + "body": ["#include <$0>"], + "description": "Code snippet for #include < >" + }, + "#def": { + "prefix": "def", + "body": ["#define $0"], + "description": "Code snippet for #define \" \"" + }, + "Main function template": { + "prefix": "main", + "body": [ + "int main (int argc, char *argv[])", + "{", + "\t$1", + "\treturn 0;", + "}" + ], + "description": "A standard main function for a C++ program" } } diff --git a/luasnip_snippets/csharp.json b/luasnip_snippets/csharp.json new file mode 100644 index 0000000..2cde7e5 --- /dev/null +++ b/luasnip_snippets/csharp.json @@ -0,0 +1,396 @@ +{ + "Attribute using recommended pattern": { + "prefix": "attribute", + "body": [ + "[System.AttributeUsage(System.AttributeTargets.${1:All}, Inherited = ${2:false}, AllowMultiple = ${3:true})]", + "sealed class ${4:My}Attribute : System.Attribute", + "{", + " // See the attribute guidelines at", + " // http://go.microsoft.com/fwlink/?LinkId=85236", + " readonly string positionalString;", + " ", + " // This is a positional argument", + " public ${4:My}Attribute(string positionalString)", + " {", + " this.positionalString = positionalString;", + " ", + " // TODO: Implement code here", + " ${5:throw new System.NotImplementedException();}", + " }", + " ", + " public string PositionalString", + " {", + " get { return positionalString; }", + " }", + " ", + " // This is a named argument", + " public int NamedInt { get; set; }", + "}" + ], + "description": "Attribute using recommended pattern" + }, + "Checked block": { + "prefix": "checked", + "body": ["checked", "{", " $0", "}"], + "description": "Checked block" + }, + "Class": { + "prefix": "class", + "body": ["class ${1:Name}", "{", " $0", "}"], + "description": "Class" + }, + "Console.WriteLine": { + "prefix": "cw", + "body": ["System.Console.WriteLine($0);"], + "description": "Console.WriteLine" + }, + "do...while loop": { + "prefix": "do", + "body": ["do", "{", " $0", "} while (${1:true});"], + "description": "do...while loop" + }, + "Else statement": { + "prefix": "else", + "body": ["else", "{", " $0", "}"], + "description": "Else statement" + }, + "Enum": { + "prefix": "enum", + "body": ["enum ${1:Name}", "{", " $0", "}"], + "description": "Enum" + }, + "Implementing Equals() according to guidelines": { + "prefix": "equals", + "body": [ + "// override object.Equals", + "public override bool Equals(object obj)", + "{", + " //", + " // See the full list of guidelines at", + " // http://go.microsoft.com/fwlink/?LinkID=85237", + " // and also the guidance for operator== at", + " // http://go.microsoft.com/fwlink/?LinkId=85238", + " //", + " ", + " if (obj == null || GetType() != obj.GetType())", + " {", + " return false;", + " }", + " ", + " // TODO: write your implementation of Equals() here", + " ${1:throw new System.NotImplementedException();}", + " return base.Equals (obj);", + "}", + "", + "// override object.GetHashCode", + "public override int GetHashCode()", + "{", + " // TODO: write your implementation of GetHashCode() here", + " ${2:throw new System.NotImplementedException();}", + " return base.GetHashCode();", + "}" + ], + "description": "Implementing Equals() according to guidelines" + }, + "Exception": { + "prefix": "exception", + "body": [ + "[System.Serializable]", + "public class ${1:My}Exception : ${2:System.Exception}", + "{", + " public ${1:My}Exception() { }", + " public ${1:My}Exception(string message) : base(message) { }", + " public ${1:My}Exception(string message, System.Exception inner) : base(message, inner) { }", + " protected ${1:My}Exception(", + " System.Runtime.Serialization.SerializationInfo info,", + " System.Runtime.Serialization.StreamingContext context) : base(info, context) { }", + "}" + ], + "description": "Exception" + }, + "Foreach statement": { + "prefix": "foreach", + "body": [ + "foreach (${1:var} ${2:item} in ${3:collection})", + "{", + " $0", + "}" + ], + "description": "Foreach statement" + }, + "Reverse for loop": { + "prefix": "forr", + "body": [ + "for (int ${1:i} = ${2:length} - 1; ${1:i} >= 0 ; ${1:i}--)", + "{", + " $0", + "}" + ], + "description": "Reverse for loop" + }, + "for loop": { + "prefix": "for", + "body": [ + "for (int ${1:i} = 0; ${1:i} < ${2:length}; ${1:i}++)", + "{", + " $0", + "}" + ], + "description": "for loop" + }, + "if statement": { + "prefix": "if", + "body": ["if (${1:true})", "{", " $0", "}"], + "description": "if statement" + }, + "Indexer": { + "prefix": "indexer", + "body": [ + "${1:public} ${2:object} this[${3:int} index]", + "{", + " get { $4 }", + " set { $0 }", + "}" + ], + "description": "Indexer" + }, + "Interface": { + "prefix": "interface", + "body": ["interface I${1:Name}", "{", " $0", "}"], + "description": "Interface" + }, + "Safely invoking an event": { + "prefix": "invoke", + "body": [ + "${1:EventHandler} temp = ${2:MyEvent};", + "if (temp != null)", + "{", + " temp($0);", + "}" + ], + "description": "Safely invoking an event" + }, + "Simple iterator": { + "prefix": "iterator", + "body": [ + "public System.Collections.Generic.IEnumerator<${1:ElementType}> GetEnumerator()", + "{", + " $0throw new System.NotImplementedException();", + " yield return default(${1:ElementType});", + "}" + ], + "description": "Simple iterator" + }, + "Named iterator/indexer pair using a nested class": { + "prefix": "iterindex", + "body": [ + "public ${1:Name}Iterator ${1:Name}", + "{", + " get", + " {", + " return new ${1:Name}Iterator(this);", + " }", + "}", + "", + "public class ${1:Name}Iterator", + "{", + " readonly ${2:ClassName} outer;", + " ", + " internal ${1:Name}Iterator(${2:ClassName} outer)", + " {", + " this.outer = outer;", + " }", + " ", + " // TODO: provide an appropriate implementation here", + " public int Length { get { return 1; } }", + " ", + " public ${3:ElementType} this[int index]", + " {", + " get", + " {", + " //", + " // TODO: implement indexer here", + " //", + " // you have full access to ${2:ClassName} privates", + " //", + " ${4:throw new System.NotImplementedException();}", + " return default(${3:ElementType});", + " }", + " }", + " ", + " public System.Collections.Generic.IEnumerator<${3:ElementType}> GetEnumerator()", + " {", + " for (int i = 0; i < this.Length; i++)", + " {", + " yield return this[i];", + " }", + " }", + "}" + ], + "description": "Named iterator/indexer pair using a nested class" + }, + "Lock statement": { + "prefix": "lock", + "body": ["lock (${1:this})", "{", " $0", "}"], + "description": "Lock statement" + }, + "MessageBox.Show": { + "prefix": "mbox", + "body": ["System.Windows.Forms.MessageBox.Show(\"${1:Text}\");$0"], + "description": "MessageBox.Show" + }, + "Namespace": { + "prefix": "namespace", + "body": ["namespace ${1:Name}", "{", " $0", "}"], + "description": "Namespace" + }, + "#if": { + "prefix": "ifd", + "body": ["#if ${1:true}", " $0", "#endif"], + "description": "#if" + }, + "#region": { + "prefix": "region", + "body": ["#region ${1:Name}", " $0", "#endregion"], + "description": "#region" + }, + "Property and backing field": { + "prefix": "propfull", + "body": [ + "private ${1:int} ${2:myVar};", + "public ${1:int} ${3:MyProperty}", + "{", + " get { return ${2:myVar}; }", + " set { ${2:myVar} = value; }", + "}", + "$0" + ], + "description": "Property and backing field" + }, + "propg": { + "prefix": "propg", + "body": ["public ${1:int} ${2:MyProperty} { get; private set; }$0"], + "description": "An automatically implemented property with a 'get' accessor and a private 'set' accessor. C# 3.0 or higher" + }, + "prop": { + "prefix": "prop", + "body": ["public ${1:int} ${2:MyProperty} { get; set; }$0"], + "description": "An automatically implemented property. C# 3.0 or higher" + }, + "sim": { + "prefix": "sim", + "body": [ + "static int Main(string[] args)", + "{", + " $0", + " return 0;", + "}" + ], + "description": "int Main()" + }, + "Struct": { + "prefix": "struct", + "body": ["struct ${1:Name}", "{", " $0", "}"], + "description": "Struct" + }, + "svm": { + "prefix": "svm", + "body": ["static void Main(string[] args)", "{", " $0", "}"], + "description": "void Main()" + }, + "Switch statement": { + "prefix": "switch", + "body": ["switch (${1:switch_on})", "{", " $0", " default:", "}"], + "description": "Switch statement" + }, + "Try finally": { + "prefix": "tryf", + "body": ["try", "{", " $1", "}", "finally", "{", " $0", "}"], + "description": "Try finally" + }, + "Try catch": { + "prefix": "try", + "body": [ + "try", + "{", + " $1", + "}", + "catch (${2:System.Exception})", + "{", + " $0", + " throw;", + "}" + ], + "description": "Try catch" + }, + "Unchecked block": { + "prefix": "unchecked", + "body": ["unchecked", "{", " $0", "}"], + "description": "Unchecked block" + }, + "Unsafe statement": { + "prefix": "unsafe", + "body": ["unsafe", "{", " $0", "}"], + "description": "Unsafe statement" + }, + "Using statement": { + "prefix": "using", + "body": ["using (${1:resource})", "{", " $0", "}"], + "description": "Using statement" + }, + "While loop": { + "prefix": "while", + "body": ["while (${1:true})", "{", " $0", "}"], + "description": "While loop" + }, + "constructor": { + "prefix": "ctor", + "body": [ + "${1:public} ${2:$TM_FILENAME_BASE}(${3:Parameters})", + "{", + " $0", + "}" + ], + "description": "constructor" + }, + "xUnit Test": { + "prefix": "fact", + "body": [ + "[Fact]", + "public void ${1:TestName}()", + "{", + "//Given", + "", + "//When", + "", + "//Then", + "}$0" + ], + "description": "create xunit test method" + }, + "Creates a Method structure": { + "prefix": "method", + "body": [ + "${1:public} ${2:void} ${3:MyMethod}(${4:string} ${5:parameter})", + "{", + "\t$0", + "}" + ], + "description": "Creates a Method structure" + }, + "Creates an Async Method structure": { + "prefix": "method_async", + "body": [ + "${1:public} async ${2:Task}<${3:object}> ${4:MyMethodAsync}(${5:string} ${6:parameter})", + "{", + "\t$0", + "}" + ], + "description": "Creates an async Method structure" + }, + "cls": { + "prefix": "cls", + "body": ["${1:public} class ${2:$TM_FILENAME_BASE}", "{", "\t$0", "}"], + "description": "Create new class" + } +} diff --git a/luasnip_snippets/latex.json b/luasnip_snippets/latex.json new file mode 100644 index 0000000..38979cf --- /dev/null +++ b/luasnip_snippets/latex.json @@ -0,0 +1,558 @@ +{ + "item": { + "prefix": "item", + "body": "\n\\item ", + "description": "\\item on a newline" + }, + "subscript": { + "prefix": "__", + "body": "_{${1:${TM_SELECTED_TEXT}}}", + "description": "subscript" + }, + "superscript": { + "prefix": "**", + "body": "^{${1:${TM_SELECTED_TEXT}}}", + "description": "superscript" + }, + "etc": { + "prefix": "...", + "body": "\\dots", + "description": "\\dots" + }, + "cdot": { + "prefix": "@.", + "body": "\\cdot", + "description": "\\cdot" + }, + "infinity": { + "prefix": "@8", + "body": "\\infty", + "description": "infinity symbol" + }, + "partial": { + "prefix": "@6", + "body": "\\partial", + "description": "partial derivative symbol" + }, + "fraction": { + "prefix": "@/", + "body": "\\frac{$1}{$2}$0", + "description": "fraction" + }, + "fraction2": { + "prefix": "@%", + "body": "\\frac{$1}{$2}$0", + "description": "fraction" + }, + "hat": { + "prefix": "@^", + "body": "\\hat{${1:${TM_SELECTED_TEXT}}}$0", + "description": "hat" + }, + "bar": { + "prefix": "@_", + "body": "\\bar{${1:${TM_SELECTED_TEXT}}}$0", + "description": "bar" + }, + "circ": { + "prefix": "@@", + "body": "\\circ", + "description": "circ" + }, + "supcirc": { + "prefix": "@0", + "body": "^\\circ", + "description": "superscript circ" + }, + "dot": { + "prefix": "@;", + "body": "\\dot{${1:${TM_SELECTED_TEXT}}}$0", + "description": "dot" + }, + "ddot": { + "prefix": "@:", + "body": "\\ddot{${1:${TM_SELECTED_TEXT}}}$0", + "description": "ddot" + }, + + "equiv": { + "prefix": "@=", + "body": "\\equiv", + "description": "equiv symbol" + }, + "times": { + "prefix": "@*", + "body": "\\times", + "description": "times symbol" + }, + "leq": { + "prefix": "@<", + "body": "\\leq", + "description": "leq symbol" + }, + "geq": { + "prefix": "@>", + "body": "\\geq", + "description": "geq symbol" + }, + "sqrt": { + "prefix": "@2", + "body": "\\sqrt{${1:${TM_SELECTED_TEXT}}}$0", + "description": "sqrt command" + }, + "int": { + "prefix": "@I", + "body": "\\int_{$1}^{$2}$0", + "description": "integral" + }, + "Big|": { + "prefix": "@|", + "body": "\\Big|", + "description": "Big |" + }, + "bigcup": { + "prefix": "@+", + "body": "\\bigcup", + "description": "bigcup" + }, + "bigcap": { + "prefix": "@-", + "body": "\\bigcap", + "description": "bigcap" + }, + "nonumber": { + "prefix": "@,", + "body": "\\nonumber", + "description": "nonumber" + }, + "equation": { + "prefix": "BEQ", + "body": "\\begin{equation}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{equation}", + "description": "equation environment" + }, + "equation*": { + "prefix": "BSEQ", + "body": "\\begin{equation*}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{equation*}", + "description": "equation* environment" + }, + "align": { + "prefix": "BAL", + "body": "\\begin{align}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{align}", + "description": "align environment" + }, + "align*": { + "prefix": "BSAL", + "body": "\\begin{align*}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{align*}", + "description": "align* environment" + }, + "gather": { + "prefix": "BGA", + "body": "\\begin{gather}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{gather}", + "description": "gather environment" + }, + "gather*": { + "prefix": "BSGA", + "body": "\\begin{gather*}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{gather*}", + "description": "gather* environment" + }, + "multline": { + "prefix": "BMU", + "body": "\\begin{multline}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{multline}", + "description": "multline environment" + }, + "multline*": { + "prefix": "BSMU", + "body": "\\begin{multline*}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{multline*}", + "description": "multline* environment" + }, + "itemize": { + "prefix": "BIT", + "body": "\\begin{itemize}\n\t\\item ${0:${TM_SELECTED_TEXT}}\n\\end{itemize}", + "description": "itemize environment" + }, + "enumerate": { + "prefix": "BEN", + "body": "\\begin{enumerate}\n\t\\item ${0:${TM_SELECTED_TEXT}}\n\\end{enumerate}", + "description": "enumerate environment" + }, + "split": { + "prefix": "BSPL", + "body": "\\begin{split}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{split}", + "description": "split environment" + }, + "cases": { + "prefix": "BCAS", + "body": "\\begin{cases}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{cases}", + "description": "cases environment" + }, + "frame": { + "prefix": "BFR", + "body": "\\begin{frame}\n\t\\frametitle{${1:<title>}}\n\n\t${0:${TM_SELECTED_TEXT}}\n\n\\end{frame}", + "description": "frame" + }, + "figure": { + "prefix": "BFI", + "body": "\\begin{figure}[${1:htbp}]\n\t\\centering\n\t${0:${TM_SELECTED_TEXT}}\n\t\\caption{${2:<caption>}}\n\t\\label{${3:<label>}}\n\\end{figure}", + "description": "figure" + }, + "table": { + "prefix": "BTA", + "body": "\\begin{table}[${1:htbp}]\n\t\\centering\\begin{tabular}{${4:<columns>}}\n\t\t${0:${TM_SELECTED_TEXT}}\n\t\\end{tabular}\n\t\\caption{${2:<caption>}}\n\t\\label{${3:<label>}}\n\\end{table}", + "description": "table" + }, + "tikzpicture": { + "prefix": "BTP", + "body": "\\begin{tikzpicture}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{tikzpicture}", + "description": "tikzpicture" + }, + "set font size": { + "prefix": "fontsize", + "body": "${1|\\Huge,\\huge,\\LARGE,\\Large,\\large,\\normalsize,\\small,\\footnotesize,\\scriptsize,\\tiny|}", + "description": "Select a font size" + }, + "textnormal": { + "prefix": "FNO", + "body": "\\textnormal{${1:${TM_SELECTED_TEXT:text}}}", + "description": "normal font" + }, + "textrm": { + "prefix": "FRM", + "body": "\\textrm{${1:${TM_SELECTED_TEXT:text}}}", + "description": "roman font" + }, + "emph": { + "prefix": "FEM", + "body": "\\emph{${1:${TM_SELECTED_TEXT:text}}}", + "description": "emphasis font" + }, + "textsf": { + "prefix": "FSF", + "body": "\\textsf{${1:${TM_SELECTED_TEXT:text}}}", + "description": "sans serif font" + }, + "texttt": { + "prefix": "FTT", + "body": "\\texttt{${1:${TM_SELECTED_TEXT:text}}}", + "description": "typewriter font" + }, + "textit": { + "prefix": "FIT", + "body": "\\textit{${1:${TM_SELECTED_TEXT:text}}}", + "description": "italic font" + }, + "textsl": { + "prefix": "FSL", + "body": "\\textsl{${1:${TM_SELECTED_TEXT:text}}}", + "description": "slanted font" + }, + "textsc": { + "prefix": "FSC", + "body": "\\textsc{${1:${TM_SELECTED_TEXT:text}}}", + "description": "smallcaps font" + }, + "underline": { + "prefix": "FUL", + "body": "\\underline{${1:${TM_SELECTED_TEXT:text}}}", + "description": "Underline text" + }, + "uppercase": { + "prefix": "FUC", + "body": "\\uppercase{${1:${TM_SELECTED_TEXT:text}}}", + "description": "Make text uppercase (all caps)" + }, + "lowercase": { + "prefix": "FLC", + "body": "\\lowercase{${1:${TM_SELECTED_TEXT:text}}}", + "description": "Make text lowercase (no caps)" + }, + "textbf": { + "prefix": "FBF", + "body": "\\textbf{${1:${TM_SELECTED_TEXT:text}}}", + "description": "bold font" + }, + "textsuperscript": { + "prefix": "FSS", + "body": "\\textsuperscript{${1:${TM_SELECTED_TEXT:text}}}", + "description": "Make text a superscript" + }, + "textsubscript": { + "prefix": "FBS", + "body": "\\textsubscript{${1:${TM_SELECTED_TEXT:text}}}", + "description": "Make text a superscript" + }, + "mathrm": { + "prefix": "MRM", + "body": "\\mathrm{${1:${TM_SELECTED_TEXT:text}}}", + "description": "math roman font" + }, + "mathbf": { + "prefix": "MBF", + "body": "\\mathbf{${1:${TM_SELECTED_TEXT:text}}}", + "description": "math bold font" + }, + "mathbb": { + "prefix": "MBB", + "body": "\\mathbb{${1:${TM_SELECTED_TEXT:text}}}", + "description": "math blackboard bold font" + }, + "mathcal": { + "prefix": "MCA", + "body": "\\mathcal{${1:${TM_SELECTED_TEXT:text}}}", + "description": "math caligraphic font" + }, + "mathit": { + "prefix": "MIT", + "body": "\\mathit{${1:${TM_SELECTED_TEXT:text}}}", + "description": "math italic font" + }, + "mathtt": { + "prefix": "MTT", + "body": "\\mathtt{${1:${TM_SELECTED_TEXT:text}}}", + "description": "math typewriter font" + }, + "alpha": { + "prefix": "@a", + "body": "\\alpha", + "description": "alpha" + }, + "beta": { + "prefix": "@b", + "body": "\\beta", + "description": "beta" + }, + "chi": { + "prefix": "@c", + "body": "\\chi", + "description": "chi" + }, + "delta": { + "prefix": "@d", + "body": "\\delta", + "description": "delta" + }, + "epsilon": { + "prefix": "@e", + "body": "\\epsilon", + "description": "epsilon" + }, + "varepsilon": { + "prefix": "@ve", + "body": "\\varepsilon", + "description": "varepsilon" + }, + "phi": { + "prefix": "@f", + "body": "\\phi", + "description": "phi" + }, + "varphi": { + "prefix": "@vf", + "body": "\\varphi", + "description": "varphi" + }, + "gamma": { + "prefix": "@g", + "body": "\\gamma", + "description": "gamma" + }, + "eta": { + "prefix": "@h", + "body": "\\eta", + "description": "eta" + }, + "iota": { + "prefix": "@i", + "body": "\\iota", + "description": "iota" + }, + "kappa": { + "prefix": "@k", + "body": "\\kappa", + "description": "kappa" + }, + "lambda": { + "prefix": "@l", + "body": "\\lambda", + "description": "lambda" + }, + "mu": { + "prefix": "@m", + "body": "\\mu", + "description": "mu" + }, + "nu": { + "prefix": "@n", + "body": "\\nu", + "description": "nu" + }, + "pi": { + "prefix": "@p", + "body": "\\pi", + "description": "pi" + }, + "theta": { + "prefix": "@q", + "body": "\\theta", + "description": "theta" + }, + "vartheta": { + "prefix": "@vq", + "body": "\\vartheta", + "description": "vartheta" + }, + "rho": { + "prefix": "@r", + "body": "\\rho", + "description": "rho" + }, + "sigma": { + "prefix": "@s", + "body": "\\sigma", + "description": "sigma" + }, + "varsigma": { + "prefix": "@vs", + "body": "\\varsigma", + "description": "varsigma" + }, + "tau": { + "prefix": "@t", + "body": "\\tau", + "description": "tau" + }, + "upsilon": { + "prefix": "@u", + "body": "\\upsilon", + "description": "upsilon" + }, + "omega": { + "prefix": "@o", + "body": "\\omega", + "description": "omega" + }, + "wedge": { + "prefix": "@&", + "body": "\\wedge", + "description": "wedge" + }, + "xi": { + "prefix": "@x", + "body": "\\xi", + "description": "xi" + }, + "psi": { + "prefix": "@y", + "body": "\\psi", + "description": "psi" + }, + "zeta": { + "prefix": "@z", + "body": "\\zeta", + "description": "zeta" + }, + "Delta": { + "prefix": "@D", + "body": "\\Delta", + "description": "Delta" + }, + "Phi": { + "prefix": "@F", + "body": "\\Phi", + "description": "Phi" + }, + "Gamma": { + "prefix": "@G", + "body": "\\Gamma", + "description": "Gamma" + }, + "Theta": { + "prefix": "@Q", + "body": "\\Theta", + "description": "Theta" + }, + "Lambda": { + "prefix": "@L", + "body": "\\Lambda", + "description": "Lambda" + }, + "Xi": { + "prefix": "@X", + "body": "\\Xi", + "description": "Xi" + }, + "Psi": { + "prefix": "@Y", + "body": "\\Psi", + "description": "Psi" + }, + "Sigma": { + "prefix": "@S", + "body": "\\Sigma", + "description": "Sigma" + }, + "Upsilon": { + "prefix": "@U", + "body": "\\Upsilon", + "description": "Upsilon" + }, + "Omega": { + "prefix": "@W", + "body": "\\Omega", + "description": "Omega" + }, + "(": { + "prefix": "@(", + "body": "\\left( ${1:${TM_SELECTED_TEXT}} \\right)", + "description": "left( ... right)" + }, + "{": { + "prefix": "@{", + "body": "\\left\\{ ${1:${TM_SELECTED_TEXT}} \\right\\\\\\}", + "description": "left{ ... right}" + }, + "[": { + "prefix": "@[", + "body": "\\left[ ${1:${TM_SELECTED_TEXT}} \\right]", + "description": "left[ ... right]" + }, + "wrapEnv": { + "body": "\n\\begin{$1}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{$1}", + "description": "Wrap selection into an environment" + }, + "part": { + "prefix": "SPA", + "body": "\\part{${1:${TM_SELECTED_TEXT}}}", + "description": "part" + }, + "chapter": { + "prefix": "SCH", + "body": "\\chapter{${1:${TM_SELECTED_TEXT}}}", + "description": "chapter" + }, + "section": { + "prefix": "SSE", + "body": "\\section{${1:${TM_SELECTED_TEXT}}}", + "description": "section" + + }, + "subsection": { + "prefix": "SSS", + "body": "\\subsection{${1:${TM_SELECTED_TEXT}}}", + "description": "subsection" + }, + "subsubsection": { + "prefix": "SS2", + "body": "\\subsubsection{${1:${TM_SELECTED_TEXT}}}", + "description": "subsubsection" + }, + "paragraph": { + "prefix": "SPG", + "body": "\\paragraph{${1:${TM_SELECTED_TEXT}}}", + "description": "paragraph" + }, + "subparagraph": { + "prefix": "SSP", + "body": "\\subparagraph{${1:${TM_SELECTED_TEXT}}}", + "description": "subparagraph" + } +} |
