Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 58379fe90d
Fetching contributors…

Cannot retrieve contributors at this time

98 lines (97 sloc) 2.245 kB
# main()
snippet main
int main(int argc, const char **argv){
${1}
return 0;
}
snippet dbg
printf("${1:HereItIs.}\n");${2}
snippet sf
FILE *log = fopen("/home/centos/scim.log", "a");
fprintf(log, "sf: %s:%d:%d ${1}.\n", __FILE__, __LINE__, getpid()${2});
fclose(log);
snippet hii
printf("%d: HereItIs.\n", __LINE__);
snippet err
fprintf(stderr, "${1:error}\n");${2}
# For Loop
snippet for
for(${1:i}=${2:0}; $1<${2:count}; $1${3:++}){
${4}
snippet For
for(${1:i}=${2:0}; $1<${2:count}; $1${3:++}){
${4}
}${5}
snippet if
if(${1:/* condition */}){
${2:/* code */}
}${3}
snippet #if
#if ${1:FOO}
${2}
#endif
# #include <...>
snippet inc
#include<${1:`&ft=='c'?'unistd':'iostream'`}`&ft=='c'?'.h':''`>${2}
# #include "..."
snippet Inc
#include"${1:`Filename("$1.h")`}"${2}
# #ifndef ... #define ... #endif
snippet Def
#ifndef $1
#define ${1:SYMBOL} ${2:value}
#endif${3}
snippet def
#define
snippet ifdef
#ifdef ${1:FOO}
${2:#define }
#endif
# Header Include-Guard
# (the randomizer code is taken directly from TextMate; it could probably be
# cleaner, I don't know how to do it in vim script)
snippet once
#ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system("/usr/bin/ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`}
#define $1
${2}
#endif /* end of include guard: $1 */
# While Loop
snippet wh
while (${1:/* condition */}) {
$ {2:/* code */}
}
# Function
snippet fun
${1:void} ${2:function_name}(${3})
{
$ {4:/* code */}
}
# Function Declaration
snippet fund
${1:void} ${2:function_name}(${3});${4}
# Typedef
snippet td
typedef ${1:int} ${2:MyCustomType};${3}
# Struct
snippet st
struct ${1:`Filename('$1_t', 'name')`} {
$ {2:/* data */}
}${3: /* optional variable list */};${4}
# Typedef struct
snippet tds
typedef struct ${2:_$1 }{
$ {3:/* data */}
} ${1:`Filename('$1_t', 'name')`};
# Typdef enum
snippet tde
typedef enum {
$ {1:/* data */}
} ${2:foo};
# printf
# unfortunately version this isn't as nice as TextMates's, given the lack of a
# dynamic `...`
snippet pr
printf("${1:%s}\n"${2});${3}
# fprintf (again, this isn't as nice as TextMate's version, but it works)
snippet fpr
fprintf(${1:stderr}, "${2:%s}\n"${3});${4}
Jump to Line
Something went wrong with that request. Please try again.