1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-19 20:38:05 +01:00

added some more objc-c snippets and fixed a typo

This commit is contained in:
Michael Sanders
2009-04-03 22:43:17 -04:00
parent 389759cd31
commit e0bb30b5f0

View File

@@ -7,6 +7,9 @@ snippet Imp
# @selector(...) # @selector(...)
snippet sel snippet sel
@selector(${1:method}:)${3} @selector(${1:method}:)${3}
# @"..." string
snippet s
@"${1}"${2}
# NSLog(...) # NSLog(...)
snippet log snippet log
NSLog(@"${1}"${2});${3} NSLog(@"${1}"${2});${3}
@@ -21,13 +24,29 @@ snippet objc
- (id) init - (id) init
{ {
if (self = [super init]) if (self = [super init])
{${3}
}
return self;
}
@end
# Class Interface # Class Interface
snippet clh snippet clh
@interface ${1:ClassName} : ${2:NSObject} @interface ${1:`Filename('', 'object')`} : ${2:NSObject}
{${3} {${3}
} }
${4} ${4}
@end @end
# Class Implementation
snippet clm
@implementation ${1:`Filename('', 'object')`} : ${2:NSObject}
- (id)init
{
if ((self = [super init]))
{$0
}
return self;
}
@end
snippet ibo snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1}; IBOutlet ${1:NSSomeClass} *${2:$1};
# Category # Category
@@ -61,6 +80,21 @@ snippet m
# Method declaration # Method declaration
snippet md snippet md
- (${1:id})${2:method};${3} - (${1:id})${2:method};${3}
# IBAction declaration
snippet ibad
- (IBAction)${1:method};${2}
# IBAction method
snippet iba
- (IBAction)${1:method}
{
${2}
}
# awakeFromNib method
snippet wake
- (void)awakeFromNib
{
${1}
}
# Class Method # Class Method
snippet M snippet M
+ (${1:id})${2:method} + (${1:id})${2:method}
@@ -96,6 +130,11 @@ snippet objacc
$2 = [aValue retain]; $2 = [aValue retain];
[old$2 release]; [old$2 release];
} }
# for (object in array)
snippet fora
for (${1:Class} *${2:Object} in ${3:array}) {
${4}
}
snippet forarray snippet forarray
unsigned int ${1:object}Count = [${2:array} count]; unsigned int ${1:object}Count = [${2:array} count];
@@ -119,4 +158,8 @@ snippet ret
[${1:foo} retain];${2} [${1:foo} retain];${2}
# release # release
snippet rel snippet rel
[${1:foo} release];${2} [${1:foo} release];
${2:$1 = nil;}
# autorelease
snippet arel
[${1:foo} autorelease];