neosnippet.vim/autoload/neosnippet/snippets/c.snip

136 lines
2.1 KiB
Plaintext
Raw Normal View History

2012-02-02 04:33:35 +00:00
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
2012-09-23 06:52:30 +00:00
typedef struct ${1:name} {
2012-02-02 04:33:35 +00:00
${0:/* data */}
};
snippet enum
abbr enum {}
enum ${1:name} {
${0}
};
# main function.
snippet main
2012-03-15 15:06:21 +00:00
int main(int argc, char const* argv[])
{
${0}
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
#include "${1:}.h"${0}
snippet ifndef
alias #ifndef
abbr #ifndef ... #define ... #endif
#ifndef $1
2012-05-11 23:41:49 +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
${0}
#endif /* end of include guard */
# Tertiary conditional
snippet conditional
2012-09-23 06:52:30 +00:00
(${1:/* condition */}) ? ${2:a} : ${3:b}
2012-02-02 04:33:35 +00:00
# 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})