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

added some snippets like editor in Xcode

based on Apple's document Xcode Workspace Guide
(http://developer.apple.com/mac/library/DOCUMENTATION/DeveloperTools/Conceptual/XcodeWorkspace/100-The_Text_Editor/text_editor.html#//apple_ref/doc/uid/TP40002679-SW35)

Signed-off-by: Michael Sanders <msanders42@gmail.com>
This commit is contained in:
marutanm
2010-03-23 00:08:49 +09:00
committed by Michael Sanders
parent 80f50e9e4b
commit 9394f8fea9

View File

@@ -33,16 +33,31 @@ snippet int
}
${4}
@end
snippet @interface
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
{${3}
}
${4}
@end
# Class Implementation
snippet impl
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
snippet @implementation
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
# Protocol
snippet pro
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
snippet @protocol
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
# init Definition
snippet init
- (id)init
{
@@ -51,6 +66,13 @@ snippet init
}
return self;
}
# dealloc Definition
snippet dealloc
- (void) dealloc
{
${1:deallocations}
[super dealloc];
}
snippet su
[super ${1:init}]${2}
snippet ibo
@@ -124,6 +146,10 @@ snippet forin
for (${1:Class} *${2:some$1} in ${3:array}) {
${4}
}
snippet fore
for (${1:object} in ${2:array}) {
${3:statements}
}
snippet forarray
unsigned int ${1:object}Count = [${2:array} count];
@@ -131,6 +157,32 @@ snippet forarray
${3:id} $1 = [$2 $1AtIndex:index];
${4}
}
snippet fora
unsigned int ${1:object}Count = [${2:array} count];
for (unsigned int index = 0; index < $1Count; index++) {
${3:id} $1 = [$2 $1AtIndex:index];
${4}
}
# Try / Catch Block
snippet @try
@try {
${1:statements}
}
@catch (NSException * e) {
${2:handler}
}
@finally {
${3:statements}
}
snippet @catch
@catch (${1:exception}) {
${2:handler}
}
snippet @finally
@finally {
${1:statements}
}
# IBOutlet
# @property (Objective-C 2.0)
snippet prop
@@ -141,6 +193,8 @@ snippet syn
# [[ alloc] init]
snippet alloc
[[${1:foo} alloc] init${2}];${3}
snippet a
[[${1:foo} alloc] init${2}];${3}
# retain
snippet ret
[${1:foo} retain];${2}
@@ -168,3 +222,26 @@ snippet cl
@class ${1:Foo};${2}
snippet color
[[NSColor ${1:blackColor}] set];
# NSArray
snippet array
NSMutableArray *${1:array} = [NSMutable array];${2}
snippet nsa
NSArray ${1}
snippet nsma
NSMutableArray ${1}
snippet aa
NSArray * array;${1}
snippet ma
NSMutableArray * array;${1}
# NSDictionary
snippet dict
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
snippet nsd
NSDictionary ${1}
snippet nsmd
NSMutableDictionary ${1}
# NSString
snippet nss
NSString ${1}
snippet nsms
NSMutableString ${1}