mirror of
https://github.com/gryf/snipmate.vim.git
synced 2025-12-20 12:58:05 +01:00
added saner default snippets
This commit is contained in:
@@ -5,3 +5,5 @@ snippet c)
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2}
|
||||
snippet date
|
||||
`strftime("%Y-%m-%d")`
|
||||
snippet ddate
|
||||
`strftime("%B %d, %Y")`
|
||||
|
||||
@@ -5,6 +5,12 @@ snippet main
|
||||
${1}
|
||||
return 0;
|
||||
}
|
||||
snippet mainn
|
||||
int main(void)
|
||||
{
|
||||
${1}
|
||||
return 0;
|
||||
}
|
||||
# #include <...>
|
||||
snippet inc
|
||||
#include <${1:stdio}.h>${2}
|
||||
@@ -17,7 +23,7 @@ snippet Def
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif${3}
|
||||
snippet def
|
||||
#define
|
||||
#define
|
||||
snippet ifdef
|
||||
#ifdef ${1:FOO}
|
||||
${2:#define }
|
||||
@@ -27,10 +33,8 @@ snippet #if
|
||||
${2}
|
||||
#endif
|
||||
# Header Include-Guard
|
||||
# (the randomizer code is taken directly from TextMate; it could probably be
|
||||
# cleaner, I don't know how to do it in vim script)
|
||||
snippet once
|
||||
#ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system("/usr/bin/env ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`}
|
||||
#ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`}
|
||||
|
||||
#define $1
|
||||
|
||||
@@ -104,7 +108,6 @@ snippet pr
|
||||
# fprintf (again, this isn't as nice as TextMate's version, but it works)
|
||||
snippet fpr
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${3});${4}
|
||||
# This is kind of convenient
|
||||
snippet .
|
||||
[${1}]${2}
|
||||
snippet un
|
||||
unsigned
|
||||
|
||||
@@ -38,22 +38,26 @@ snippet impl
|
||||
@implementation ${1:`Filename('', 'someClass')`}
|
||||
${2}
|
||||
@end
|
||||
# Protocol
|
||||
snippet pro
|
||||
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${3}
|
||||
@end
|
||||
snippet init
|
||||
- (id)init
|
||||
{
|
||||
[super init];
|
||||
if (self = [super init]) {
|
||||
${1}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
snippet ifself
|
||||
if (self = [super init]) {
|
||||
${1:/* code */}
|
||||
}
|
||||
return self;
|
||||
snippet su
|
||||
[super ${1:init}]${2}
|
||||
snippet ibo
|
||||
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
|
||||
# Category
|
||||
snippet cat
|
||||
@interface ${1:NSObject} (${2:Category})
|
||||
@interface ${1:NSObject} (${2:MyCategory})
|
||||
@end
|
||||
|
||||
@implementation $1 ($2)
|
||||
@@ -61,18 +65,9 @@ snippet cat
|
||||
@end
|
||||
# Category Interface
|
||||
snippet cath
|
||||
@interface ${1:NSObject} (${2:Category})
|
||||
@interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory})
|
||||
${3}
|
||||
@end
|
||||
# NSArray
|
||||
snippet array
|
||||
NSMutableArray *${1:array} = [NSMutable array];${2}
|
||||
# NSDictionary
|
||||
snippet dict
|
||||
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
|
||||
# NSBezierPath
|
||||
snippet bez
|
||||
NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2}
|
||||
# Method
|
||||
snippet m
|
||||
- (${1:id})${2:method}
|
||||
@@ -100,8 +95,8 @@ snippet wake
|
||||
# Class Method
|
||||
snippet M
|
||||
+ (${1:id})${2:method}
|
||||
{${3}
|
||||
return nil;
|
||||
{
|
||||
${3:return nil;}
|
||||
}
|
||||
# Sub-method (Call super)
|
||||
snippet sm
|
||||
@@ -110,14 +105,6 @@ snippet sm
|
||||
[super $2];${3}
|
||||
return self;
|
||||
}
|
||||
# Method: Initialize
|
||||
snippet I
|
||||
+ (void) initialize
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys:
|
||||
${1}@"value", @"key",
|
||||
nil]];
|
||||
}
|
||||
# Accessor Methods For:
|
||||
# Object
|
||||
snippet objacc
|
||||
@@ -160,7 +147,6 @@ snippet ret
|
||||
# release
|
||||
snippet rel
|
||||
[${1:foo} release];
|
||||
${2:$1 = nil;}
|
||||
# autorelease
|
||||
snippet arel
|
||||
[${1:foo} autorelease];
|
||||
@@ -177,7 +163,7 @@ snippet except
|
||||
userInfo:nil];
|
||||
[$1 raise];
|
||||
snippet prag
|
||||
#pragma mark ${1:foo}
|
||||
#pragma mark ${1:-}
|
||||
snippet cl
|
||||
@class ${1:Foo};${2}
|
||||
snippet color
|
||||
|
||||
Reference in New Issue
Block a user