Skip to content

Commit

Permalink
Version 0.42: Initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Sanders authored and vim-scripts committed Nov 16, 2010
0 parents commit 91c475a
Show file tree
Hide file tree
Showing 15 changed files with 1,329 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README
@@ -0,0 +1,28 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2540

snipMate.vim aims to be an unobtrusive, concise vim script that implements some of TextMate's snippets features in Vim. A snippet is a piece of often-typed text that you can insert into your document using a trigger word followed by a <tab>.

For instance, in a C file using the default installation of snipMate.vim, if you type "for<tab>" in insert mode, it will expand a typical for loop in C:

for (i = 0; i < count; i++) {

}

To go to the next item in the loop, simply <tab> over to it; if there is repeated code, such as the "i" variable in this example, you can simply start typing once it's highlighted and all the matches specified in the snippet will be updated.

Requires Vim 7 or higher.
For a quick introduction, see this screencast: http://vimeo.com/3535418
For more help see the documentation that comes with snipMate in ~/.vim/doc/snipMate.txt.

snipMate.vim has the following features among others:
- The syntax of snippets is very similar to TextMate's, allowing easy conversion.
- The position of the snippet is kept transparently (i.e., it does not use marks/placeholders inserted into the buffer), allowing you to escape out of an incomplete snippet, something particularly useful in Vim.
- Variables in snippets are updated as-you-type.
- Snippets can have multiple matches.
- Snippets can be out of order. For instance, in a do...while loop, the condition can be added before the code.

Bug reports, feature requests, etc. are welcome and can be emailed to me or submitted on the issue tracker: http://code.google.com/p/snipmate/issues/list

If you would like to watch the development of this plugin, you can also follow it on github: http://github.com/msanders/snipmate.vim

Enjoy!
55 changes: 55 additions & 0 deletions after/ftplugin/c_snips.vim
@@ -0,0 +1,55 @@
if !exists('g:loaded_snips')
fini
en

" main()
exe "Snip main int main (int argc, char const* argv[])\n{\n\t${1}\n\treturn 0;\n}"
" #include <...>
exe 'Snip inc #include <${1:stdio}.h>${2}'
" #include "..."
exe 'Snip Inc #include "${1:`Filename("$1.h")`}"${2}'
" #ifndef ... #define ... #endif
exe "Snip def #ifndef $1\n#define ${1:SYMBOL} ${2:value}\n#endif${3}"
" Header Include-Guard
" (the randomizer code is taken directly from TextMate; I don't know how to do
" it in vim script, it could probably be cleaner)
exe "Snip once #ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system(\"/usr/bin/ruby -e 'print (rand * 2821109907455).round.to_s(36)'\"))`}\n"
\ ."#define $1\n\n${2}\n\n#endif /* end of include guard: $1 */"
" Read File Into Vector
exe "Snip readfile std::vector<char> v;\nif (FILE *${2:fp} = fopen(${1:\"filename\"}, \"r\")) {\n\tchar buf[1024];\n\twhile (size_t len = "
\ ."fread(buf, 1, sizeof(buf), $2))\n\t\tv.insert(v.end(), buf, buf + len);\n\tfclose($2);\n}${3}"
" If Condition
exe "Snip if if (${1:/* condition */}) {\n\t${2:/* code */}\n}"
exe "Snip el else {\n\t${1}\n}"
" Tertiary conditional
exe 'Snip t ${1:/* condition */} ? ${2:a} : ${3:b}'
" Do While Loop
exe "Snip do do {\n\t${2:/* code */}\n} while (${1:/* condition */});"
" While Loop
exe "Snip wh while (${1:/* condition */}) {\n\t${2:/* code */}\n}"
" For Loop
exe "Snip for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {\n\t${4:/* code */}\n}"
" Custom For Loop
exe "Snip forr for (${1:i} = 0; ${2:$1 < 5}; $1${3:++}) {\n\t${4:/* code */}\n}"
" Function
exe "Snip fun ${1:void} ${2:function_name} (${3})\n{\n\t${4:/* code */}\n}"
" Typedef
exe 'Snip td typedef ${1:int} ${2:MyCustomType};'
" Struct
exe "Snip st struct ${1:`Filename('$1_t', 'name')`} {\n\t${2:/* data */}\n}${3: /* optional variable list */};${4}"
" Typedef struct
exe "Snip tds typedef struct {\n\t${2:/* data */}\n} ${1:`Filename('$1_t', 'name')`};"
" Class
exe "Snip cl class ${1:`Filename('$1_t', 'name')`} {\npublic:\n\t$1 (${2:arguments});\n\tvirtual ~$1 ();\n\nprivate:\n\t${3:/* data */}\n};"
" Namespace
exe "Snip ns namespace ${1:`Filename('', 'my')`} {\n\t${2}\n} /* $1 */"
" std::map
exe "Snip map std::map<${1:key}, ${2:value}> map${3};"
" std::vector
exe "Snip vector std::vector<${1:char}> v${2};"
" printf
" unfortunately version this isn't as nice as TextMates's, given the lack of a
" dynamic `...`
exe 'Snip pr printf("${1:%s}\n"${2});${3}'
" fprintf (again, this isn't as nice as TextMate's version, but it works)
exe 'Snip fpr fprintf(${1:stderr}, "${2:%s}\n"${3});${4}'
87 changes: 87 additions & 0 deletions after/ftplugin/html_snips.vim
@@ -0,0 +1,87 @@
if !exists('g:loaded_snips')
fini
en
let c = &ft == 'xhtml' ? ' /' : ''

