2012-08-16 23:41:25 -04:00
|
|
|
# #import <...>
|
|
|
|
snippet Imp
|
2013-11-16 14:45:48 -05:00
|
|
|
#import <${1:Cocoa/Cocoa.h}>
|
2012-08-16 23:41:25 -04:00
|
|
|
# #import "..."
|
|
|
|
snippet imp
|
2013-11-16 14:45:48 -05:00
|
|
|
#import "${1:`vim_snippets#Filename()`.h}"
|
2012-08-16 23:41:25 -04:00
|
|
|
# @selector(...)
|
|
|
|
snippet sel
|
2013-11-16 14:45:48 -05:00
|
|
|
@selector(${1:method}:)
|
2012-08-16 23:41:25 -04:00
|
|
|
# @"..." string
|
|
|
|
snippet s
|
2013-11-16 14:45:48 -05:00
|
|
|
@"${1}"
|
2012-08-16 23:41:25 -04:00
|
|
|
# Object
|
|
|
|
snippet o
|
2013-11-16 14:45:48 -05:00
|
|
|
${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};
|
2012-08-16 23:41:25 -04:00
|
|
|
# NSLog(...)
|
|
|
|
snippet log
|
2013-11-16 14:45:48 -05:00
|
|
|
NSLog(@"${1:%@}"${2});
|
2012-08-16 23:41:25 -04:00
|
|
|
# Class
|
|
|
|
snippet objc
|
2013-07-17 19:06:05 -04:00
|
|
|
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
2012-08-16 23:41:25 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation $1
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
# Class Interface
|
|
|
|
snippet int
|
2013-07-17 19:06:05 -04:00
|
|
|
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
2012-08-16 23:41:25 -04:00
|
|
|
{${3}
|
|
|
|
}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
snippet @interface
|
2013-07-17 19:06:05 -04:00
|
|
|
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
2012-08-16 23:41:25 -04:00
|
|
|
{${3}
|
|
|
|
}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
# Class Implementation
|
|
|
|
snippet impl
|
2013-07-17 19:06:05 -04:00
|
|
|
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
snippet @implementation
|
2013-07-17 19:06:05 -04:00
|
|
|
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
# Protocol
|
|
|
|
snippet pro
|
2013-07-17 19:06:05 -04:00
|
|
|
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
snippet @protocol
|
2013-07-17 19:06:05 -04:00
|
|
|
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
# init Definition
|
|
|
|
snippet init
|
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
if (self = [super init]) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
# dealloc Definition
|
|
|
|
snippet dealloc
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0:deallocations}
|
2012-08-16 23:41:25 -04:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
snippet su
|
2013-11-16 14:45:48 -05:00
|
|
|
[super ${1:init}]
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ibo
|
2013-11-16 14:45:48 -05:00
|
|
|
IBOutlet ${1:NSSomeClass} *${2:$1};
|
2012-08-16 23:41:25 -04:00
|
|
|
# Category
|
|
|
|
snippet cat
|
|
|
|
@interface ${1:NSObject} (${2:MyCategory})
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation $1 ($2)
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
# Category Interface
|
|
|
|
snippet cath
|
2013-07-17 19:06:05 -04:00
|
|
|
@interface ${1:`vim_snippets#Filename('$1', 'NSObject')`} (${2:MyCategory})
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
@end
|
|
|
|
# Method
|
|
|
|
snippet m
|
|
|
|
- (${1:id})${2:method}
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Method declaration
|
|
|
|
snippet md
|
2013-11-16 14:45:48 -05:00
|
|
|
- (${1:id})${2:method};
|
2012-08-16 23:41:25 -04:00
|
|
|
# IBAction declaration
|
|
|
|
snippet ibad
|
2013-11-16 14:45:48 -05:00
|
|
|
- (IBAction)${1:method}:(${2:id})sender;
|
2012-08-16 23:41:25 -04:00
|
|
|
# IBAction method
|
|
|
|
snippet iba
|
|
|
|
- (IBAction)${1:method}:(${2:id})sender
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# awakeFromNib method
|
|
|
|
snippet wake
|
|
|
|
- (void)awakeFromNib
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Class Method
|
|
|
|
snippet M
|
|
|
|
+ (${1:id})${2:method}
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
${0:return nil;}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Sub-method (Call super)
|
|
|
|
snippet sm
|
|
|
|
- (${1:id})${2:method}
|
|
|
|
{
|
2013-11-16 14:45:48 -05:00
|
|
|
[super $2];${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
# Accessor Methods For:
|
|
|
|
# Object
|
|
|
|
snippet objacc
|
|
|
|
- (${1:id})${2:thing}
|
|
|
|
{
|
|
|
|
return $2;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)set$2:($1)${3:new$2}
|
|
|
|
{
|
|
|
|
[$3 retain];
|
|
|
|
[$2 release];
|
|
|
|
$2 = $3;
|
2013-11-16 14:45:48 -05:00
|
|
|
}
|
2012-08-16 23:41:25 -04:00
|
|
|
# for (object in array)
|
|
|
|
snippet forin
|
|
|
|
for (${1:Class} *${2:some$1} in ${3:array}) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet fore
|
|
|
|
for (${1:object} in ${2:array}) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0:statements}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet forarray
|
|
|
|
unsigned int ${1:object}Count = [${2:array} count];
|
|
|
|
|
|
|
|
for (unsigned int index = 0; index < $1Count; index++) {
|
|
|
|
${3:id} $1 = [$2 $1AtIndex:index];
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet fora
|
|
|
|
unsigned int ${1:object}Count = [${2:array} count];
|
|
|
|
|
|
|
|
for (unsigned int index = 0; index < $1Count; index++) {
|
|
|
|
${3:id} $1 = [$2 $1AtIndex:index];
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Try / Catch Block
|
|
|
|
snippet @try
|
|
|
|
@try {
|
|
|
|
${1:statements}
|
|
|
|
}
|
|
|
|
@catch (NSException * e) {
|
|
|
|
${2:handler}
|
|
|
|
}
|
|
|
|
@finally {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0:statements}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet @catch
|
|
|
|
@catch (${1:exception}) {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0:handler}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
snippet @finally
|
|
|
|
@finally {
|
2013-11-16 14:45:48 -05:00
|
|
|
${0:statements}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# IBOutlet
|
|
|
|
# @property (Objective-C 2.0)
|
|
|
|
snippet prop
|
2013-11-16 14:45:48 -05:00
|
|
|
@property (${1:retain}) ${2:NSSomeClass} ${3:*$2};
|
2012-08-16 23:41:25 -04:00
|
|
|
# @synthesize (Objective-C 2.0)
|
|
|
|
snippet syn
|
2013-11-16 14:45:48 -05:00
|
|
|
@synthesize ${1:property};
|
2012-08-16 23:41:25 -04:00
|
|
|
# [[ alloc] init]
|
|
|
|
snippet alloc
|
2013-11-16 14:45:48 -05:00
|
|
|
[[${1:foo} alloc] init${2}];
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet a
|
2013-11-16 14:45:48 -05:00
|
|
|
[[${1:foo} alloc] init${2}];
|
2012-08-16 23:41:25 -04:00
|
|
|
# retain
|
|
|
|
snippet ret
|
2013-11-16 14:45:48 -05:00
|
|
|
[${1:foo} retain];
|
2012-08-16 23:41:25 -04:00
|
|
|
# release
|
|
|
|
snippet rel
|
2013-11-16 14:45:48 -05:00
|
|
|
[${0:foo} release];
|
2012-08-16 23:41:25 -04:00
|
|
|
# autorelease
|
|
|
|
snippet arel
|
2013-11-16 14:45:48 -05:00
|
|
|
[${0:foo} autorelease];
|
2012-08-16 23:41:25 -04:00
|
|
|
# autorelease pool
|
|
|
|
snippet pool
|
|
|
|
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
|
2013-11-16 14:45:48 -05:00
|
|
|
${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
[$1 drain];
|
|
|
|
# Throw an exception
|
|
|
|
snippet except
|
|
|
|
NSException *${1:badness};
|
|
|
|
$1 = [NSException exceptionWithName:@"${2:$1Name}"
|
2013-11-16 14:45:48 -05:00
|
|
|
reason:@"${0}"
|
2012-08-16 23:41:25 -04:00
|
|
|
userInfo:nil];
|
|
|
|
[$1 raise];
|
|
|
|
snippet prag
|
2013-11-16 14:45:48 -05:00
|
|
|
#pragma mark ${0:-}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet cl
|
2013-11-16 14:45:48 -05:00
|
|
|
@class ${1:Foo};
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet color
|
2013-11-16 14:45:48 -05:00
|
|
|
[[NSColor ${0:blackColor}] set];
|
2012-08-16 23:41:25 -04:00
|
|
|
# NSArray
|
|
|
|
snippet array
|
2013-11-16 14:45:48 -05:00
|
|
|
NSMutableArray *${1:array} = [NSMutable array];
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet nsa
|
2013-11-16 14:45:48 -05:00
|
|
|
NSArray ${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet nsma
|
2013-11-16 14:45:48 -05:00
|
|
|
NSMutableArray ${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet aa
|
2013-11-16 14:45:48 -05:00
|
|
|
NSArray * array;
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet ma
|
2013-11-16 14:45:48 -05:00
|
|
|
NSMutableArray * array;
|
2012-08-16 23:41:25 -04:00
|
|
|
# NSDictionary
|
|
|
|
snippet dict
|
2013-11-16 14:45:48 -05:00
|
|
|
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet nsd
|
2013-11-16 14:45:48 -05:00
|
|
|
NSDictionary ${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet nsmd
|
2013-11-16 14:45:48 -05:00
|
|
|
NSMutableDictionary ${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
# NSString
|
|
|
|
snippet nss
|
2013-11-16 14:45:48 -05:00
|
|
|
NSString ${0}
|
2012-08-16 23:41:25 -04:00
|
|
|
snippet nsms
|
2013-11-16 14:45:48 -05:00
|
|
|
NSMutableString ${0}
|