summaryrefslogtreecommitdiffstats
path: root/vim/snippets/objc.snippets
diff options
context:
space:
mode:
Diffstat (limited to 'vim/snippets/objc.snippets')
-rw-r--r--vim/snippets/objc.snippets47
1 files changed, 28 insertions, 19 deletions
diff --git a/vim/snippets/objc.snippets b/vim/snippets/objc.snippets
index 7c2cd6a..4749bb7 100644
--- a/vim/snippets/objc.snippets
+++ b/vim/snippets/objc.snippets
@@ -1,8 +1,8 @@
# #import <...>
-snippet imp
+snippet Imp
#import <${1:Cocoa/Cocoa.h}>${2}
# #import "..."
-snippet Imp
+snippet imp
#import "${1:`Filename()`.h}"${2}
# @selector(...)
snippet sel
@@ -12,10 +12,10 @@ snippet s
@"${1}"${2}
# Object
snippet o
- ${1:NSObject} *${2:foo} = [${3:$1 alloc}];${5}
+ ${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5}
# NSLog(...)
snippet log
- NSLog(@"${1}"${2});${3}
+ NSLog(@"${1:%@}"${2});${3}
# Class
snippet objc
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
@@ -28,10 +28,10 @@ snippet objc
@end
# Class Interface
snippet int
- @interface ${1:`Filename('', 'someClass')`}
- {${2}
+ @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
+ {${3}
}
- ${3}
+ ${4}
@end
# Class Implementation
snippet impl
@@ -41,11 +41,14 @@ snippet impl
snippet init
- (id)init
{
- if ((self = [super init]))
- {${1}
- }
+ [super init];
return self;
}
+snippet ifself
+ if (self = [super init]) {
+ ${1:/* code */}
+ }
+ return self;
snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
# Category
@@ -74,19 +77,19 @@ snippet bez
snippet m
- (${1:id})${2:method}
{
- ${3:return self;}
+ ${3}
}
# Method declaration
snippet md
- (${1:id})${2:method};${3}
# IBAction declaration
snippet ibad
- - (IBAction)${1:method};${2}
+ - (IBAction)${1:method}:(${2:id})sender;${3}
# IBAction method
snippet iba
- - (IBAction)${1:method}
+ - (IBAction)${1:method}:(${2:id})sender
{
- ${2}
+ ${3}
}
# awakeFromNib method
snippet wake
@@ -130,8 +133,8 @@ snippet objacc
$2 = $3;
}${4}
# for (object in array)
-snippet fora
- for (${1:Class} *${2:Object} in ${3:array}) {
+snippet forin
+ for (${1:Class} *${2:some$1} in ${3:array}) {
${4}
}
snippet forarray
@@ -144,13 +147,13 @@ snippet forarray
# IBOutlet
# @property (Objective-C 2.0)
snippet prop
- @property (${1:retain}) ${2:NSSomeClass} *${3:$2};${4}
+ @property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4}
# @synthesize (Objective-C 2.0)
snippet syn
@synthesize ${1:property};${2}
# [[ alloc] init]
snippet alloc
- [[${1:foo} alloc] init]${2};${3}
+ [[${1:foo} alloc] init${2}];${3}
# retain
snippet ret
[${1:foo} retain];${2}
@@ -165,7 +168,7 @@ snippet arel
snippet pool
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
${2:/* code */}
- [$1 release];
+ [$1 drain];
# Throw an exception
snippet except
NSException *${1:badness};
@@ -173,3 +176,9 @@ snippet except
reason:@"${3}"
userInfo:nil];
[$1 raise];
+snippet prag
+ #pragma mark ${1:foo}
+snippet cl
+ @class ${1:Foo};${2}
+snippet color
+ [[NSColor ${1:blackColor}] set];