" Some useful Unicode entities
" Non-Breaking Space
exe 'Snip nbs &nbsp;'
"
exe 'Snip left &#x2190;'
"
exe 'Snip right &#x2192;'
"
exe 'Snip up &#x2191;'
"
exe 'Snip down &#x2193;'
"
exe 'Snip return &#x21A9;'
"
exe 'Snip backtab &#x21E4;'
"
exe 'Snip tab &#x21E5;'
"
exe 'Snip shift &#x21E7;'
"
exe 'Snip control &#x2303;'
"
exe 'Snip enter &#x2305;'
"
exe 'Snip command &#x2318;'
"
exe 'Snip option &#x2325;'
"
exe 'Snip delete &#x2326;'
"
exe 'Snip backspace &#x232B;'
"
exe 'Snip escape &#x238B;'
" Generic Doctype
exe 'Snip! doctype "HTML 4.01 Strict" <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"\n\"http://www.w3.org/TR/html4/strict.dtd\">'
exe 'Snip! doctype "HTML 4.01 Transitional" <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\"\n\"http://www.w3.org/TR/html4/loose.dtd\">'
exe 'Snip! doctype "XHTML 1.0 Frameset" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">'
exe 'Snip! doctype "XHTML 1.0 Strict" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">'
exe 'Snip! doctype "XHTML 1.0 Transitional" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">'
exe 'Snip! doctype "XHTML 1.1" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">'
" HTML Doctype 4.01 Strict
exe "Snip docts <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"\n\"http://www.w3.org/TR/html4/strict.dtd\">"
" HTML Doctype 4.01 Transitional
exe "Snip doct <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\"\n\"http://www.w3.org/TR/html4/loose.dtd\">"
" XHTML Doctype 1.0 Frameset
exe "Snip docxf <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
" XHTML Doctype 1.0 Strict
exe "Snip docxs <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
" XHTML Doctype 1.0 Transitional
exe "Snip docxt <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
" XHTML Doctype 1.1
exe "Snip docx <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">"
exe "Snip xhtml <html xmlns=\"http://www.w3.org/1999/xhtml\">\n${1}\n</html>"
exe "Snip body <body>\n\t${1}\n</body>"
exe "Snip head <head>\n\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"".c.">\n\t"
\. "<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')`}</title>\n\t${2}\n</head>"
exe 'Snip title <title>${1:`substitute(Filename("", "Page Title"), "^.", "\\u&", "")`}</title>${2}'
exe "Snip script <script type=\"text/javascript\" charset=\"utf-8\">\n\t${1}\n</script>${2}"
exe "Snip scriptsrc <script src=\"${1}.js\" type=\"text/javascript\" charset=\"utf-8\"></script>${2}"
exe "Snip style <style type=\"text/css\" media=\"${1:screen}\">\n\t${2}\n</style>${3}"
exe 'Snip base <base href="${1}" target="${2}"'.c.'>'
exe 'Snip r <br'.c[1:].'>'
exe "Snip div <div id=\"${1:name}\">\n\t${2}\n</div>"
" Embed QT Movie
exe "Snip movie <object width=\"$2\" height=\"$3\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\""
\ ." codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">\n\t<param name=\"src\" value=\"$1\"".c.">\n\t<param name=\"controller\" value=\"$4\"".c
\ .">\n\t<param name=\"autoplay\" value=\"$5\"".c.">\n\t<embed src=\"${1:movie.mov}\"\n\t\twidth=\"${2:320}\" height=\"${3:240}\"\n\t\t"
\ ."controller=\"${4:true}\" autoplay=\"${5:true}\"\n\t\tscale=\"tofit\" cache=\"true\"\n\t\tpluginspage=\"http://www.apple.com/quicktime/download/\"\n\t".c[1:].">\n</object>${6}"
exe "Snip fieldset <fieldset id=\"$1\">\n\t<legend>${1:name}</legend>\n\n\t${3}\n</fieldset>"
exe "Snip form <form action=\"${1:`Filename('$1_submit')`}\" method=\"${2:get}\" accept-charset=\"utf-8\">\n\t${3}\n\n\t"
\."<p><input type=\"submit\" value=\"Continue &rarr;\"".c."></p>\n</form>"
exe 'Snip h1 <h1 id="${1:heading}">${2:$1}</h1>'
exe 'Snip input <input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="${3}"'.c.'>${4}'
exe 'Snip label <label for="${2:$1}">${1:name}</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="${5}" id="${6:$2}"'.c.'>${7}'
exe 'Snip link <link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" charset="utf-8"'.c.'>${4}'
exe 'Snip mailto <a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>'
exe 'Snip meta <meta name="${1:name}" content="${2:content}"'.c.'>${3}'
exe 'Snip opt <option value="${1:option}">${2:$1}</option>${3}'
exe 'Snip optt <option>${1:option}</option>${2}'
exe "Snip select <select name=\"${1:some_name}\" id=\"${2:$1}\">\n\t<option value=\"${3:option}\">${4:$3}</option>\n</select>${5}"
exe "Snip table <table border=\"${1:0}\">\n\t<tr><th>${2:Header}</th></tr>\n\t<tr><th>${3:Data}</th></tr>\n</table>${4}"
exe 'Snip textarea <textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">${4}</textarea>${5}'
40 changes: 40 additions & 0 deletions after/ftplugin/java_snips.vim
@@ -0,0 +1,40 @@
if !exists('loaded_snips')
fini
en

