adding objc-snippets

This commit is contained in:
capitaomorte
2010-03-14 15:30:22 +00:00
parent c11379e768
commit efa4d6e481
52 changed files with 547 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# key: imp
# contributor: Translated from TextMate Snippet
# name: #import "…"
## condition: "source.objc, source.objc++"
# --
#import "${1:${TM_FILENAME/\...*$/.h/}}"

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# key: Imp
# contributor: Translated from TextMate Snippet
# name: #import <…>
## condition: "source.objc, source.objc++"
# --
#import <${1:Cocoa/Cocoa.h}>

View File

@@ -0,0 +1,20 @@
# -*- mode: snippet -*-
# key: cl
# contributor: Translated from TextMate Snippet
# name: Class
## condition: "source.objc, source.objc++ - meta.scope.implementation.objc"
# --
@interface ${1:${TM_FILENAME/\...*$|(^$)/(?1:object)/}} : ${2:NSObject}
{
}
@end
@implementation $1
- (id)init
{
if((self = [super init]))
{$0
}
return self;
}
@end

View File

@@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# key: m
# contributor: Translated from TextMate Snippet
# name: Method
## binding: "^M"
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# --
- (${1:id})${2:${TM_SELECTED_TEXT:method}}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}}
{$0${1/^(void|IBAction)$|(.*)/(?2:
return nil;)/}
}

View File

@@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# key: sm
# contributor: Translated from TextMate Snippet
# name: Sub-method (Call Super)
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# --
- (${1:id})${2:method}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}}
{
${1/^(void|IBAction)$|(.*)/(?2:$2 res = )/}[super ${2:method}${5/.+/:$0/}];$0${1/^(void|IBAction)$|(.*)/(?2:
return res;)/}
}

View File

@@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# key: cat
# contributor: Translated from TextMate Snippet
# name: Category
## condition: "source.objc, source.objc++"
# --
@interface ${1:${TM_FILENAME/.*?(\w+).*|.*/(?1:$1:NSObject)/}} (${2:${TM_FILENAME/.*?\w+\W+(\w+).*\..+|.*/(?1:$1:Category)/}})
@end
@implementation $1 ($2)
$0
@end

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# key: catm
# contributor: Translated from TextMate Snippet
# name: Category Implementation
## condition: "source.objc, source.objc++"
# --
@implementation ${1:${TM_FILENAME/.*?(\w+).*|.*/(?1:$1:NSObject)/}} (${2:${TM_FILENAME/.*?\w+\W+(\w+).*\..+|.*/(?1:$1:Category)/}})
$0
@end

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# key: cath
# contributor: Translated from TextMate Snippet
# name: Category Interface
## condition: "source.objc, source.objc++"
# --
@interface ${1:${TM_FILENAME/.*?(\w+).*|.*/(?1:$1:NSObject)/}} (${2:${TM_FILENAME/.*?\w+\W+(\w+).*\..+|.*/(?1:$1:Category)/}})
$0
@end

View File

@@ -0,0 +1,15 @@
# -*- mode: snippet -*-
# key: clm
# contributor: Translated from TextMate Snippet
# name: Class Implementation
## condition: "source.objc, source.objc++"
# --
@implementation ${1:${TM_FILENAME/\...*$|(^$)/(?1:object)/}}
- (id)init
{
if((self = [super init]))
{$0
}
return self;
}
@end

View File

@@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# key: clh
# contributor: Translated from TextMate Snippet
# name: Class Interface
## condition: "source.objc, source.objc++"
# --
@interface ${1:${TM_FILENAME/\...*$|(^$)/(?1:object)/}} : ${2:NSObject}
{$3
}
$0
@end

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# key: M
# contributor: Translated from TextMate Snippet
# name: Class Method
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# --
+ (${1:id})${2:method}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}}
{$0${1/^(void|IBAction)$|(.*)/(?2:
return nil;)/}
}

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# key: ibo
# contributor: Translated from TextMate Snippet
# name: IBOutlet
## condition: "source.objc, source.objc++"
# --
IBOutlet ${1:NSSomeClass}${TM_C_POINTER: *}${2:${1/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}};

View File

@@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# key: I
# contributor: Translated from TextMate Snippet
# name: Method: Initialize
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# --
+ (void)initialize
{
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
$0@"value", @"key",
nil]];
}