summaryrefslogtreecommitdiffstats
path: root/vim/snippets
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-03-16 13:10:35 -0500
committerJesse Luehrs <doy@tozt.net>2010-03-16 13:10:35 -0500
commite64c9e5b1db135eeb850a7e459f0785f0da40e4f (patch)
treedbe4ef0ad38d72e837308c0dfedde3ddf1d3739c /vim/snippets
parent6644cf44f25dfba0c7a23a06e681dba856bbd4d6 (diff)
downloadconf-e64c9e5b1db135eeb850a7e459f0785f0da40e4f.tar.gz
conf-e64c9e5b1db135eeb850a7e459f0785f0da40e4f.zip
update snipmate
Diffstat (limited to 'vim/snippets')
-rw-r--r--vim/snippets/c.snippets24
-rw-r--r--vim/snippets/cpp.snippets4
-rw-r--r--vim/snippets/html.snippets2
-rw-r--r--vim/snippets/java.snippets16
-rw-r--r--vim/snippets/objc.snippets47
-rw-r--r--vim/snippets/perl.snippets20
-rw-r--r--vim/snippets/php.snippets4
-rw-r--r--vim/snippets/python.snippets11
-rw-r--r--vim/snippets/sh.snippets2
-rw-r--r--vim/snippets/vim.snippets2
10 files changed, 88 insertions, 44 deletions
diff --git a/vim/snippets/c.snippets b/vim/snippets/c.snippets
index dd16668..8824329 100644
--- a/vim/snippets/c.snippets
+++ b/vim/snippets/c.snippets
@@ -18,6 +18,14 @@ snippet Def
#endif${3}
snippet def
#define
+snippet ifdef
+ #ifdef ${1:FOO}
+ ${2:#define }
+ #endif
+snippet #if
+ #if ${1:FOO}
+ ${2}
+ #endif
# Header Include-Guard
snippet once
#ifndef ${1:`toupper(Filename('', 'UNTITLED').'_H')`}
@@ -64,9 +72,12 @@ snippet fun
{
${4:/* code */}
}
+# Function Declaration
+snippet fund
+ ${1:void} ${2:function_name}(${3});${4}
# Typedef
snippet td
- typedef ${1:int} ${2:MyCustomType};
+ typedef ${1:int} ${2:MyCustomType};${3}
# Struct
snippet st
struct ${1:`Filename('$1_t', 'name')`} {
@@ -74,9 +85,14 @@ snippet st
}${3: /* optional variable list */};${4}
# Typedef struct
snippet tds
- typedef struct ${2:$1 }{
+ typedef struct ${2:_$1 }{
${3:/* data */}
} ${1:`Filename('$1_t', 'name')`};
+# Typdef enum
+snippet tde
+ typedef enum {
+ ${1:/* data */}
+ } ${2:foo};
# printf
# unfortunately version this isn't as nice as TextMates's, given the lack of a
# dynamic `...`
@@ -85,3 +101,7 @@ 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}
+snippet .
+ [${1}]${2}
+snippet un
+ unsigned
diff --git a/vim/snippets/cpp.snippets b/vim/snippets/cpp.snippets
index 4a3b7c7..65fe5e1 100644
--- a/vim/snippets/cpp.snippets
+++ b/vim/snippets/cpp.snippets
@@ -24,7 +24,7 @@ snippet cl
public:
$1(${2:arguments});
virtual ~$1();
-
+
private:
${3:/* data */}
};
@@ -33,5 +33,5 @@ snippet forv
for (std::vector<${1:int}>::const_iterator ${2:it} = ${3:vec}.begin();
$2 != $3.end();
++$2) {
- ${4:/* code */}
+ ${4:/* code */}
}
diff --git a/vim/snippets/html.snippets b/vim/snippets/html.snippets
index 5abc731..aefb9db 100644
--- a/vim/snippets/html.snippets
+++ b/vim/snippets/html.snippets
@@ -115,7 +115,7 @@ snippet head
${2}
</head>
snippet title
- <title>${1:`substitute(Filename("", "Page Title"), "^.", "\u&", "")`}</title>${2}
+ <title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>${2}
snippet script
<script type="text/javascript" charset="utf-8">
${1}
diff --git a/vim/snippets/java.snippets b/vim/snippets/java.snippets
index 4fb84b7..fd705cb 100644
--- a/vim/snippets/java.snippets
+++ b/vim/snippets/java.snippets
@@ -4,21 +4,21 @@ snippet main
${1:/* code */}
}
snippet pu
- public
+ public
snippet po
- protected
+ protected
snippet pr
- private
+ private
snippet st
- static
+ static
snippet fi
- final
+ final
snippet ab
- abstract
+ abstract
snippet re
- return
+ return
snippet br
- break;
+ break;
snippet de
default:
${1}
diff --git a/vim/snippets/objc.snippets b/vim/snippets/objc.snippets
index 7c2cd6a..4749bb7 100644
--- a/vim/snippets/objc.snippets
+++ b/vim/snippets/objc.snippets
@@ -1,8 +1,8 @@
# #import <...>
-snippet imp
+snippet Imp
#import <${1:Cocoa/Cocoa.h}>${2}
# #import "..."
-snippet Imp
+snippet imp
#import "${1:`Filename()`.h}"${2}
# @selector(...)
snippet sel
@@ -12,10 +12,10 @@ snippet s
@"${1}"${2}
# Object
snippet o
- ${1:NSObject} *${2:foo} = [${3:$1 alloc}];${5}
+ ${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5}
# NSLog(...)
snippet log
- NSLog(@"${1}"${2});${3}
+ NSLog(@"${1:%@}"${2});${3}
# Class
snippet objc
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
@@ -28,10 +28,10 @@ snippet objc
@end
# Class Interface
snippet int
- @interface ${1:`Filename('', 'someClass')`}
- {${2}
+ @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
+ {${3}
}
- ${3}
+ ${4}
@end
# Class Implementation
snippet impl
@@ -41,11 +41,14 @@ snippet impl
snippet init
- (id)init
{
- if ((self = [super init]))
- {${1}
- }
+ [super init];
return self;
}
+snippet ifself
+ if (self = [super init]) {
+ ${1:/* code */}
+ }
+ return self;
snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
# Category
@@ -74,19 +77,19 @@ snippet bez
snippet m
- (${1:id})${2:method}
{
- ${3:return self;}
+ ${3}
}
# Method declaration
snippet md
- (${1:id})${2:method};${3}
# IBAction declaration
snippet ibad
- - (IBAction)${1:method};${2}
+ - (IBAction)${1:method}:(${2:id})sender;${3}
# IBAction method
snippet iba
- - (IBAction)${1:method}
+ - (IBAction)${1:method}:(${2:id})sender
{
- ${2}
+ ${3}
}
# awakeFromNib method
snippet wake
@@ -130,8 +133,8 @@ snippet objacc
$2 = $3;
}${4}
# for (object in array)
-snippet fora
- for (${1:Class} *${2:Object} in ${3:array}) {
+snippet forin
+ for (${1:Class} *${2:some$1} in ${3:array}) {
${4}
}
snippet forarray
@@ -144,13 +147,13 @@ snippet forarray
# IBOutlet
# @property (Objective-C 2.0)
snippet prop
- @property (${1:retain}) ${2:NSSomeClass} *${3:$2};${4}
+ @property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4}
# @synthesize (Objective-C 2.0)
snippet syn
@synthesize ${1:property};${2}
# [[ alloc] init]
snippet alloc
- [[${1:foo} alloc] init]${2};${3}
+ [[${1:foo} alloc] init${2}];${3}
# retain
snippet ret
[${1:foo} retain];${2}
@@ -165,7 +168,7 @@ snippet arel
snippet pool
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
${2:/* code */}
- [$1 release];
+ [$1 drain];
# Throw an exception
snippet except
NSException *${1:badness};
@@ -173,3 +176,9 @@ snippet except
reason:@"${3}"
userInfo:nil];
[$1 raise];
+snippet prag
+ #pragma mark ${1:foo}
+snippet cl
+ @class ${1:Foo};${2}
+snippet color
+ [[NSColor ${1:blackColor}] set];
diff --git a/vim/snippets/perl.snippets b/vim/snippets/perl.snippets
index f123666..01f6a0e 100644
--- a/vim/snippets/perl.snippets
+++ b/vim/snippets/perl.snippets
@@ -2,21 +2,31 @@
snippet #!
#!/usr/bin/env perl
+# Hash Pointer
+snippet .
+ =>
snippet sub
sub ${1:foo} {
${2}
}
snippet if
- if (${1:cond}) {
- ${2}
+ if (${1}) {
+ ${2:# body...}
+ }
+snippet ife
+ if (${1}) {
+ ${2:# body...}
+ }
+ else {
+ ${3:# else...}
}
snippet elsif
- elsif (${1:cond}) {
- ${2}
+ elsif (${1:}) {
+ ${2:# else...}
}
snippet else
else {
- ${1}
+ ${1:# else...}
}
snippet for
for my $${1:var} (${2:1..10}) {
diff --git a/vim/snippets/php.snippets b/vim/snippets/php.snippets
index 46420da..3ce9e26 100644
--- a/vim/snippets/php.snippets
+++ b/vim/snippets/php.snippets
@@ -3,7 +3,7 @@ snippet php
${1}
?>
snippet ec
- echo "${1:string}";${2}
+ echo "${1:string}"${2};
snippet inc
include '${1:file}';${2}
snippet inc1
@@ -119,7 +119,7 @@ snippet doc_h
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${5:default}
**/
-
+
/**
* Define DocBlock
*//
diff --git a/vim/snippets/python.snippets b/vim/snippets/python.snippets
index 70e0e16..d511184 100644
--- a/vim/snippets/python.snippets
+++ b/vim/snippets/python.snippets
@@ -1,6 +1,8 @@
snippet #!
#!/usr/bin/python
+snippet imp
+ import ${1:module}
# Module Docstring
snippet docs
'''
@@ -27,9 +29,12 @@ snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${4:pass}
+snippet deff
+ def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
+ ${3}
# New Method
snippet defs
- def ${1:mname}(self, ${2:arg})):
+ def ${1:mname}(self, ${2:arg}):
${3:pass}
# New Property
snippet property
@@ -39,7 +44,9 @@ snippet property
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
-
+# Lambda
+snippet ld
+ ${1:var} = lambda ${2:vars} : ${3:action}
snippet .
self.
snippet try Try/Except
diff --git a/vim/snippets/sh.snippets b/vim/snippets/sh.snippets
index 8e3851b..f035126 100644
--- a/vim/snippets/sh.snippets
+++ b/vim/snippets/sh.snippets
@@ -1,7 +1,7 @@
# #!/bin/bash
snippet #!
#!/bin/bash
-
+
snippet if
if [[ ${1:condition} ]]; then
${2:#statements}
diff --git a/vim/snippets/vim.snippets b/vim/snippets/vim.snippets
index 0bb03af..64e7807 100644
--- a/vim/snippets/vim.snippets
+++ b/vim/snippets/vim.snippets
@@ -3,8 +3,6 @@ snippet header
" Author: ${2:`g:snips_author`}
" Description: ${3}
${4:" Last Modified: `strftime("%B %d, %Y")`}
-snippet lm
- " Last Modified: `strftime("%B %d, %Y")`
snippet guard
if exists('${1:did_`Filename()`}') || &cp${2: || version < 700}
finish