exe "Snip main public static void main (String [] args)\n{\n\t${1:/* code */}\n}"
exe 'Snip pu public'
exe 'Snip po protected'
exe 'Snip pr private'
exe 'Snip st static'
exe 'Snip fi final'
exe 'Snip ab abstract'
exe 'Snip re return'
exe 'Snip br break;'
exe "Snip de default:\n\t${1}"
exe 'Snip ca catch(${1:Exception} ${2:e}) ${3}'
exe 'Snip th throw '
exe 'Snip sy synchronized'
exe 'Snip im import'
exe 'Snip j.u java.util'
exe 'Snip j.i java.io.'
exe 'Snip j.b java.beans.'
exe 'Snip j.n java.net.'
exe 'Snip j.m java.math.'
exe 'Snip if if (${1}) ${2}'
exe 'Snip el else '
exe 'Snip elif else if (${1}) ${2}'
exe 'Snip wh while (${1}) ${2}'
exe 'Snip for for (${1}; ${2}; ${3}) ${4}'
exe 'Snip fore for (${1} : ${2}) ${3}'
exe 'Snip sw switch (${1}) ${2}'
exe "Snip cs case ${1}:\n\t${2}\n${3}"
exe 'Snip tc public class ${1:`Filename()`} extends ${2:TestCase}'
exe 'Snip t public void test${1:Name}() throws Exception ${2}'
exe 'Snip cl class ${1:`Filename("", "untitled")`} ${2}'
exe 'Snip in interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3}'
exe 'Snip m ${1:void} ${2:method}(${3}) ${4:throws }${5}'
exe 'Snip v ${1:String} ${2:var}${3: = null}${4};${5}'
exe 'Snip co static public final ${1:String} ${2:var} = ${3};${4}'
exe 'Snip cos static public final String ${1:var} = "${2}";${3}'
exe 'Snip as assert ${1:test} : "${2:Failure message}";${3}'
36 changes: 36 additions & 0 deletions after/ftplugin/javascript_snips.vim
@@ -0,0 +1,36 @@
if !exists('loaded_snips')
fini
en

