Skip to content

Instantly share code, notes, and snippets.

@ovidiucs
Last active December 15, 2019 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ovidiucs/d23272d6cb0543d703db3534bfb57b6b to your computer and use it in GitHub Desktop.
Save ovidiucs/d23272d6cb0543d703db3534bfb57b6b to your computer and use it in GitHub Desktop.
{
"Standard Template": {
"prefix": "main",
"body": [
"#include <stdio.h>",
"",
"int main (int argc, char** argv) {",
"\t\t$0\n",
" return EXIT_SUCCESS;",
"}"
],
"description": "A standard starter template for a C program"
},
"Stdlib Template": {
"prefix": "sst",
"body": [
"#include <stdio.h>",
"#include <stdlib.h>",
"",
"int main (int argc, char** argv) {",
"\t\t$0\n",
"\t\treturn EXIT_SUCCESS;",
"}"
],
"description": "A standard starter template for a C program with stdlib included"
},
"Struct": {
"prefix": "struct",
"body": [
"/**",
"* Struct for ${1:Describe what is this struct for}",
"* @ingroup set",
"*/",
"typedef struct {",
"\t\t${1:type}\t${2:name}; /**< Some documentation for the member ${3:name}*/",
"}${3:name};"
],
"description": "Creates documented strucutre"
},
"Define Groups": {
"prefix": "doxgroups",
"body": [
"/**",
"* @defgroup ${1:Name} ${2:Short_For}",
"* @brief ${3:Brief desc}",
"*/"
],
"description": "Doxygen Groups"
},
"For Loop": {
"prefix": "for",
"body": [
"for ( ${1:intial};${2:test};${3:update} ) {",
"\t\t$0",
"}"
],
"description": "Simple for loop"
},
"While loop": {
"prefix" : "while",
"body": [
"while (${1:condition}) {",
"\t\t$0",
"}\n"
],
"description": "Simple while loop"
},
"Switch": {
"prefix" : "switch",
"body":[
"switch (${1:expr}) {",
"case ${2:value}:",
"return $0;",
"default:",
"return;",
"}\n"
],
"description": "Switch statement"
},
"If Condition": {
"prefix": "if",
"body": [
"if ( ${1:condition} ) {",
"\t\t$0",
"}\n"
],
"description": "If Condition"
},
"Ifelse Condition": {
"prefix": "ifel",
"body": [
"if ( ${1:condition} ) {",
"\t\t$0",
"} else {",
"",
"}\n"
],
"description": "If ... Else condition"
},
"IfelseIF Condition": {
"prefix": "ifelif",
"body": [
"if ( ${1:condition} ) {",
"\t\t$0",
"} else if ( ${2:condition} ) {",
"",
"} else if ( ${3:condition} ) {",
"",
"} else {",
"",
"}\n"
],
"description": "If ... Else if ... Else If.. Else Condition"
},
"IfIfElseElse Condition": {
"prefix": "ififelel",
"body": [
"if ( ${1:condition} ) {",
"\t\tif ( ${2:second_condition} ) {",
"\t\t\t\t$0",
"\t\t} else {",
"\t\t\t\t",
"\t} else {",
"",
"}\n"
],
"description": "If ... Else if ... Else If.. Else Condition"
},
"def macro": {
"prefix": "def",
"body": [
"#define ${1:WHAT} ${2:VALUE}"
],
"description": "Define"
},
"inc macro": {
"prefix": "inc",
"body": [
"#include <${1:header.h}>"
],
"description": "Include header file"
},
"Comment Block": {
"prefix": "doxfunc",
"body": [
"/**",
"* @brief ${1:Brief description of class or function (fits a single line)}",
"* @ingroup ${2}",
"* ",
"* @params[in]: ${3}",
"* @params[out]: ${4}",
"* @return: ${5}",
"* @code{.c}",
"*",
"* @endcode",
"*/",
""
],
"description": "Doxygen C Function documentation"
},
"Comment line": {
"prefix": "cmtln",
"body": [
"/*** ${1:SaySomething} ***/",
""
],
"description": "Comment Line"
},
"Comment block": {
"prefix": "cmtblk",
"body": [
"/**",
"* ${1:Comment}",
"*/",
""
],
"description": "Comment Block"
},
"Break section": {
"prefix": "cmtsec",
"body": [
"// --------------------------- ${1:SaySomething} ---------------------------",
""
],
"description": "Comment Section"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment