Skip to content

Commit

Permalink
added saner default snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
msanders authored and msanders committed Dec 28, 2009
1 parent 6562628 commit 1b26123
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 35 deletions.
2 changes: 2 additions & 0 deletions snippets/_.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ snippet c)
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2}
snippet date
`strftime("%Y-%m-%d")`
snippet ddate
`strftime("%B %d, %Y")`
15 changes: 9 additions & 6 deletions snippets/c.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ snippet main
${1}
return 0;
}
snippet mainn
int main(void)
{
${1}
return 0;
}
# #include <...>
snippet inc
#include <${1:stdio}.h>${2}
Expand All @@ -17,7 +23,7 @@ snippet Def
#define ${1:SYMBOL} ${2:value}
#endif${3}
snippet def
#define
#define
snippet ifdef
#ifdef ${1:FOO}
${2:#define }
Expand All @@ -27,10 +33,8 @@ snippet #if
${2}
#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/env ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`}
#ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`}

#define $1

Expand Down Expand Up @@ -104,7 +108,6 @@ snippet pr
# fprintf (again, this isn't as nice as TextMate's version, but it works)
snippet fpr
fprintf(${1:stderr}, "${2:%s}\n"${3});${4}
# This is kind of convenient
snippet .
[${1}]${2}
snippet un
unsigned
44 changes: 15 additions & 29 deletions snippets/objc.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,36 @@ snippet impl
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
# Protocol
snippet pro
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
snippet init
- (id)init
{
[super init];
if (self = [super init]) {
${1}
}
return self;
}
snippet ifself
if (self = [super init]) {
${1:/* code */}
}
return self;
snippet su
[super ${1:init}]${2}
snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
# Category
snippet cat
@interface ${1:NSObject} (${2:Category})
@interface ${1:NSObject} (${2:MyCategory})
@end

@implementation $1 ($2)
${3}
@end
# Category Interface
snippet cath
@interface ${1:NSObject} (${2:Category})
@interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory})
${3}
@end
# NSArray
snippet array
NSMutableArray *${1:array} = [NSMutable array];${2}
# NSDictionary
snippet dict
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
# NSBezierPath
snippet bez
NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2}
# Method
snippet m
- (${1:id})${2:method}
Expand Down Expand Up @@ -100,8 +95,8 @@ snippet wake
# Class Method
snippet M
+ (${1:id})${2:method}
{${3}
return nil;
{
${3:return nil;}
}
# Sub-method (Call super)
snippet sm
Expand All @@ -110,14 +105,6 @@ snippet sm
[super $2];${3}
return self;
}
# Method: Initialize
snippet I
+ (void) initialize
{
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys:
${1}@"value", @"key",
nil]];
}
# Accessor Methods For:
# Object
snippet objacc
Expand Down Expand Up @@ -160,7 +147,6 @@ snippet ret
# release
snippet rel
[${1:foo} release];
${2:$1 = nil;}
# autorelease
snippet arel
[${1:foo} autorelease];
Expand All @@ -177,7 +163,7 @@ snippet except
userInfo:nil];
[$1 raise];
snippet prag
#pragma mark ${1:foo}
#pragma mark ${1:-}
snippet cl
@class ${1:Foo};${2}
snippet color
Expand Down

0 comments on commit 1b26123

Please sign in to comment.