" Prototype
exe "Snip proto ${1:class_name}.prototype.${2:method_name} =\nfunction(${3:first_argument}) {\n\t${4:// body...}\n};"
" Function
exe "Snip fun function ${1:function_name} (${2:argument}) {\n\t${3:// body...}\n}"
" Anonymous Function
exe 'Snip f function(${1}) {${2}};'
" if
exe 'Snip if if (${1:true}) {${2}};'
" if ... else
exe "Snip ife if (${1:true}) {${2}}\nelse{${3}};"
" tertiary conditional
exe 'Snip t ${1:/* condition */} ? ${2:a} : ${3:b}'
" switch
exe "Snip switch switch(${1:expression}) {\n\tcase '${3:case}':\n\t\t${4:// code}\n\t\tbreak;\n\t${5}\n\tdefault:\n\t\t${2:// code}\n}"
" case
exe "Snip case case '${1:case}':\n\t${2:// code}\n\tbreak;\n${3}"
" for (...) {...}
exe "Snip for for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) {\n\t${4:$1[$2]}\n};"
" for (...) {...} (Improved Native For-Loop)
exe "Snip forr for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3:--}) {\n\t${4:$1[$2]}\n};"
" while (...) {...}
exe "Snip wh while (${1:/* condition */}) {\n\t${2:/* code */}\n}"
" do...while
exe "Snip do do {\n\t${2:/* code */}\n} while (${1:/* condition */});"
" Object Method
exe "Snip :f ${1:method_name}: function(${2:attribute}) {\n\t${4}\n}${3:,}"
" setTimeout function
exe 'Snip timeout setTimeout(function() {${3}}${2}, ${1:10};'
" Get Elements
exe "Snip get getElementsBy${1:TagName}('${2}')${3}"
" Get Element
exe "Snip gett getElementBy${1:Id}('${2}')${3}"
39 changes: 39 additions & 0 deletions after/ftplugin/objc_snips.vim
@@ -0,0 +1,39 @@
if !exists('g:loaded_snips')
fini
en

" #import <...>
exe 'Snip imp #import <${1:Cocoa/Cocoa.h}>${2}'
" #import "..."
exe 'Snip Imp #import "${1:`Filename()`.h}"${2}'
" @selector(...)
exe 'Snip sel @selector(${1:method}:)${3}'
" NSLog(...)
exe 'Snip log NSLog(@"${1}"${2});${3}'
" Class
exe "Snip objc @interface ${1:`Filename('', 'object')`} : ${2:NSObject}\n{\n}\n@end\n\n@implementation $1\n- (id) init\n{\n\tif (self = [super init])"
\."\n\t{${3}\n\t}\n\treturn self\n}\n@end"
" Class Interface
exe "Snip cli @interface ${1:ClassName} : ${2:NSObject}\n{${3}\n}\n${4}\n@end"
" Category
exe "Snip cat @interface ${1:NSObject} (${2:Category})\n@end\n\n@implementation $1 ($2)\n${3}\n@end"
" Category Interface
exe "Snip cati @interface ${1:NSObject} (${2:Category})\n${3}\n@end"
" NSArray
exe 'Snip array NSMutableArray *${1:array} = [NSMutable array];${2}'
" NSDictionary
exe 'Snip dict NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}'
" NSBezierPath
exe 'Snip bez NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2}'
" Class Method
exe "Snip M + (${1:id}) ${2:method}\n{${3}\n\treturn nil;\n}"
" Sub-method (Call super)
exe "Snip sm - (${1:id}) ${2:method}:(${3:id})${4:anArgument}\n{\n\t$1 res = [super $2:$4];${5}\n\treturn res;\n}"
" Method: Initialize
exe "Snip I + (void) initialize\n{\n\t[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys:\n\t\t${1}@\"value\", @\"key\",\n\t\tnil]];\n}"
" Accessor Methods For:
" Object
exe "Snip objacc - (${1:id})${2:thing}\n{\n\treturn $2;\n}\n\n- (void) set$2:($1)\n{\n\t$1 old$2 = $2;\n\t$2 = [aValue retain];\n\t[old$2 release];\n}"
exe "Snip forarray unsigned int\t${1:object}Count = [${2:array} count];\n\nfor (unsigned int index = 0; index < $1Count; index++)\n{\n\t${3:id}\t$1 = [$2 $1AtIndex:index];\n\t${4}\n}"
" [[ alloc] init]
exe 'Snip alloc [[${1:foo} alloc] init]${2};${3}'
36 changes: 36 additions & 0 deletions after/ftplugin/perl_snips.vim
@@ -0,0 +1,36 @@
if !exists('g:loaded_snips')
fini
en

