mirror of
https://github.com/gryf/snipmate.vim.git
synced 2025-12-19 20:38:05 +01:00
updated objc snippets
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
# #import <...>
|
# #import <...>
|
||||||
snippet imp
|
snippet Imp
|
||||||
#import <${1:Cocoa/Cocoa.h}>${2}
|
#import <${1:Cocoa/Cocoa.h}>${2}
|
||||||
# #import "..."
|
# #import "..."
|
||||||
snippet Imp
|
snippet imp
|
||||||
#import "${1:`Filename()`.h}"${2}
|
#import "${1:`Filename()`.h}"${2}
|
||||||
# @selector(...)
|
# @selector(...)
|
||||||
snippet sel
|
snippet sel
|
||||||
@@ -12,26 +12,26 @@ snippet s
|
|||||||
@"${1}"${2}
|
@"${1}"${2}
|
||||||
# Object
|
# Object
|
||||||
snippet o
|
snippet o
|
||||||
${1:NSObject} *${2:foo} = [${3:$1 alloc}];${5}
|
${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5}
|
||||||
# NSLog(...)
|
# NSLog(...)
|
||||||
snippet log
|
snippet log
|
||||||
NSLog(@"${1}"${2});${3}
|
NSLog(@"${1:%@}"${2});${3}
|
||||||
# Class
|
# Class
|
||||||
snippet objc
|
snippet objc
|
||||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation $1
|
@implementation $1
|
||||||
${3}
|
${3}
|
||||||
@end
|
@end
|
||||||
# Class Interface
|
# Class Interface
|
||||||
snippet int
|
snippet int
|
||||||
@interface ${1:`Filename('', 'someClass')`}
|
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||||
{${2}
|
{${3}
|
||||||
}
|
}
|
||||||
${3}
|
${4}
|
||||||
@end
|
@end
|
||||||
# Class Implementation
|
# Class Implementation
|
||||||
snippet impl
|
snippet impl
|
||||||
@@ -41,18 +41,21 @@ snippet impl
|
|||||||
snippet init
|
snippet init
|
||||||
- (id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
[super init];
|
||||||
{${1}
|
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
snippet ifself
|
||||||
|
if (self = [super init]) {
|
||||||
|
${1:/* code */}
|
||||||
|
}
|
||||||
|
return self;
|
||||||
snippet ibo
|
snippet ibo
|
||||||
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
|
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
|
||||||
# Category
|
# Category
|
||||||
snippet cat
|
snippet cat
|
||||||
@interface ${1:NSObject} (${2:Category})
|
@interface ${1:NSObject} (${2:Category})
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation $1 ($2)
|
@implementation $1 ($2)
|
||||||
${3}
|
${3}
|
||||||
@end
|
@end
|
||||||
@@ -74,19 +77,19 @@ snippet bez
|
|||||||
snippet m
|
snippet m
|
||||||
- (${1:id})${2:method}
|
- (${1:id})${2:method}
|
||||||
{
|
{
|
||||||
${3:return self;}
|
${3}
|
||||||
}
|
}
|
||||||
# Method declaration
|
# Method declaration
|
||||||
snippet md
|
snippet md
|
||||||
- (${1:id})${2:method};${3}
|
- (${1:id})${2:method};${3}
|
||||||
# IBAction declaration
|
# IBAction declaration
|
||||||
snippet ibad
|
snippet ibad
|
||||||
- (IBAction)${1:method};${2}
|
- (IBAction)${1:method}:(${2:id})sender;${3}
|
||||||
# IBAction method
|
# IBAction method
|
||||||
snippet iba
|
snippet iba
|
||||||
- (IBAction)${1:method}
|
- (IBAction)${1:method}:(${2:id})sender
|
||||||
{
|
{
|
||||||
${2}
|
${3}
|
||||||
}
|
}
|
||||||
# awakeFromNib method
|
# awakeFromNib method
|
||||||
snippet wake
|
snippet wake
|
||||||
@@ -122,7 +125,7 @@ snippet objacc
|
|||||||
{
|
{
|
||||||
return $2;
|
return $2;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)set$2:($1)${3:new$2}
|
- (void)set$2:($1)${3:new$2}
|
||||||
{
|
{
|
||||||
[$3 retain];
|
[$3 retain];
|
||||||
@@ -130,13 +133,13 @@ snippet objacc
|
|||||||
$2 = $3;
|
$2 = $3;
|
||||||
}${4}
|
}${4}
|
||||||
# for (object in array)
|
# for (object in array)
|
||||||
snippet fora
|
snippet forin
|
||||||
for (${1:Class} *${2:Object} in ${3:array}) {
|
for (${1:Class} *${2:some$1} in ${3:array}) {
|
||||||
${4}
|
${4}
|
||||||
}
|
}
|
||||||
snippet forarray
|
snippet forarray
|
||||||
unsigned int ${1:object}Count = [${2:array} count];
|
unsigned int ${1:object}Count = [${2:array} count];
|
||||||
|
|
||||||
for (unsigned int index = 0; index < $1Count; index++) {
|
for (unsigned int index = 0; index < $1Count; index++) {
|
||||||
${3:id} $1 = [$2 $1AtIndex:index];
|
${3:id} $1 = [$2 $1AtIndex:index];
|
||||||
${4}
|
${4}
|
||||||
@@ -144,20 +147,20 @@ snippet forarray
|
|||||||
# IBOutlet
|
# IBOutlet
|
||||||
# @property (Objective-C 2.0)
|
# @property (Objective-C 2.0)
|
||||||
snippet prop
|
snippet prop
|
||||||
@property (${1:retain}) ${2:NSSomeClass} *${3:$2};${4}
|
@property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4}
|
||||||
# @synthesize (Objective-C 2.0)
|
# @synthesize (Objective-C 2.0)
|
||||||
snippet syn
|
snippet syn
|
||||||
@synthesize ${1:property};${2}
|
@synthesize ${1:property};${2}
|
||||||
# [[ alloc] init]
|
# [[ alloc] init]
|
||||||
snippet alloc
|
snippet alloc
|
||||||
[[${1:foo} alloc] init]${2};${3}
|
[[${1:foo} alloc] init${2}];${3}
|
||||||
# retain
|
# retain
|
||||||
snippet ret
|
snippet ret
|
||||||
[${1:foo} retain];${2}
|
[${1:foo} retain];${2}
|
||||||
# release
|
# release
|
||||||
snippet rel
|
snippet rel
|
||||||
[${1:foo} release];
|
[${1:foo} release];
|
||||||
${2:$1 = nil;}
|
${2:$1 = nil;}
|
||||||
# autorelease
|
# autorelease
|
||||||
snippet arel
|
snippet arel
|
||||||
[${1:foo} autorelease];
|
[${1:foo} autorelease];
|
||||||
@@ -165,7 +168,7 @@ snippet arel
|
|||||||
snippet pool
|
snippet pool
|
||||||
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
|
||||||
${2:/* code */}
|
${2:/* code */}
|
||||||
[$1 release];
|
[$1 drain];
|
||||||
# Throw an exception
|
# Throw an exception
|
||||||
snippet except
|
snippet except
|
||||||
NSException *${1:badness};
|
NSException *${1:badness};
|
||||||
@@ -173,3 +176,9 @@ snippet except
|
|||||||
reason:@"${3}"
|
reason:@"${3}"
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
[$1 raise];
|
[$1 raise];
|
||||||
|
snippet prag
|
||||||
|
#pragma mark ${1:foo}
|
||||||
|
snippet cl
|
||||||
|
@class ${1:Foo};${2}
|
||||||
|
snippet color
|
||||||
|
[[NSColor ${1:blackColor}] set];
|
||||||
|
|||||||
Reference in New Issue
Block a user