Added if snippets and update of coding style to most common

This commit is contained in:
rudfol 2013-12-29 22:03:34 +00:00
parent d7a4f82bc1
commit 20c12eda3a

View File

@ -18,12 +18,12 @@ ${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}}
#endif #endif
endsnippet endsnippet
snippet inc "#include local header (inc)" snippet #inc "#include <> (Inc)"
#include "${1:`!p snip.rv = snip.basename + '.h'`}" #include <${1:.h}>
endsnippet endsnippet
snippet Inc "#include <> (Inc)" snippet #Inc "#include local header (inc)"
#include <${1:.h}> #include "${1:`!p snip.rv = snip.basename + '.h'`}"
endsnippet endsnippet
snippet mark "#pragma mark (mark)" snippet mark "#pragma mark (mark)"
@ -44,15 +44,13 @@ int main(int argc, char *argv[])
endsnippet endsnippet
snippet for "for loop (for)" snippet for "for loop (for)"
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}){
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} }
endsnippet endsnippet
snippet fori "for int loop (fori)" snippet fori "for int loop (with declaration)"
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}){
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} }
endsnippet endsnippet
@ -99,26 +97,35 @@ fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%
endsnippet endsnippet
snippet if "if .. (if)" snippet if "if .. (if)"
if (${1:/* condition */}) if (${1:/* condition */}){
{ ${0:/* code */}
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} }
endsnippet endsnippet
snippet el "else .. (else)" snippet el "else .. (else)"
else { else {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} ${0:/* code */}
} }
endsnippet endsnippet
snippet ife "if .. else (ife)" snippet eli "else if .. (else if)"
if (${1:/* condition */}) else if (${1:/* condition */}) {
{ ${0:/* code */}
${2:/* code */}
} }
else endsnippet
{
${3:/* else */} snippet ifeli "if..else.if .. (ifeli)"
if (${1:/* condition */}) {
${2:/* code */}
} else if (${3:/* condition */}) {
${0:/* code */}
}
snippet ife "if .. else (ife)"
if (${1:/* condition */}){
${2:/* code */}
} else{
${0:/* else */}
} }
endsnippet endsnippet