neosnippet.vim/autoload/neocomplcache/sources/snippets_complete/c.snip
2012-09-22 23:52:30 -07:00

136 lines
2.1 KiB
Plaintext

snippet if
abbr if () {}
if (${1:/* condition */}) {
${0:/* code */}
}
snippet else
else {
${0}
}
snippet elseif
else if (${1:/* condition */}) {
${0}
}
snippet ifelse
abbr if () {} else {}
if (${1:condition}) {
${2}
} else {
${3}
}
snippet for
abbr for () {}
for (${1} = 0; $1 < ${2}; $1++) {
${0}
}
snippet while
abbr while () {}
while (${1:/* condition */}) {
${0:/* code */}
}
snippet do_while
alias do
do {
${0:/* code */}
} while (${1:/* condition */});
snippet switch
abbr switch () {}
switch (${1:var}) {
case ${2:val}:
${0}
break;
}
snippet function
alias func
abbr func() {}
${1:void} ${2:func_name}(${3}) {
${0}
}
snippet struct
abbr struct {}
struct ${1:name} {
${0:/* data */}
};
# Typedef struct
snippet struct_typedef
typedef struct ${1:name} {
${0:/* data */}
};
snippet enum
abbr enum {}
enum ${1:name} {
${0}
};
# main function.
snippet main
int main(int argc, char const* argv[])
{
${0}
return 0;
}
# #include <...>
snippet inc
alias #inc, #include
#include <${1:stdio}.h>${0}
# #include "..."
snippet inc2
alias #inc2, #include2
#include "${1:}.h"${0}
snippet ifndef
alias #ifndef
abbr #ifndef ... #define ... #endif
#ifndef $1
#define ${1:SYMBOL}
#endif${0}
snippet def
alias #def, #define
#define
# Include-Guard
snippet once
abbr include-guard
#ifndef ${1:SYMBOL}
#define $1
${0}
#endif /* end of include guard */
# Tertiary conditional
snippet conditional
(${1:/* condition */}) ? ${2:a} : ${3:b}
# Typedef
snippet typedef
typedef ${1:base_type} ${2:custom_type};
snippet printf
printf("${1}\n"${2});${0}
snippet fprintf
fprintf(${1:stderr}, "${2}\n"${3});${0}
snippet comment
alias /*
/* ${1:comment} */
${0}
snippet sizeof
alias size
sizeof(${0})