" Hash Pointer
exe 'Snip . =>'
" Function
exe "Snip sub sub ${1:function_name} {\n\t${2:#body ...}\n}"
" Conditional
exe "Snip if if (${1}) {\n\t${2:# body...}\n}"
" Conditional if..else
exe "Snip ife if $(${1}) {\n\t${2:# body...}\n} else {\n\t${3:# else...}\n}"
" Conditional if..elsif..else
exe "Snip ifee if (${1}) {\n\t${2:# body...}\n} elsif (${3}) {\n\t${4:# elsif...}\n} else {\n\t${5:# else...}\n}"
" Conditional One-line
exe 'Snip xif ${1:expression} if ${2:condition};${3}'
" Unless conditional
exe "Snip unless unless (${1}) {\n\t${2:# body...}\n}"
" Unless conditional One-line
exe 'Snip xunless ${1:expression} unless ${2:condition};${3}'
" Try/Except
exe "Snip eval eval {\n\t${1:# do something risky...}\n};\nif ($@) {\n\t${2:# handle failure...}\n}"
" While Loop
exe "Snip wh while (${1}) {\n\t${2:# body...}\n}"
" While Loop One-line
exe "Snip xwh ${1:expression} while ${2:condition};${3}"
" For Loop
exe "Snip for for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {\n\t${4:# body...}\n}"
" Foreach Loop
exe "Snip fore foreach my $${1:x} (@${2:array}) {\n\t${3:# body...}\n}"
" Foreach Loop One-line
exe 'Snip xfore ${1:expression} foreach @${2:array};${3}'
" Package
exe "Snip cl package ${1:ClassName};\n\nuse base qw(${2:ParentClass});\n\nsub new {\n\tmy $class = shift;\n\t$class = ref $class if ref $class;\n\tmy $self = bless {}, $class;\n\t$self;\n}\n\n1;${3}"
" Read File
exe "Snip slurp my $${1:var};\n{ local $/ = undef; local *FILE; open FILE, \"<${2:file}\"; $$1 = <FILE>; close FILE }${2}"
66 changes: 66 additions & 0 deletions after/ftplugin/php_snips.vim
@@ -0,0 +1,66 @@
if !exists('loaded_snips')
fini
en

