-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc.snip
executable file
·170 lines (142 loc) · 2.15 KB
/
c.snip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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:type} ${2:index name} = 0; $2 < ${3:loop num}; ++$2)
{
${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} ${2:value}
#endif${0}
snippet def
alias #def, #define
#define
# Include-Guard
snippet includeonce
#ifndef ${1:SYMBOL}
#define $1
${0}
#endif // $1
# 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})
snippet //doxynrm
alias com
//!${0}
snippet //doxymem
alias memcom
//!<${0}
snippet //doxybri
alias brief
//! @brief${0}
# Header
snippet fileheader
//**********************************************************************
//! @file `expand("%:t")`
//! @brief ${1:describe}
//! @author d_nishimura
//**********************************************************************
${0}