/usr/share/vim/addons/snippets/objc.snippets is in vim-snippets 1.0.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | # #import <...>
snippet Imp
#import <${1:Cocoa/Cocoa.h}>
# #import "..."
snippet imp
#import "${1:`vim_snippets#Filename()`.h}"
# @selector(...)
snippet sel
@selector(${1:method}:)
# @"..." string
snippet s
@"${1}"
# Object
snippet o
${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};
# NSLog(...)
snippet log
NSLog(@"${1:%@}"${2});
# Class
snippet objc
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
{
}
@end
@implementation $1
${0}
@end
# Class Interface
snippet int
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
{${3}
}
${0}
@end
snippet @interface
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
{${3}
}
${0}
@end
# Class Implementation
snippet impl
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
${0}
@end
snippet @implementation
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
${0}
@end
# Protocol
snippet pro
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${0}
@end
snippet @protocol
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${0}
@end
# init Definition
snippet init
- (id)init
{
if (self = [super init]) {
${0}
}
return self;
}
# dealloc Definition
snippet dealloc
- (void) dealloc
{
${0:deallocations}
[super dealloc];
}
snippet su
[super ${1:init}]
snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1};
# Category
snippet cat
@interface ${1:NSObject} (${2:MyCategory})
@end
@implementation $1 ($2)
${0}
@end
# Category Interface
snippet cath
@interface ${1:`vim_snippets#Filename('$1', 'NSObject')`} (${2:MyCategory})
${0}
@end
# Method
snippet m
- (${1:id})${2:method}
{
${0}
}
# Method declaration
snippet md
- (${1:id})${2:method};
# IBAction declaration
snippet ibad
- (IBAction)${1:method}:(${2:id})sender;
# IBAction method
snippet iba
- (IBAction)${1:method}:(${2:id})sender
{
${0}
}
# awakeFromNib method
snippet wake
- (void)awakeFromNib
{
${0}
}
# Class Method
snippet M
+ (${1:id})${2:method}
{
${0:return nil;}
}
# Sub-method (Call super)
snippet sm
- (${1:id})${2:method}
{
[super $2];${0}
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;
}
# for (object in array)
snippet forin
for (${1:Class} *${2:some$1} in ${3:array}) {
${0}
}
snippet fore
for (${1:object} in ${2:array}) {
${0:statements}
}
snippet forarray
unsigned int ${1:object}Count = [${2:array} count];
for (unsigned int index = 0; index < $1Count; index++) {
${3:id} $1 = [$2 $1AtIndex:index];
${0}
}
snippet fora
unsigned int ${1:object}Count = [${2:array} count];
for (unsigned int index = 0; index < $1Count; index++) {
${3:id} $1 = [$2 $1AtIndex:index];
${0}
}
# Try / Catch Block
snippet @try
@try {
${1:statements}
}
@catch (NSException * e) {
${2:handler}
}
@finally {
${0:statements}
}
snippet @catch
@catch (${1:exception}) {
${0:handler}
}
snippet @finally
@finally {
${0:statements}
}
# IBOutlet
# @property (Objective-C 2.0)
snippet prop
@property (${1:retain}) ${2:NSSomeClass} ${3:*$2};
# @synthesize (Objective-C 2.0)
snippet syn
@synthesize ${1:property};
# [[ alloc] init]
snippet alloc
[[${1:foo} alloc] init${2}];
snippet a
[[${1:foo} alloc] init${2}];
# retain
snippet ret
[${1:foo} retain];
# release
snippet rel
[${0:foo} release];
# autorelease
snippet arel
[${0:foo} autorelease];
# autorelease pool
snippet pool
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
${0}
[$1 drain];
# Throw an exception
snippet except
NSException *${1:badness};
$1 = [NSException exceptionWithName:@"${2:$1Name}"
reason:@"${0}"
userInfo:nil];
[$1 raise];
snippet prag
#pragma mark ${0:-}
snippet cl
@class ${1:Foo};
snippet color
[[NSColor ${0:blackColor}] set];
# NSArray
snippet array
NSMutableArray *${1:array} = [NSMutable array];
snippet nsa
NSArray ${0}
snippet nsma
NSMutableArray ${0}
snippet aa
NSArray * array;
snippet ma
NSMutableArray * array;
# NSDictionary
snippet dict
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];
snippet nsd
NSDictionary ${0}
snippet nsmd
NSMutableDictionary ${0}
# NSString
snippet nss
NSString ${0}
snippet nsms
NSMutableString ${0}
|