exe "Snip php <?php\n${1}\n?>"
exe 'Snip ec echo "${1:string}"${2};'
exe "Snip inc include '${1:file}';${2}"
exe "Snip inc1 include_once '${1:file}';${2}"
exe "Snip req require '${1:file}';${2}"
exe "Snip req1 require_once '${1:file}';${2}"
" $GLOBALS['...']
exe "Snip globals $GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}"
exe "Snip! $_ \"COOKIE['...']\" $_COOKIE['${1:variable}']${2}"
exe "Snip! $_ \"ENV['...']\" $_ENV['${1:variable}']${2}"
exe "Snip! $_ \"FILES['...']\" $_FILES['${1:variable}']${2}"
exe "Snip! $_ \"Get['...']\" $_GET['${1:variable}']${2}"
exe "Snip! $_ \"POST['...']\" $_POST['${1:variable}']${2}"
exe "Snip! $_ \"REQUEST['...']\" $_REQUEST['${1:variable}']${2}"
exe "Snip! $_ \"SERVER['...']\" $_SERVER['${1:variable}']${2}"
exe "Snip! $_ \"SESSION['...']\" $_SESSION['${1:variable}']${2}"
" Start Docblock
exe "Snip /* /**\n * ${1}\n **/"
" Class - post doc
exe "Snip doc_cp /**\n * ${1:undocumented class}\n *\n * @package ${2:default}\n * @author ${3:`g:snips_author`}\n**/${4}"
" Class Variable - post doc
exe "Snip doc_vp /**\n * ${1:undocumented class variable}\n *\n * @var ${2:string}\n **/${3}"
" Class Variable
exe "Snip doc_v /**\n * ${3:undocumented class variable}\n *\n * @var ${4:string}\n **/\n${1:var} $${2};${5}"
" Class
exe "Snip doc_c /**\n * ${3:undocumented class}\n *\n * @packaged ${4:default}\n * @author ${5:`g:snips_author`}\n **/\n${1:}class ${2:}\n{${6}\n} // END $1class $2"
" Constant Definition - post doc
exe "Snip doc_dp /**\n * ${1:undocumented constant}\n **/${2}"
" Constant Definition
exe "Snip doc_d /**\n * ${3:undocumented constant}\n **/\ndefine(${1}, ${2});${4}"
" Function - post doc
exe "Snip doc_fp /**\n * ${1:undocumented function}\n *\n * @return ${2:void}\n * @author ${3:`g:snips_author`}\n **/${4}"
" Function signature
exe "Snip doc_s /**\n * ${4:undocumented function}\n *\n * @return ${5:void}\n * @author ${6:`g:snips_author`}\n **/\n${1}function ${2}(${3});${7}"
" Function
exe "Snip doc_f /**\n * ${4:undocumented function}\n *\n * @return ${5:void}\n * @author ${6:`g:snips_author`}\n **/\n${1}function ${2}(${3})\n{${7}\n}"
" Header
exe "Snip doc_h /**\n * ${1}\n *\n * @author ${2:`g:snips_author`}\n * @version ${3:$Id$}\n * @copyright ${4:$2}, `strftime('%d %B, %Y')`\n * @package ${5:default}\n **/\n\n/**\n * Define DocBlock\n *//"
" Interface
exe "Snip doc_i /**\n * ${2:undocumented class}\n *\n * @package ${3:default}\n * @author ${4:`g:snips_author`}\n **/\ninterface ${1:}\n{${5}\n} // END interface $1"
" class ...
exe "Snip class /**\n * ${1}\n **/\nclass ${2:ClassName}\n{\n\t${3}\n\tfunction ${4:__construct}(${5:argument})\n\t{\n\t\t${6:// code...}\n\t}\n}"
" define(...)
exe "Snip def define('${1}'${2});${3}"
" defined(...)
exe "Snip def? ${1}defined('${2}')${3}"
exe "Snip wh while (${1:/* condition */}) {\n\t${2:// code...}\n}"
" do ... while
exe "Snip do do {\n\t${2:// code... }\n} while (${1:/* condition */});"
exe "Snip if if (${1:/* condition */}) {\n\t${2:// code...}\n}"
exe "Snip ife if (${1:/* condition */}) {\n\t${2:// code...}\n} else {\n\t${3:// code...}\n}\n${4}"
exe "Snip else else {\n\t${1:// code...}\n}"
exe "Snip elseif elseif (${1:/* condition */}) {\n\t${2:// code...}\n}"
" Tertiary conditional
exe "Snip t $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}"
exe "Snip switch switch ($${1:variable}) {\n\tcase '${2:value}':\n\t\t${3:// code...}\n\t\tbreak;\n\t${5}\n\tdefault:\n\t\t${4:// code...}\n\t\tbreak;\n}"
exe "Snip case case '${1:value}':\n\t${2:// code...}\n\tbreak;${3}"
exe "Snip for for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {\n\t${4: // code...}\n}"
exe "Snip foreach foreach ($${1:variable} as $${2:key}) {\n\t${3:// code...}\n}"
exe "Snip fun ${1:public }function ${2:FunctionName}(${3})\n{\n\t${4:// code...}\n}"
" $... = array (...)
exe "Snip array $${1:arrayName} = array('${2}' => ${3});${4}"

0 comments on commit 91c475a

Please sign in to comment.