2012-02-02 04:33:35 +00:00
|
|
|
snippet if
|
|
|
|
abbr if () {}
|
2012-10-30 08:53:14 +00:00
|
|
|
if (${1:#:condition}) {
|
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet else
|
|
|
|
else {
|
2012-10-30 08:53:14 +00:00
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet elseif
|
2012-10-30 08:53:14 +00:00
|
|
|
else if (${1:#:condition}) {
|
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet ifelse
|
|
|
|
abbr if () {} else {}
|
2012-10-30 08:53:14 +00:00
|
|
|
if (${1:#:condition}) {
|
|
|
|
${2:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
} else {
|
|
|
|
${3}
|
|
|
|
}
|
|
|
|
|
|
|
|
snippet for
|
|
|
|
abbr for () {}
|
|
|
|
for (${1} = 0; $1 < ${2}; $1++) {
|
2012-10-30 08:53:14 +00:00
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet while
|
|
|
|
abbr while () {}
|
2012-10-30 08:53:14 +00:00
|
|
|
while (${1:#:condition}) {
|
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet do_while
|
|
|
|
alias do
|
|
|
|
do {
|
2012-10-30 08:53:14 +00:00
|
|
|
${0:TARGET:code}
|
|
|
|
} while (${1:#:condition});
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
snippet switch
|
|
|
|
abbr switch () {}
|
2012-10-30 08:53:14 +00:00
|
|
|
switch (${1:#:var}) {
|
|
|
|
case ${2:#:val}:
|
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
snippet function
|
|
|
|
alias func
|
|
|
|
abbr func() {}
|
2012-10-30 08:53:14 +00:00
|
|
|
${1:void} ${2:#:func_name}(${3:#:args}) {
|
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet struct
|
|
|
|
abbr struct {}
|
2012-10-30 08:53:14 +00:00
|
|
|
struct ${1:#:name} {
|
|
|
|
${0:TARGET:data}
|
2012-02-02 04:33:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Typedef struct
|
|
|
|
snippet struct_typedef
|
2012-10-30 08:53:14 +00:00
|
|
|
typedef struct ${1:#:name} {
|
|
|
|
${0:TARGET:data}
|
2012-02-02 04:33:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
snippet enum
|
|
|
|
abbr enum {}
|
2012-10-30 08:53:14 +00:00
|
|
|
enum ${1:#:name} {
|
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
};
|
|
|
|
|
2012-10-14 01:11:05 +00:00
|
|
|
# hard-tab is necessary; C indent doesn't support this.
|
2012-02-02 04:33:35 +00:00
|
|
|
snippet main
|
2012-03-15 15:06:21 +00:00
|
|
|
int main(int argc, char const* argv[])
|
|
|
|
{
|
2012-10-30 08:53:14 +00:00
|
|
|
${0:TARGET}
|
2012-03-15 15:06:21 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
# #include <...>
|
|
|
|
snippet inc
|
|
|
|
alias #inc, #include
|
|
|
|
#include <${1:stdio}.h>${0}
|
|
|
|
# #include "..."
|
|
|
|
snippet inc2
|
|
|
|
alias #inc2, #include2
|
2012-10-30 08:53:14 +00:00
|
|
|
#include "${1}.h"${0}
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
snippet ifndef
|
|
|
|
alias #ifndef
|
|
|
|
abbr #ifndef ... #define ... #endif
|
|
|
|
#ifndef $1
|
2012-10-30 08:53:14 +00:00
|
|
|
#define ${1:#:SYMBOL}
|
2012-02-02 04:33:35 +00:00
|
|
|
#endif${0}
|
|
|
|
|
|
|
|
snippet def
|
|
|
|
alias #def, #define
|
|
|
|
#define
|
|
|
|
|
|
|
|
# Include-Guard
|
|
|
|
snippet once
|
|
|
|
abbr include-guard
|
|
|
|
#ifndef ${1:SYMBOL}
|
|
|
|
#define $1
|
|
|
|
|
2012-10-30 08:53:14 +00:00
|
|
|
${0:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
#endif /* end of include guard */
|
|
|
|
|
2013-07-10 01:30:39 +00:00
|
|
|
# Ternary conditional operator
|
2012-02-02 04:33:35 +00:00
|
|
|
snippet conditional
|
2012-10-30 08:53:14 +00:00
|
|
|
(${1:#:condition}) ? ${2:#:a} : ${3:#:b}
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
snippet typedef
|
2012-10-30 08:53:14 +00:00
|
|
|
typedef ${1:#:base_type} ${2:#:custom_type};
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
snippet printf
|
2012-10-14 01:11:05 +00:00
|
|
|
abbr printf("...\n", ...);
|
|
|
|
printf("${1}\n", ${2});
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
snippet fprintf
|
2012-10-14 01:11:05 +00:00
|
|
|
abbr fprintf(..., "...\n", ...);
|
|
|
|
fprintf(${1:stderr}, "${2}\n"${3});
|
2012-02-02 04:33:35 +00:00
|
|
|
|
|
|
|
snippet comment
|
|
|
|
alias /*
|
2012-10-30 08:53:14 +00:00
|
|
|
/* ${1:#:comment} */
|
2012-02-02 04:33:35 +00:00
|
|
|
${0}
|
|
|
|
|
|
|
|
snippet sizeof
|
|
|
|
alias size
|
2012-10-30 08:53:14 +00:00
|
|
|
sizeof(${0:TARGET})
|
2012-02-02 04:33:35 +00:00
|
|
|
|
2012-10-14 01:11:05 +00:00
|
|
|
snippet helloworld
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char const* argv[])
|
|
|
|
{
|
|
|
|
puts("hello, world!");
|
|
|
|
return 0;
|
|
|
|
}
|
2012-10-30 08:53:14 +00:00
|
|
|
|
2013-07-09 12:35:44 +00:00
|
|
|
snippet fopen
|
2013-07-10 01:24:59 +00:00
|
|
|
abbr fopen("...", "...");
|
2013-07-10 01:32:12 +00:00
|
|
|
fopen("${1:PATH}", "${2:MODE}");
|
|
|
|
${0:TARGET}
|
|
|
|
fclose(${3:FD});
|
2013-07-09 12:35:44 +00:00
|
|
|
|
|
|
|
snippet fgets
|
2013-07-10 01:24:59 +00:00
|
|
|
abbr fgets(row, length, file);
|
2013-07-10 01:32:12 +00:00
|
|
|
fgets(${0:ROW}, ${1:LENGTH}, ${2:FILE});
|