commit 09c3c361095cea00886404985555ef93903a1553 Author: Јован Ђокић-Шумарац Date: Sat Jul 22 16:20:18 2023 +0200 Initial commit diff --git a/UltiSnips/README b/UltiSnips/README new file mode 100755 index 0000000..41d8592 --- /dev/null +++ b/UltiSnips/README @@ -0,0 +1,17 @@ +This directory contains the snippets for UltiSnips. +https://github.com/sirver/ultisnips + +Standing On The Shoulders of Giants +=================================== + +The snippets have been collected from various other project which I want to +express my gratitude for. My main source for inspiration where the following +two projects: + + TextMate: http://svn.textmate.org/trunk/Bundles/ + SnipMate: http://code.google.com/p/snipmate/ + +UltiSnips has seen contributions by many individuals. Those contributions have +been merged into this collection seamlessly and without further comments. + +-- vim:ft=rst:nospell: diff --git a/UltiSnips/ada.snippets b/UltiSnips/ada.snippets new file mode 100755 index 0000000..bea2a6c --- /dev/null +++ b/UltiSnips/ada.snippets @@ -0,0 +1,282 @@ +priority -50 + +global !p + +def ada_case(word): + out = word[0].upper() + for i in range(1, len(word)): + if word[i] == '-': + out = out + '.' + elif word[i - 1] == '_' or word[i - 1] == '-': + out = out + word[i].upper() + else: + out = out + word[i] + return out + +endglobal + +snippet wi "with" +with $1;$0 +endsnippet + +snippet pac "package" +package ${1:`!p snip.rv = ada_case(snip.basename)`} is + $0 +end $1; +endsnippet + +snippet pacb "package body" +package body ${1:`!p snip.rv = ada_case(snip.basename)`} is + $0 +end $1; +endsnippet + +snippet ent "entry ... when" +entry $1($2) when $3 is +begin + $0 +end $1; +endsnippet + +snippet task "task" +task $1 is + entry $0 +end $1; +endsnippet + +snippet taskb "task body" +task body $1 is + $2 +begin + $0 +end $1; +endsnippet + +snippet acc "accept" +accept $1($2) do + $0 +end $1; +endsnippet + +snippet prot "protected type" +protected type $1($2) is + $0 +end $1; +endsnippet + +snippet prob "protected body" +protected body $1 is + $2 +begin + $0 +end $1; +endsnippet + +snippet gen "generic type" +generic + type $1 is $2;$0 +endsnippet + +snippet ty "type" +type $1 is $2;$0 +endsnippet + +snippet tyd "type with default value" +type $1 is $2 + with Default_Value => $3;$0 +endsnippet + +snippet subty "subtype" +subtype $1 is $2;$0 +endsnippet + +snippet dec "declare block" +declare + $1 +begin + $0 +end; +endsnippet + +snippet decn "declare named block" +$1: +declare + $2 +begin + $0 +end $1; +endsnippet + +snippet ifex "if expression" +if $1 then $2 else $0 +endsnippet + +snippet casex "case expression" +case $1 is + when $2 => $3,$0 +endsnippet + +snippet fora "for all" +for all $1 ${2:in} $3 => $0 +endsnippet + +snippet fors "for some" +for some $1 ${2:in} $3 => $0 +endsnippet + +snippet if "if" +if $1 then + $0 +end if; +endsnippet + +snippet ife "if ... else" +if $1 then + $2 +else + $0 +end if; +endsnippet + +snippet el "else" +else + $0 +endsnippet + +snippet eif "elsif" +elsif $1 then + $0 +endsnippet + +snippet wh "while" +while $1 loop + $0 +end loop; +endsnippet + +snippet nwh "named while" +$1: +while $2 loop + $0 +end loop $1; +endsnippet + +snippet for "for" +for ${1:I} in $2 loop + $0 +end loop; +endsnippet + +snippet fore "for each" +for $1 of $2 loop + $0 +end loop; +endsnippet + +snippet nfor "named for" +$1: +for ${2:I} in $3 loop + $0 +end loop $1; +endsnippet + +snippet nfore "named for each" +$1: +for $2 of $3 loop + $0 +end loop $1; +endsnippet + +snippet proc "procedure" +procedure $1($2) is + $3 +begin + $0 +end $1; +endsnippet + +snippet procd "procedure declaration" +procedure $1;$0 +endsnippet + +snippet fun "function" +function $1($2) return $3 is + $4 +begin + $0 +end $1; +endsnippet + +snippet fune "expression function" +function $1 return $2 is + ($3);$0 +endsnippet + +snippet fund "function declaration" +function $1 return $2;$0 +endsnippet + +snippet ret "extended return" +return $1 do + $0 +end return; +endsnippet + +snippet rec "record" +record + $0 +end record; +endsnippet + +snippet case "case" +case $1 is + when $2 => $3;$0 +end case; +endsnippet + +snippet whe "when" +when $1 => $2;$0 +endsnippet + +snippet wheo "when others" +when others => $1;$0 +endsnippet + +snippet lo "loop" +loop + $0 +end loop; +endsnippet + +snippet nlo "named loop" +$1: +loop + $0 +end loop $1; +endsnippet + +snippet ex "exit when" +exit when $1;$0 +endsnippet + +snippet put "Ada.Text_IO.Put" +Ada.Text_IO.Put($1);$0 +endsnippet + +snippet putl "Ada.Text_IO.Put_Line" +Ada.Text_IO.Put_Line($1);$0 +endsnippet + +snippet get "Ada.Text_IO.Get" +Ada.Text_IO.Get($1);$0 +endsnippet + +snippet getl "Ada.Text_IO.Get_Line" +Ada.Text_IO.Get_Line($1);$0 +endsnippet + +snippet newline "Ada.Text_IO.New_Line" +Ada.Text_IO.New_Line(${1:1});$0 +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets new file mode 100755 index 0000000..84ddaa4 --- /dev/null +++ b/UltiSnips/all.snippets @@ -0,0 +1,113 @@ +# This file contains snippets that are always defined. I personally +# have snippets for signatures and often needed texts + +# sligthly lower priority than everything else since specialized versions +# should overwrite. The user needs to adjust her priority in her snippets to +# ~-55 so that other filetypes will still overwrite. +priority -60 + +############## +# NICE BOXES # +############## +global !p +from vimsnippets import foldmarker, make_box, get_comment_format +LOREM = """ +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod \ +tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At \ +vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \ +no sea takimata sanctus est Lorem ipsum dolor sit amet. +""" +endglobal + +snippet box "A nice box with the current comment symbol" b +`!p +box = make_box(len(t[1])) +snip.rv = box[0] +snip += box[1] +`${1:${VISUAL:content}}`!p +box = make_box(len(t[1])) +snip.rv = box[2] +snip += box[3]` +$0 +endsnippet + +snippet bbox "A nice box over the full width" b +`!p +if not snip.c: + width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71 +box = make_box(len(t[1]), width) +snip.rv = box[0] +snip += box[1] +`${1:${VISUAL:content}}`!p +box = make_box(len(t[1]), width) +snip.rv = box[2] +snip += box[3]` +$0 +endsnippet + +snippet fold "Insert a vim fold marker" b +`!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = get_comment_format()[2]` +endsnippet + +snippet foldc "Insert a vim fold close marker" b +`!p snip.rv = get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = get_comment_format()[2]` +endsnippet + +snippet foldp "Insert a vim fold marker pair" b +`!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = get_comment_format()[2]` +${2:${VISUAL:Content}} +`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]` +endsnippet + +########################## +# LOREM IPSUM GENERATORS # +########################## +snippet "lorem(([1-4])?[0-9])?" "Lorem Ipsum" r +`!p snip.rv = " ".join(LOREM.split()[:int(match.group(1))]) if match.group(1) else LOREM` +endsnippet + +########################## +# VIM MODELINE GENERATOR # +########################## +# See advice on `:help 'tabstop'` for why these values are set. Uses second +# modeline form ('set') to work in languages with comment terminators +# (/* like C */). +snippet modeline "Vim modeline" +vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'` +endsnippet + +######### +# DATES # +######### +snippet date "YYYY-MM-DD" w +`!v strftime("%Y-%m-%d")` +endsnippet + +snippet ddate "Month DD, YYYY" w +`!v strftime("%b %d, %Y")` +endsnippet + +snippet diso "ISO format datetime" w +`!v strftime("%Y-%m-%d %H:%M:%S%z")` +endsnippet + +snippet time "hh:mm" w +`!v strftime("%H:%M")` +endsnippet + +snippet datetime "YYYY-MM-DD hh:mm" w +`!v strftime("%Y-%m-%d %H:%M")` +endsnippet + +snippet todo "TODO comment" bw +`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]` +endsnippet + +########## +# Misc # +########## +snippet uuid "Random UUID" w +`!p if not snip.c: import uuid; snip.rv = str(uuid.uuid4())` +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/bib.snippets b/UltiSnips/bib.snippets new file mode 100755 index 0000000..c9b8df5 --- /dev/null +++ b/UltiSnips/bib.snippets @@ -0,0 +1,52 @@ +priority -50 + +snippet online "Online resource" b +@online{${1:name}, + author={${2:author}}, + title={${3:title}}, + date={${4:date}}, + url={${5:url}} +} +$0 +endsnippet + +snippet article "Article reference" b +@article{${1:name}, + author={${2:author}}, + title={${3:title}}, + journaltitle={${4:journal}}, + volume={${5:NN}}, + number={${6:NN}}, + year={${7:YYYY}}, + pages={${8:NN}--${9:NN}} +} +$0 +endsnippet + +snippet book "Book reference" b +@book{${1:name}, + author={${2:author}}, + title={${3:title}}, + subtitle={${4:subtitle}}, + year={${5:YYYY}}, + location={${6:somewhere}}, + publisher={${7:publisher}}, + pages={${8:NN}--${9:NN}} +} +$0 +endsnippet + +snippet inb "In Book reference" b +@inbook{${1:name}, + author={${2:author}}, + title={${3:title}}, + subtitle={${4:subtitle}}, + booktitle={${5:book}}, + editor={${6:editor}}, + year={${7:YYYY}}, + location={${8:somewhere}}, + publisher={${9:publisher}}, + pages={${10:NN}--${11:NN}} +} +$0 +endsnippet diff --git a/UltiSnips/bindzone.snippets b/UltiSnips/bindzone.snippets new file mode 100755 index 0000000..b8ab0df --- /dev/null +++ b/UltiSnips/bindzone.snippets @@ -0,0 +1,29 @@ +priority -50 + +global !p +def newsoa(): + import datetime + now = datetime.datetime.now() + # return standard SOA formatted serial for today + return now.strftime("%Y%m%d00") +endglobal + +snippet zone "Bootstrap a new Bind zonefile" b +$TTL 86400 +@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.( + `!p snip.rv = newsoa()`; serial + 21600; refresh every 6 hours + 3600; retry after one hour + 604800; expire after a week + 86400 ); minimum TTL of 1 day + + IN NS ns01.$1. + IN MX 10 mail.$1. + +ns01.$1 IN A +mail.$1 IN A +endsnippet + +snippet A "Insert A Record" b +${1:hostname} IN A ${2:ip} +endsnippet diff --git a/UltiSnips/blade.snippets b/UltiSnips/blade.snippets new file mode 100755 index 0000000..26fde17 --- /dev/null +++ b/UltiSnips/blade.snippets @@ -0,0 +1,139 @@ +priority -50 + +extends html + +# We want to overwrite everything in parent ft. +priority -49 + +snippet break "@break" +@break +endsnippet + +snippet component "@component directive" +@component('$1') + ${2:${VISUAL}} +@endcomponent +endsnippet + +snippet each "@each directive" +@each('$1', $$2, '$3') +endsnippet + +snippet else "@else directive" +@else +endsnippet + +snippet eif "@else if directive" +@else if ($1) + ${2:${VISUAL}} +endsnippet + +snippet for "@for directive" +@for ($1) + ${2:${VISUAL}} +@endfor +endsnippet + +snippet foreach "@foreach directive" +@foreach ($$1 as $$2) + ${3:${VISUAL}} +@endforeach +endsnippet + +snippet extends "@extends directive" +@extends('$1') +endsnippet + +snippet if "@if directive" +@if ($1) + ${2:${VISUAL}} +@endif +endsnippet + +snippet ife "@if @else structure" +@if ($1) + ${2:${VISUAL}} +@else + ${3:${VISUAL}} +@endif +endsnippet + +snippet include "@include directive" +@include('$1') +endsnippet + +snippet includeIf "@includeIf directive" +@includeIf('$1') +endsnippet + +snippet isset "@isset directive" +@isset + ${1:${VISUAL}} +@endisset +endsnippet + +snippet inject "@inject directive" +@inject('$1', '$2') +endsnippet + +snippet lang "@lang directive" i +@lang('$1') +endsnippet + +snippet php "@php directive" +@php + ${1:${VISUAL}} +@endphp +endsnippet + +snippet push "@push directive" +@push('$1') + ${2:${VISUAL}} +@endpush +endsnippet + +snippet section "@section directive" +@section('$1') +endsnippet + +snippet show "@show directive" +@show +endsnippet + +snippet slot "@slot directive" +@slot('$1') + ${2:${VISUAL}} +@endslot +endsnippet + +snippet unless "@unless directive" +@unless + ${1:${VISUAL}} +@endunless +endsnippet + +snippet verbatim "@verbatim directive" +@verbatim + ${0:$VISUAL} +@endverbatim +endsnippet + +snippet wh "@while directive" +@while ($1) + ${2:${VISUAL}} +@endwhile +endsnippet + +snippet yield "@yield directive" +@yield('$1') +endsnippet + +snippet { "{{ }} statement." i +{{ $1 }} +endsnippet + +snippet {! "{!! !!} statement" i +{!! $1 !!} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets new file mode 100755 index 0000000..c191d76 --- /dev/null +++ b/UltiSnips/c.snippets @@ -0,0 +1,186 @@ +########################################################################### +# TextMate Snippets # +########################################################################### +# -------------- +# Functions +# -------------- +global !p +def printf_expand_args(snip): + """ + This will look how many placeholders printf has and adds the separated commas + at the end. + """ + + # now add so many "," as much as the amount of placeholders + amount_placeholders = snip.tabstops[1].current_text.count("%") + + output = "" + + # Add the amount of tabstops + for placeholder_index in range(3, amount_placeholders + 3): + output += f", ${placeholder_index}" + + # convert them into tabstops + snip.expand_anon(output) + +endglobal + +# ============== +# Snippets +# ============== +priority -50 + +snippet def "#define ..." +#define $1 +endsnippet + +snippet #ifndef "#ifndef ... #define ... #endif" +#ifndef ${1/([A-Za-z0-9_]+).*/$1/} +#define ${1:SYMBOL} ${2:value} +#endif /* ifndef $1 */ +endsnippet + +snippet #if "#if #endif" b +#if ${1:0} +${VISUAL}$0 +#endif +endsnippet + +snippet mark "#pragma mark (mark)" +#if 0 +${1:#pragma mark - +}#pragma mark $2 +#endif + +$0 +endsnippet + +snippet main "main() (main)" +int main(int argc, char *argv[]) +{ + ${VISUAL}$0 + return 0; +} +endsnippet + +snippet for "for loop (for)" +for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { + ${VISUAL}$0 +} +endsnippet + +snippet fori "for int loop (fori)" +for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { + ${VISUAL}$0 +} +endsnippet + +snippet fora "for-loop" b +for (${1:var}; ${2:condition}; `!p +if len(t[1]) > 0: + snip.rv = t[1].split('=')[0].split()[-1] +`++) { + + $0 +} /* for ($1; $2; `!p if len(t[1]) > 0: snip.rv = t[1].split('=')[0].split()[-1]`++) */ +endsnippet + +snippet once "Include header once only guard" +#ifndef ${1:`!p +if not snip.c: + import random, string + name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper() + rand = ''.join(random.sample(string.ascii_letters+string.digits, 8)) + snip.rv = ('%s_%s' % (name,rand)).upper() +else: + snip.rv = snip.c`} +#define $1 + +${VISUAL}$0 + +#endif /* end of include guard: $1 */ +endsnippet + +snippet fprintf "fprintf ..." +fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/} +endsnippet + +snippet eli "else if .. (eli)" +else if (${1:/* condition */}) { + ${VISUAL}$0 +} +endsnippet + +post_jump "printf_expand_args(snip)" +snippet "printf" "printf with auto-expand args" wr +printf("$1\n"$2); +endsnippet + +snippet st "struct" +struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} { + ${0:/* data */} +}; +endsnippet + +snippet fun "function" b +${1:void} ${2:function_name}($3) +{ + ${VISUAL}$0 +} +endsnippet + +snippet fund "function declaration" b +${1:void} ${2:function_name}($3); +endsnippet + +global !p +def split_line(text): + import textwrap + lines = textwrap.wrap(text, 78 - 19) + output = list() + for line in lines: + output.append('*' + ' '*19 + line) + snip_line = snip.tabstops[4].end[0] + snip.buffer.append(output, snip_line + 1) + del snip.buffer[snip_line] + +def get_args(arglist): + args = [arg.strip() for arg in arglist.split(',') if arg] + return args +endglobal + +post_jump "if snip.tabstop == 0 : split_line(snip.tabstops[4].current_text)" +snippet head "File Header" b +/****************************************************************************** +* File: `!p snip.rv = fn` +* +* Author: ${2} +* Created: `date +%m/%d/%y` +* Description: ${4:${VISUAL}} +*****************************************************************************/ +${0} +endsnippet + +post_jump "if snip.tabstop == 0 : split_line(snip.tabstops[4].current_text)" +snippet func "Function Header" +/****************************************************************************** +* Function: $1 +* Description: ${4:${VISUAL}} +* Where:`!p +snip.rv = "" +snip >> 2 + +args = get_args(t[2]) +if args: + for arg in args: + snip.rv += '\n' + '*' + ' '*19 + arg + ' - TODO' +snip << 2 +` +* Return: $5 +* Error: $6 +*****************************************************************************/ +${1}($2){ + ${0} +} +endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/coffee-jasmine.snippets b/UltiSnips/coffee-jasmine.snippets new file mode 100755 index 0000000..0dd35cd --- /dev/null +++ b/UltiSnips/coffee-jasmine.snippets @@ -0,0 +1,166 @@ +# +# CoffeeScript versions -- adapted from the JS TextMate bundle + additions +# for some jasmine-jquery matchers +# +priority -50 + +extends coffee + +priority -49 + +snippet des "Describe (coffee)" b +describe '${1:description}', -> + $0 +endsnippet + +snippet it "it (coffee)" b +it '${1:description}', -> + $0 +endsnippet + +snippet bef "before each (coffee)" b +beforeEach -> + $0 +endsnippet + +snippet aft "after each (coffee)" b +afterEach -> + $0 +endsnippet + +snippet any "any (coffee)" b +jasmine.any($1) +endsnippet + +snippet ru "runs (coffee)" b +runs -> + $0 +endsnippet + +snippet wa "waits (coffee)" b +waits($1) +endsnippet + +snippet ex "expect (coffee)" b +expect(${1:target})$0 +endsnippet + +snippet ee "expect to equal (coffee)" b +expect(${1:target}).toEqual(${2:value}) +endsnippet + +snippet em "expect to match (coffee)" b +expect(${1:target}).toMatch(${2:pattern}) +endsnippet + +snippet eha "expect to have attribute (coffee)" b +expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'}) +endsnippet + +snippet et "expect to be truthy (coffee)" b +expect(${1:target}).toBeTruthy() +endsnippet + +snippet ef "expect to be falsy (coffee)" b +expect(${1:target}).toBeFalsy() +endsnippet + +snippet ed "expect to be defined (coffee)" b +expect(${1:target}).toBeDefined() +endsnippet + +snippet en "expect to be null (coffee)" b +expect(${1:target}).toBeNull() +endsnippet + +snippet ec "expect to contain (coffee)" b +expect(${1:target}).toContain(${2:value}) +endsnippet + +snippet ev "expect to be visible (coffee)" b +expect(${1:target}).toBeVisible() +endsnippet + +snippet eh "expect to be hidden (coffee)" b +expect(${1:target}).toBeHidden() +endsnippet + +snippet notx "expect not (coffee)" b +expect(${1:target}).not$0 +endsnippet + +snippet note "expect not to equal (coffee)" b +expect(${1:target}).not.toEqual(${2:value}) +endsnippet + +snippet notm "expect not to match (coffee)" b +expect(${1:target}).not.toMatch(${2:pattern}) +endsnippet + +snippet notha "expect to not have attribute (coffee)" b +expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'}) +endsnippet + +snippet nott "expect not to be truthy (coffee)" b +expect(${1:target}).not.toBeTruthy() +endsnippet + +snippet notf "expect not to be falsy (coffee)" b +expect(${1:target}).not.toBeFalsy() +endsnippet + +snippet notd "expect not to be defined (coffee)" b +expect(${1:target}).not.toBeDefined() +endsnippet + +snippet notn "expect not to be null (coffee)" b +expect(${1:target}).not.toBeNull() +endsnippet + +snippet notc "expect not to contain (coffee)" b +expect(${1:target}).not.toContain(${2:value}) +endsnippet + +snippet notv "expect not to be visible (coffee)" b +expect(${1:target}).not.toBeVisible() +endsnippet + +snippet noth "expect not to be hidden (coffee)" b +expect(${1:target}).not.toBeHidden() +endsnippet + +snippet s "spy on (coffee)" b +spyOn(${1:object}, "${2:method}")$0 +endsnippet + +snippet sr "spy on and return (coffee)" b +spyOn(${1:object}, "${2:method}").andReturn(${3:arguments}) +endsnippet + +snippet st "spy on and throw (coffee)" b +spyOn(${1:object}, "${2:method}").andThrow(${3:exception}) +endsnippet + +snippet sct "spy on and call through (coffee)" b +spyOn(${1:object}, "${2:method}").andCallThrough() +endsnippet + +snippet scf "spy on and call fake (coffee)" b +spyOn(${1:object}, "${2:method}").andCallFake(${3:function}) +endsnippet + +snippet esc "expect was called (coffee)" b +expect(${1:target}).wasCalled() +endsnippet + +snippet escw "expect was called with (coffee)" b +expect(${1:target}).wasCalledWith(${2:arguments}) +endsnippet + +snippet notsc "expect was not called (coffee)" b +expect(${1:target}).wasNotCalled() +endsnippet + +snippet noscw "expect was not called with (coffee)" b +expect(${1:target}).wasNotCalledWith(${2:arguments}) +endsnippet diff --git a/UltiSnips/coffee-react.snippets b/UltiSnips/coffee-react.snippets new file mode 100755 index 0000000..3090c57 --- /dev/null +++ b/UltiSnips/coffee-react.snippets @@ -0,0 +1,80 @@ +# +# CoffeeScript versions -- adapted from coffee-jasmine +# for some ReactJS matchers. +# +priority -50 + +extends coffee + +priority -49 + +snippet createClass "React define Class" b +${1:classname}Class = React.createClass + displayName: "$1" + render: -> + $2 +$1 = React.createFactory($1) +endsnippet + +snippet PropTypes "React define propTypes" b +propTypes: -> + ${1:myVar}: React.PropTypes.${2:type}${3:.isRequired} +endsnippet + +snippet propType "React propType (key/value)" b +${1:myVar}: React.PropTypes.${2:type}${3:.isRequired} +$4 +endsnippet + +snippet setState "React setState" b +@setState + ${1:myvar}: ${2:myvalue} + $3 +endsnippet + +snippet getInitialState "React define getInitialState" b +getInitialState: -> + ${1:myvar}: ${2:myvalue} + $3 +endsnippet + +snippet getDefaultProps "React define getDefaultProps" b +getDefaultProps: -> + ${1:myvar}: ${2:myvalue} + $3 +endsnippet + +snippet componentWillMount "React define componentWillMount" b +componentWillMount: -> + $1 +endsnippet + +snippet componentDidMount "React define componentDidMount" b +componentDidMount: -> + $1 +endsnippet + +snippet componentWillReceiveProps "React define componentWillReceiveProps" b +componentWillReceiveProps: (nextProps) -> + $1 +endsnippet + +snippet shouldComponentUpdate "React define shouldComponentUpdate" b +shouldComponentUpdate: (nextProps, nextState) -> + $1 +endsnippet + +snippet componentWillUpdate "React define componentWillUpdate" b +componentWillUpdate: (nextProps, nextState) -> + $1 +endsnippet + +snippet componentDidUpdate "React define componentDidUpdate" b +componentDidUpdate: (prevProps, prevState) -> + $1 +endsnippet + +snippet componentWillUnmount "React define componentWillUnmount" b +componentWillUnmount: -> + $1 +endsnippet diff --git a/UltiSnips/coffee.snippets b/UltiSnips/coffee.snippets new file mode 100755 index 0000000..75e7d06 --- /dev/null +++ b/UltiSnips/coffee.snippets @@ -0,0 +1,100 @@ +priority -50 + +snippet fun "Function" b +${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`-> + ${0:# body...} +endsnippet + +snippet bfun "Function (bound)" i +`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr} +endsnippet + +snippet if "If" b +if ${1:condition} + ${0:# body...} +endsnippet + +snippet ife "If .. Else" b +if ${1:condition} + ${2:# body...} +else + ${3:# body...} +endsnippet + +snippet elif "Else if" b +else if ${1:condition} + ${0:# body...} +endsnippet + +snippet ifte "Ternary if" b +if ${1:condition} then ${2:value} else ${3:other} +endsnippet + +snippet unl "Unless" b +${1:action} unless ${2:condition} +endsnippet + +snippet fora "Array Comprehension" b +for ${1:name} in ${2:array} + ${0:# body...} +endsnippet + +snippet foro "Object Comprehension" b +for ${1:key}, ${2:value} of ${3:Object} + ${0:# body...} +endsnippet + +snippet forr "Range Comprehension (inclusive)" b +for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} + ${0:# body...} +endsnippet + +snippet forrex "Range Comprehension (exclusive)" b +for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} + ${0:# body...} +endsnippet + +snippet swi "Switch" b +switch ${1:object} + when ${2:value} + ${3:# body...} + else + $0 +endsnippet + +snippet swit "Switch when .. then" b +switch ${1:object} + when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} + else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value} +endsnippet + +snippet cla "Class" b +class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor} + + ${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` -> + ${5:# body...}} + $0 +endsnippet + +snippet try "Try .. Catch" b +try + $1 +catch ${2:error} + $3 +endsnippet + +snippet req "Require" b +${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'}) +endsnippet + +snippet # "Interpolated Code" i +#{$1}$0 +endsnippet + +snippet log "Log" b +console.log ${1:"${2:msg}"} +endsnippet + +snippet kv "Key:value for object" b +${1:key}:${2:value} +endsnippet diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets new file mode 100755 index 0000000..4a22782 --- /dev/null +++ b/UltiSnips/cpp.snippets @@ -0,0 +1,200 @@ +priority -50 + +extends c + +# We want to overwrite everything in parent ft. +priority -49 +########################################################################### +# Global functions # +########################################################################### + +global !p + +def write_docstring_args(arglist, snip): + args = str(arglist).split(',') + + if len(args) > 1: + c = 0 + for arg in args: + if c == 0: + snip.rv += arg + c = 1 + else: + snip += '* : %s' % arg.strip() + else: + snip.rv = args[0] + + +endglobal + +########################################################################### +# TextMate Snippets # +########################################################################### +snippet ponce "#pragma once include guard" +#pragma once + +endsnippet + +snippet main +int main(int argc, char *argv[]) +{ + ${0} + return 0; +} +endsnippet + +snippet forc "general for loop (for)" +for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) { + ${VISUAL}$0 +} +endsnippet + +snippet beginend "$1.begin(), $1.end() (beginend)" +${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end() +endsnippet + +snippet cl "class .. (class)" +class ${1:`!p snip.rv = snip.basename or "name"`} +{ +public: + ${1/(\w+).*/$1/} (${2:arguments}); + virtual ~${1/(\w+).*/$1/} (); + +private: + ${0:/* data */} +}; +endsnippet + +snippet ns "namespace .. (namespace)" +namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} +{ + ${VISUAL}$0 +}${1/.+/ \/* /m}$1${1/.+/ *\/ /m} +endsnippet + +snippet nsa "namespace alias" +namespace ${1:alias} = ${2:namespace}; +endsnippet + +snippet using "using directive/using declaration/type alias" +using ${1:namespace}`!p snip.rv = ' ' if t[1] == 'namespace' else ' = ' if t[1] != '' else ''`${2:name}; +endsnippet + +snippet readfile "read file (readF)" +std::vector v; +if (FILE *fp = fopen(${1:"filename"}, "r")) +{ + char buf[1024]; + while(size_t len = fread(buf, 1, sizeof(buf), fp)) + v.insert(v.end(), buf, buf + len); + fclose(fp); +} +endsnippet + +snippet map "std::map (map)" +std::map<${1:key}, ${2:value}> map$0; +endsnippet + +snippet vector "std::vector (v)" +std::vector<${1:char}> v$0; +endsnippet + +snippet tp "template (template)" +template +endsnippet + +snippet cla "An entire .h generator" b +#ifndef ${2:`!v substitute(vim_snippets#Filename('$1_H','ClassName'),'.*','\U&\E','')`} +#define $2 + +class ${1:`!v substitute(substitute(vim_snippets#Filename('$1','ClassName'),'^.','\u&',''), '_\(\w\)', '\u\1', 'g')`} +{ +private: + $3 + +public: + $1(); + virtual ~$1(); +}; + +#endif /* $2 */ +endsnippet + + +snippet fnc "Basic c++ doxygen function template" b +/** +* @brief: ${4:brief} +* +* @param: `!p write_docstring_args(t[3],snip)` +* +* @return: `!p snip.rv = t[1]` +*/ +${1:ReturnType} ${2:FunctionName}(${3:param}) +{ + ${0:FunctionBody} +} +endsnippet + +snippet boost_test "Boost test module" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +BOOST_AUTO_TEST_CASE(${2:TestCaseName}) +{ + ${0:TestDefinition} +} + +endsnippet + +snippet boost_suite "Boost test suite module" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +BOOST_AUTO_TEST_SUITE(${2:SuiteName}) + +BOOST_AUTO_TEST_CASE(${3:TestCaseName}) +{ + ${0:TestDefinition} +} + +BOOST_AUTO_TEST_SUITE_END() + +endsnippet +snippet boost_test_fixture "Boost test module with fixture" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +struct ${2:FixtureName} { + $2() {} + virtual ~$2() {} + /* define members here */ +}; + +BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2) +{ + ${0:TestDefinition} +} + +endsnippet + +snippet boost_suite_fixture "Boost test suite with fixture" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +struct ${2:FixtureName} { + $2() {} + virtual ~$2() {} + /* define members here */ +}; + +BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2) + +BOOST_AUTO_TEST_CASE(${4:TestCaseName}) +{ + ${0:TestDefinition} +} + +BOOST_AUTO_TEST_SUITE_END() + +endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/crystal.snippets b/UltiSnips/crystal.snippets new file mode 100755 index 0000000..cab946f --- /dev/null +++ b/UltiSnips/crystal.snippets @@ -0,0 +1,13 @@ +priority -50 + +snippet "\b(de)?f" "def ..." r +def ${1:method_name}${2:(${3:*args})} + $0 +end +endsnippet + +snippet "\b(pde)?f" "private def ..." r +private def ${1:method_name}${2:(${3:*args})} + $0 +end +endsnippet diff --git a/UltiSnips/cs.snippets b/UltiSnips/cs.snippets new file mode 100755 index 0000000..4c58bcb --- /dev/null +++ b/UltiSnips/cs.snippets @@ -0,0 +1,385 @@ +####################################################################### +# C# Snippets for UltiSnips # +####################################################################### + +priority -50 + +######################### +# classes and structs # +######################### + +snippet namespace "namespace" b +namespace ${1:MyNamespace} +{ + ${VISUAL}$0 +} +endsnippet + +snippet class "class" w +${1:public} class ${2:`!p snip.rv = snip.basename`} +{ + $0 +} +endsnippet + +snippet struct "struct" w +struct ${1:`!p snip.rv = snip.basename`} +{ + $0 +} +endsnippet + +snippet interface "interface" w +interface I${1:`!p snip.rv = snip.basename`} +{ + $0 +} +endsnippet + +snippet enum "enumeration" b +enum ${1:MyEnum} { ${2:Item} }; +endsnippet + + +############ +# Main() # +############ + +snippet sim "static int main" b +static int Main(string[] args) +{ + $0 +} +endsnippet + +snippet svm "static void main" b +static void Main(string[] args) +{ + $0 +} +endsnippet + + +################ +# properties # +################ + +snippet prop "Simple property declaration" b +public ${1:int} ${2:MyProperty} { get; set; } +endsnippet + +snippet propfull "Full property declaration" b +private ${1:int} ${2:_myProperty}; + +public $1 ${3:MyProperty} +{ + get { return $2; } + set { $2 = value; } +} +endsnippet + +snippet propg "Property with a private setter" b +public ${1:int} ${2:MyProperty} { get; private set; } +endsnippet + + +############ +# blocks # +############ + +snippet #if "#if #endif" b +#if ${1:DEBUG} +${VISUAL}$0 +#endif +endsnippet + +snippet #region "#region #endregion" b +#region ${1:Region} +${VISUAL}$0 +#endregion +endsnippet + + +########### +# loops # +########### + +snippet for "for loop" b +for (int ${1:i} = 0; $1 < ${2:10}; $1++) +{ + ${VISUAL}$0 +} +endsnippet + +snippet forr "for loop (reverse)" b +for (int ${1:i} = ${2:10}; $1 >= 0; $1--) +{ + ${VISUAL}$0 +} +endsnippet + +snippet foreach "foreach loop" b +foreach (${3:var} ${2:item} in ${1:items}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet while "while loop" b +while (${1:true}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet do "do loop" b +do +{ + ${VISUAL}$0 +} while (${1:true}); +endsnippet + + +############### +# branching # +############### + +snippet if "if statement" b +if ($1) +{ + ${VISUAL}$0 +} +endsnippet + +snippet ife "if else statement" b +if ($1) +{ + ${VISUAL}$0 +} +else +{ +} +endsnippet + +snippet elif "else if" b +else if ($1) +{ + $0 +} +endsnippet + +snippet elseif "else if" b +else if ($1) +{ + $0 +} +endsnippet + +snippet ifnn "if not null" b +if ($1 != null) +{ + ${VISUAL}$0 +} +endsnippet + +snippet switch "switch statement" b +switch (${1:statement}) +{ + case ${2:value}: + break; + + default: + $0break; +} +endsnippet + +snippet case "case" b +case ${1:value}: + $2 + break; +endsnippet + + +############## +# wrappers # +############## + +snippet using "using statement" b +using (${1:resource}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet unchecked "unchecked block" b +unchecked +{ + ${VISUAL}$0 +} +endsnippet + +snippet checked "checked block" b +checked +{ + ${VISUAL}$0 +} +endsnippet + +snippet unsafe "unsafe" b +unsafe +{ + ${VISUAL}$0 +} +endsnippet + + +######################## +# exception handling # +######################## + +snippet try "try catch block" b +try +{ + ${VISUAL}$0 +} +catch (${1:Exception} ${2:e}) +{ + throw; +} +endsnippet + +snippet tryf "try finally block" b +try +{ + ${VISUAL}$0 +} +finally +{ +} +endsnippet + +snippet throw "throw" +throw new $1Exception("$2"); +endsnippet + + +########## +# LINQ # +########## + +snippet from "LINQ syntax" b +var ${1:seq} = + from ${2:item1} in ${3:items1} + join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2} + select ${8:$2.prop3} + where ${9:clause} +endsnippet + + +############################ +# feedback and debugging # +############################ + +snippet da "Debug.Assert" b +Debug.Assert(${1:true}); +endsnippet + +snippet cw "Console.WriteLine" b +Console.WriteLine("$1"); +endsnippet + +snippet cr "Console.ReadLine" b +Console.ReadLine(); +endsnippet + +# as you first type comma-separated parameters on the right, {n} values appear in the format string +snippet cwp "Console.WriteLine with parameters" b +Console.WriteLine("${2:`!p +snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))]) +`}"${1:, something}); +endsnippet + +snippet mbox "Message box" b +MessageBox.Show("${1:message}"); +endsnippet + + +############# +# methods # +############# + +snippet equals "Equality for a type" b +public override bool Equals(object obj) => Equals(obj as ${1:TYPE}); + +public bool Equals($1 other) // IEquatable<$1> +{ + if (object.ReferenceEquals(other, null)) + return false; + if (object.ReferenceEquals(this, other)) + return true; + if (this.GetType() != other.GetType()) + return false; + $0 + return base.Equals(other); +} + +public override int GetHashCode() => base.GetHashCode(); + +public static bool operator ==($1 x, $1 y) => + (object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null)) + || (!object.ReferenceEquals(x, null) && x.Equals(y)); + +public static bool operator !=($1 x, $1 y) => !(x == y); + +endsnippet + +snippet mth "Method" b +${1:public} ${2:void} ${3:MyMethod}(${4}) +{ + $0 +} +endsnippet + +snippet mths "Static method" b +${1:public} static ${2:void} ${3:MyMethod}(${4}) +{ + $0 +} +endsnippet + +############### +# constructor # +############### + +snippet ctor "Constructor" b +${1:public} ${2:`!p snip.rv = snip.basename or "untitled"`}(${3}) +{ + $0 +} +endsnippet + +############## +# comments # +############## + +snippet /// "XML summary comment" b +/// +/// $0 +/// +endsnippet + +snippet

${2} +endsnippet + +snippet ${2} +endsnippet + +snippet $0 +endsnippet + +snippet $0 +endsnippet diff --git a/UltiSnips/css.snippets b/UltiSnips/css.snippets new file mode 100755 index 0000000..316b064 --- /dev/null +++ b/UltiSnips/css.snippets @@ -0,0 +1,493 @@ +priority -50 + +snippet p "padding" +padding: ${1:0};$0 +endsnippet + +snippet m "margin" +margin: ${1:0};$0 +endsnippet + +snippet bd "border" +border: ${1:0};$0 +endsnippet + +snippet d "display" +display: ${1:none};$0 +endsnippet + +snippet bg "background" +background: ${1:none};$0 +endsnippet + +snippet ff "font-family" +font-family: ${1:"Helvetica Neue", Helvetica, Arial, sans-serif};$0 +endsnippet + +snippet h "height" +height: ${1:auto};$0 +endsnippet + +snippet w "width" +width: ${1:auto};$0 +endsnippet + +snippet pos "position" +position: ${1:relative};$0 +endsnippet + +snippet tt "text-transform" +text-transform: ${1:none};$0 +endsnippet + +snippet ! "!important CSS (!)" +!important +endsnippet + +snippet tsh "text-shadow: color-hex x y blur (text)" +text-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:color}};$0 +endsnippet + +snippet bxsh "box-shadow: color-hex x y blur (text)" +box-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:spread} ${6:color} ${7:inset}};$0 +endsnippet + +# +# Colors +# + +snippet rgb "color rgb" +rgb(${1:255}, ${2:255}, ${3:255})$0 +endsnippet + +snippet rgba "color rgba" +rgba(${1:255}, ${2:255}, ${3:255}, ${4:0.5})$0 +endsnippet + +snippet hsl "color hsl" +hsl(${1:360}, ${2:100}%, ${3:100}%)$0 +endsnippet + +snippet hsla "color hsla" +hsla(${1:360}, ${2:100}%, ${3:100}%, ${4:0.5})$0 +endsnippet + +# +# Selectors +# + +snippet :fc +:first-child +endsnippet + +snippet :lc +:last-child +endsnippet + +snippet :nc +:nth-child($0) +endsnippet + +snippet :nlc +:nth-last-child($0) +endsnippet + +snippet :oc +:only-child +endsnippet + +# +# Pseudo-elements +# + +snippet :a +:after +endsnippet + +snippet :b +:before +endsnippet + +snippet ::a +::after +endsnippet + +snippet ::b +::before +endsnippet + +########################################################################### +# Most of these came from TextMate # +########################################################################### + +snippet background "background-attachment: scroll:fixed (background)" +background-attachment: ${1:scroll/fixed};$0 +endsnippet + +snippet background "background-color: color-hex (background)" +background-color: #${1:DDD};$0 +endsnippet + +snippet background "background-color: color-name (background)" +background-color: ${1:red};$0 +endsnippet + +snippet background "background-color: color-rgb (background)" +background-color: rgb(${1:255},${2:255},${3:255});$0 +endsnippet + +snippet background "background-color: transparent (background)" +background-color: transparent;$0 +endsnippet + +snippet background "background-image: none (background)" +background-image: none;$0 +endsnippet + +snippet background "background-image: url (background)" +background-image: url($1);$0 +endsnippet + +snippet background "background-position: position (background)" +background-position: ${1:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 +endsnippet + +snippet background "background-repeat: r:r-x:r-y:n-r (background)" +background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0 +endsnippet + +snippet background "background: color image repeat attachment position (background)" +background:${6: #${1:DDD}} url($2) ${3:repeat/repeat-x/repeat-y/no-repeat} ${4:scroll/fixed} ${5:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 +endsnippet + +snippet border "border-bottom-color: size style color (border)" +border-bottom-color: #${1:999};$0 +endsnippet + +snippet border "border-bottom-style: size style color (border)" +border-bottom-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-bottom-width: size style color (border)" +border-bottom-width: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-bottom: size style color (border)" +border-bottom: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-color: color (border)" +border-color: ${1:999};$0 +endsnippet + +snippet border "border-left-color: color (border)" +border-right-color: #${1:999};$0 +endsnippet + +snippet border "border-left-style: style (border)" +border-left-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-left-width: size (border)" +border-left-width: ${1:1}px +endsnippet + +snippet border "border-left: size style color (border)" +border-left: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-right-color: color (border)" +border-right-color: #${1:999};$0 +endsnippet + +snippet border "border-right-style: style (border)" +border-right-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-right-width: size (border)" +border-right-width: ${1:1}px +endsnippet + +snippet border "border-right: size style color (border)" +border-right: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-style: style (border)" +border-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-top-color: color (border)" +border-top-color: #${1:999};$0 +endsnippet + +snippet border "border-top-style: style (border)" +border-top-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 +endsnippet + +snippet border "border-top-width: size (border)" +border-top-width: ${1:1}px +endsnippet + +snippet border "border-top: size style color (border)" +border-top: ${1:1}px ${2:solid} #${3:999};$0 +endsnippet + +snippet border "border-width: width (border)" +border-width: ${1:1px};$0 +endsnippet + +snippet border "border: size style color (border)" +border: ${1:1px} ${2:solid} #${3:999};$0 +endsnippet + +snippet clear "clear: value (clear)" +clear: ${1:left/right/both/none};$0 +endsnippet + +snippet color "color: color-hex (color)" +color: #${1:DDD};$0 +endsnippet + +snippet color "color: color-name (color)" +color: ${1:red};$0 +endsnippet + +snippet color "color: color-rgb (color)" +color: rgb(${1:255},${2:255},${3:255});$0 +endsnippet + +snippet cursor "cursor: type (cursor)" +cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0 +endsnippet + +snippet cursor "cursor: url (cursor)" +cursor: url($1);$0 +endsnippet + +snippet direction "direction: ltr|rtl (direction)" +direction: ${1:ltr|rtl};$0 +endsnippet + +snippet display "display: block (display)" +display: block;$0 +endsnippet + +snippet display "display: common-types (display)" +display: ${1:none/inline/block/list-item/run-in/compact/marker};$0 +endsnippet + +snippet display "display: inline (display)" +display: inline;$0 +endsnippet + +snippet display "display: table-types (display)" +display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0 +endsnippet + +snippet float "float: left:right:none (float)" +float: ${1:left/right/none};$0 +endsnippet + +snippet font "font-family: family (font)" +font-family: ${1:Arial, "MS Trebuchet"}, ${2:sans-}serif;$0 +endsnippet + +snippet font "font-size: size (font)" +font-size: ${1:100%};$0 +endsnippet + +snippet font "font-style: normal:italic:oblique (font)" +font-style: ${1:normal/italic/oblique};$0 +endsnippet + +snippet font "font-variant: normal:small-caps (font)" +font-variant: ${1:normal/small-caps};$0 +endsnippet + +snippet font "font-weight: weight (font)" +font-weight: ${1:normal/bold};$0 +endsnippet + +snippet font "font: style variant weight size:line-height font -family (font)" +font: ${1:normal/italic/oblique} ${2:normal/small-caps} ${3:normal/bold} ${4:1em/1.5em} ${5:Arial}, ${6:sans-}serif;$0 +endsnippet + +snippet font "font: size font (font)" +font: ${1:75%} ${2:"Lucida Grande", "Trebuchet MS", Verdana,} ${3:sans-}serif;$0 +endsnippet + +snippet letter "letter-spacing: length-em (letter)" +letter-spacing: $1em;$0 +endsnippet + +snippet letter "letter-spacing: length-px (letter)" +letter-spacing: $1px;$0 +endsnippet + +snippet list "list-style-image: url (list)" +list-style-image: url($1);$0 +endsnippet + +snippet list "list-style-position: pos (list)" +list-style-position: ${1:inside/outside};$0 +endsnippet + +snippet list "list-style-type: asian (list)" +list-style-type: ${1:cjk-ideographic/hiragana/katakana/hiragana-iroha/katakana-iroha};$0 +endsnippet + +snippet list "list-style-type: marker(list)" +list-style-type: ${1:none/disc/circle/square};$0 +endsnippet + +snippet list "list-style-type: numeric (list)" +list-style-type: ${1:decimal/decimal-leading-zero/zero};$0 +endsnippet + +snippet list "list-style-type: other (list)" +list-style-type: ${1:hebrew/armenian/georgian};$0 +endsnippet + +snippet list "list-style-type: roman-alpha-greek (list)" +list-style-type: ${1:lower-roman/upper-roman/lower-alpha/upper-alpha/lower-greek/lower-latin/upper-latin};$0 +endsnippet + +snippet list "list-style: type position image (list)" +list-style: ${1:none/disc/circle/square/decimal/zero} ${2:inside/outside} url($3);$0 +endsnippet + +snippet margin "margin-bottom: length (margin)" +margin-bottom: ${1:20px};$0 +endsnippet + +snippet margin "margin-left: length (margin)" +margin-left: ${1:20px};$0 +endsnippet + +snippet margin "margin-right: length (margin)" +margin-right: ${1:20px};$0 +endsnippet + +snippet margin "margin-top: length (margin)" +margin-top: ${1:20px};$0 +endsnippet + +snippet margin "margin: all (margin)" +margin: ${1:20px};$0 +endsnippet + +snippet margin "margin: T R B L (margin)" +margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 +endsnippet + +snippet margin "margin: V H (margin)" +margin: ${1:20px} ${2:0px};$0 +endsnippet + +snippet marker "marker-offset: auto (marker)" +marker-offset: auto;$0 +endsnippet + +snippet marker "marker-offset: length (marker)" +marker-offset: ${1:10px};$0 +endsnippet + +snippet overflow "overflow: type (overflow)" +overflow: ${1:visible/hidden/scroll/auto};$0 +endsnippet + +snippet padding "padding-bottom: length (margin)" +padding-bottom: ${1:20px};$0 +endsnippet + +snippet padding "padding-left: length (margin)" +padding-left: ${1:20px};$0 +endsnippet + +snippet padding "padding-right: length (margin)" +padding-right: ${1:20px};$0 +endsnippet + +snippet padding "padding-top: length (margin)" +padding-top: ${1:20px};$0 +endsnippet + +snippet padding "padding: T R B L (padding)" +padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 +endsnippet + +snippet padding "padding: V H (padding)" +padding: ${1:20px} ${2:0px};$0 +endsnippet + +snippet padding "padding: all (padding)" +padding: ${1:20px};$0 +endsnippet + +snippet position "position: type (position)" +position: ${1:static/relative/absolute/fixed};$0 +endsnippet + +snippet { "properties { } ( } )" +{ + /* $1 */ + $0 + +endsnippet + +snippet scrollbar "scrollbar" +scrollbar-base-color: ${1:#CCCCCC};${2: +scrollbar-arrow-color: ${3:#000000}; +scrollbar-track-color: ${4:#999999}; +scrollbar-3dlight-color: ${5:#EEEEEE}; +scrollbar-highlight-color: ${6:#FFFFFF}; +scrollbar-face-color: ${7:#CCCCCC}; +scrollbar-shadow-color: ${9:#999999}; +scrollbar-darkshadow-color: ${8:#666666};} +endsnippet + +snippet selection "selection" +$1::-moz-selection, +$1::selection { + color: ${2:inherit}; + background: ${3:inherit}; +} +endsnippet + +snippet text "text-align: left:center:right (txt)" +text-align: ${1:left/right/center/justify};$0 +endsnippet + +snippet text "text-decoration: none:underline:overline:line-through:blink (text)" +text-decoration: ${1:none/underline/overline/line-through/blink};$0 +endsnippet + +snippet text "text-indent: length (text)" +text-indent: ${1:10}px;$0 +endsnippet + +snippet text "text-transform: capitalize:upper:lower (text)" +text-transform: ${1:capitalize/uppercase/lowercase};$0 +endsnippet + +snippet vertical "vertical-align: type (vertical)" +vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0 +endsnippet + +snippet visibility "visibility: type (visibility)" +visibility: ${1:visible/hidden/collapse};$0 +endsnippet + +snippet white "white-space: normal:pre:nowrap (white)" +white-space: ${1:normal/pre/nowrap};$0 +endsnippet + +snippet word "word-spacing: length (word)" +word-spacing: ${1:10px};$0 +endsnippet + +snippet z "z-index: index (z)" +z-index: $1;$0 +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/cuda.snippets b/UltiSnips/cuda.snippets new file mode 100755 index 0000000..2a9a7e5 --- /dev/null +++ b/UltiSnips/cuda.snippets @@ -0,0 +1,5 @@ +priority -50 + +extends cpp + +# vim:ft=snippets: diff --git a/UltiSnips/d.snippets b/UltiSnips/d.snippets new file mode 100755 index 0000000..a9d89b8 --- /dev/null +++ b/UltiSnips/d.snippets @@ -0,0 +1,584 @@ +# Simple shortcuts + +priority -50 + +snippet imp "import (imp)" b +import ${1:std.stdio}; +endsnippet + +snippet pimp "public import (pimp)" b +public import ${1:/*module*/}; +endsnippet + +snippet over "override (over)" b +override ${1:/*function*/} +endsnippet + +snippet al "alias (al)" +alias ${1:/*orig*/} ${2:/*alias*/}; +endsnippet + +snippet mixin "mixin (mixin)" b +mixin ${1:/*mixed_in*/} ${2:/*name*/}; +endsnippet + +snippet new "new (new)" +new $1($2); +endsnippet + +snippet scpn "@safe const pure nothrow (scpn)" +@safe const pure nothrow +endsnippet + +snippet spn "@safe pure nothrow (spn)" +@safe pure nothrow +endsnippet + +snippet cont "continue (cont)" +continue; +endsnippet + +snippet dis "@disable (dis)" b +@disable ${1:/*method*/}; +endsnippet + +snippet pub "public (pub)" b +public: + ${1:/*members*/} +endsnippet + +snippet priv "private (priv)" b +private: + ${1:/*members*/} +endsnippet + +snippet prot "protected (prot)" b +protected: + ${1:/*members*/} +endsnippet + +snippet pack "package (pack)" b +package: + ${1:/*members*/} +endsnippet + +snippet ret "return (ret)" +return ${1:/*value to return*/}; +endsnippet + +snippet auto "auto (auto)" b +auto ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet con "const (con)" b +const ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet siz "size_t (siz)" b +size_t ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet sup "super (sup)" b +super(${1:/*args*/}); +endsnippet + +# Phobos + +snippet tup "tuple (tup)" +tuple(${1:/*args*/}) +endsnippet + +snippet wr "writeln (wr)" +writeln(${1:/*args*/}); +endsnippet + +snippet to "to (to)" +to!(${1:/*type*/})(${2:/*arg*/}) +endsnippet + +snippet enf "enforce (enf)" b +enforce(${1:/*condition*/}, + new $2Exception(${3:/*args*/})); +endsnippet + +# Branches + +snippet if "if .. (if)" +if(${1:/*condition*/}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet ife "if .. else (ife)" b +if(${1:/*condition*/}) +{ + $2 +} +else +{ + ${3:/*else*/} +} +endsnippet + +snippet el "else (el)" b +else +{ + ${VISUAL}$1 +} +endsnippet + +snippet elif "else if (elif)" b +else if(${1:/*condition*/}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet sw "switch (sw)" +switch(${1:/*var*/}) +{ + case ${2:/*value*/}: + $3 + break; + case ${4:/*value*/}: + $5 + break; + ${7:/*more cases*/} + default: + ${6:assert(false);} +} +endsnippet + +snippet fsw "final switch (fsw)" +final switch(${1:/*var*/}) +{ + case ${2:/*value*/}: + $3 + break; + case ${4:/*value*/}: + $5 + break; + ${7:/*more cases*/} +} +endsnippet + +snippet case "case (case)" b +case ${1:/*value*/}: + $2 + break; +endsnippet + +snippet ?: "ternary operator (?:)" +${1:/*condition*/} ? ${2:/*then*/} : ${3:/*else*/}$4 +endsnippet + +# Loops + +snippet do "do while (do)" b +do +{ + ${VISUAL}$2 +} while(${1:/*condition*/}); +endsnippet + +snippet wh "while (wh)" b +while(${1:/*condition*/}) +{ + ${VISUAL}$2 +} +endsnippet + +snippet for "for (for)" b +for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet forever "forever (forever)" b +for(;;) +{ + ${VISUAL}$0 +} +endsnippet + +snippet fore "foreach (fore)" +foreach(${1:/*elem*/}; ${2:/*range*/}) +{ + ${VISUAL}$3 +} +endsnippet + +snippet forif "foreach if (forif)" b +foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) +{ + ${VISUAL}$4 +} +endsnippet + +# Contracts +snippet in "in contract (in)" b +in +{ + assert(${1:/*condition*/}, "${2:error message}"); + $3 +} +body +endsnippet + +snippet out "out contract (out)" b +out${1:(result)} +{ + assert(${2:/*condition*/}, "${3:error message}"); + $4 +} +body +endsnippet + +snippet inv "invariant (inv)" b +invariant() +{ + assert(${1:/*condition*/}, "${2:error message}"); + $3 +} +endsnippet + +# Functions (generic) + +snippet fun "function definition (fun)" +${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} +{ + ${VISUAL}$5 +} +endsnippet + +snippet void "void function definition (void)" +void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} +{ + ${VISUAL}$4 +} +endsnippet + +snippet this "ctor (this)" w +this(${1:/*args*/}) +{ + ${VISUAL}$2 +} +endsnippet + +snippet get "getter property (get)" +@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};} +endsnippet + +snippet set "setter property (set)" +@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;} +endsnippet + +# Functions (concrete) + +snippet main "Main" b +void main(string[] args) +{ + ${VISUAL}${0: /*code*/} +} +endsnippet + +# Mixins + +snippet signal "signal (signal)" b +mixin Signal!(${1:/*args*/}) ${2:/*name*/}; +endsnippet + +# Scope + +snippet scope "scope (scope)" b +scope(${1:exit}) +{ + ${VISUAL}$2 +} +endsnippet + +# With + +snippet with "with (with)" +with($1) +{ + ${VISUAL}$2 +} +endsnippet + +# Exception handling + +snippet try "try/catch (try)" b +try +{ + ${VISUAL}${1:/*code to try*/} +} +catch($2Exception e) +{ + ${3:/*handle exception*/} +} +endsnippet + +snippet tryf "try/catch/finally (tryf)" b +try +{ + ${VISUAL}${1:/*code to try*/} +} +catch($2Exception e) +{ + ${3:/*handle exception*/} +} +finally +{ + ${4:/*cleanup*/} +} +endsnippet + +snippet catch "catch (catch)" b +catch($1Exception e) +{ + ${2:/*handle exception*/} +} +endsnippet + +snippet thr "throw (thr)" +throw new $1Exception("$2"); +endsnippet + + +# Type declarations + +snippet struct "struct (struct)" +struct ${1:`!p snip.rv = (snip.basename or "name")`} +{ + $2 +} +endsnippet + +snippet union "union (union)" +union ${1:`!p snip.rv = (snip.basename or "name")`} +{ + $2 +} +endsnippet + +snippet class "class (class)" +class ${1:`!p snip.rv = (snip.basename or "name")`} +{ + $2 +} +endsnippet + +snippet inter "interface (inter)" +interface ${1:`!p snip.rv = (snip.basename or "name")`} +{ + $2 +} +endsnippet + +snippet enum "enum (enum)" +enum ${1:`!p snip.rv = (snip.basename or "name")`} +{ + $2 +} +endsnippet + + +# Exception declarations + +snippet exc "exception declaration (exc)" b +/// ${3:/*documentation*/} +class $1Exception : $2Exception +{ + public this(string msg, string file = __FILE__, int line = __LINE__) + { + super(msg, file, line); + } +} +endsnippet + + +# Conditional compilation + +snippet version "version (version)" b +version(${1:/*version name*/}) +{ + ${VISUAL}$2 +} +endsnippet + +snippet debug "debug" b +debug +{ + ${VISUAL}$1 +} +endsnippet + + +# Templates + +snippet temp "template (temp)" b +template ${2:/*name*/}(${1:/*args*/}) +{ + $3 +} +endsnippet + + +# Asserts + +snippet ass "assert (ass)" b +assert(${1:false}, "${2:TODO}"); + +endsnippet + + +# Unittests + +snippet unittest "unittest (unittest)" b +unittest +{ + $1 +} +endsnippet + + +# Common member functions + +snippet opDis "opDispatch (opDis)" b +${1:/*return type*/} opDispatch(string s)() +{ + $2; +} +endsnippet + +snippet op= "opAssign (op=)" b +void opAssign($1 rhs) ${2:@safe pure nothrow} +{ + $2 +} +endsnippet + +snippet opCmp "opCmp (opCmp)" b +int opCmp($1 rhs) @safe const pure nothrow +{ + $2 +} +endsnippet + +snippet opApply "opApply (opApply)" b +int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg) +{ + int result = 0; + ${2:/*loop*/} + { + result = dg(${3:/*arg/s*/}); + if(result){break;} + } + return result; +} +endsnippet + +snippet toString "toString (toString)" b +string toString() @safe const pure nothrow +{ + $1 +} +endsnippet + + +# Comments + + +snippet todo "TODO (todo)" +// TODO: $1 +endsnippet + + +# DDoc + +snippet doc "generic ddoc block (doc)" b +/// ${1:description} +/// +/// ${2:details} +endsnippet + +snippet fdoc "function ddoc block (fdoc)" b +/// ${1:description} +/// +/// ${2:Params: ${3:param} = ${4:param description} +/// $5} +/// +/// ${6:Returns: ${7:return value}} +/// +/// ${8:Throws: $9Exception $10} +endsnippet + +snippet Par "Params (Par)" +Params: ${1:param} = ${2:param description} +/// $3 +endsnippet + +snippet Ret "Returns (Ret)" +Returns: ${1:return value/s} +endsnippet + +snippet Thr "Throws (Thr)" +Throws: $1Exception $2 +endsnippet + +snippet Example "Examples (Example)" +Examples: +/// -------------------- +/// ${1:example code} +/// -------------------- +endsnippet + + +# License blocks + +snippet gpl "GPL (gpl)" b +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// Copyright (C) ${1:Author}, `!v strftime("%Y")` + +$2 +endsnippet + +snippet boost "Boost (boost)" b +// Copyright ${1:Author} `!v strftime("%Y")`. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +$2 +endsnippet + + +# New module + +snippet module "New module (module)" b +// Copyright ${1:Author} `!v strftime("%Y")`. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +module $2.`!v vim_snippets#Filename('$1', 'name')`; + + +$3 +endsnippet diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets new file mode 100755 index 0000000..a03cf1e --- /dev/null +++ b/UltiSnips/django.snippets @@ -0,0 +1,360 @@ +priority -50 + +# This files will define django snippets from sublime text djaneiro +# FORMS SNIPPETS + +snippet form "Form" b +class ${1:FORMNAME}(forms.Form): + + ${2:# TODO: Define form fields here} +endsnippet + +snippet modelform "ModelForm" b +class ${1:MODELNAME}Form(forms.ModelForm): + + class Meta: + model = $1 +endsnippet + +snippet fbool "BooleanField" b +${1:FIELDNAME} = forms.BooleanField($2) +endsnippet + +snippet fchar "CharField" b +${1:FIELDNAME} = forms.CharField($2) +endsnippet + +snippet fchoice "ChoiceField" b +${1:FIELDNAME} = forms.ChoiceField($2) +endsnippet + +snippet fcombo "ComboField" b +${1:FIELDNAME} = forms.ComboField($2) +endsnippet + +snippet fdate "DateField" b +${1:FIELDNAME} = forms.DateField($2) +endsnippet + +snippet fdatetime "DateTimeField" b +${1:FIELDNAME} = forms.DateTimeField($2) +endsnippet + +snippet fdecimal "DecimalField" b +${1:FIELDNAME} = forms.DecimalField($2) +endsnippet + +snippet fmail "EmailField" b +${1:FIELDNAME} = forms.EmailField($2) +endsnippet + +snippet ffile "FileField" b +${1:FIELDNAME} = forms.FileField($2) +endsnippet + +snippet ffilepath "FilePathField" b +${1:FIELDNAME} = forms.FilePathField($2) +endsnippet + +snippet ffloat "FloatField" b +${1:FIELDNAME} = forms.FloatField($2) +endsnippet + +snippet fip "IPAddressField" b +${1:FIELDNAME} = forms.IPAddressField($2) +endsnippet + +snippet fimg "ImageField" b +${1:FIELDNAME} = forms.ImageField($2) +endsnippet + +snippet fint "IntegerField" b +${1:FIELDNAME} = forms.IntegerField($2) +endsnippet + +snippet fmochoice "ModelChoiceField" b +${1:FIELDNAME} = forms.ModelChoiceField($2) +endsnippet + +snippet fmomuchoice "ModelMultipleChoiceField" b +${1:FIELDNAME} = forms.ModelMultipleChoiceField($2) +endsnippet + +snippet fmuval "MultiValueField" b +${1:FIELDNAME} = forms.MultiValueField($2) +endsnippet + +snippet fmuchoice "MultipleChoiceField" b +${1:FIELDNAME} = forms.MultipleChoiceField($2) +endsnippet + +snippet fnullbool "NullBooleanField" b +${1:FIELDNAME} = forms.NullBooleanField($2) +endsnippet + +snippet freg "RegexField" b +${1:FIELDNAME} = forms.RegexField($2) +endsnippet + +snippet fslug "SlugField" b +${1:FIELDNAME} = forms.SlugField($2) +endsnippet + +snippet fsdatetime "SplitDateTimeField" b +${1:FIELDNAME} = forms.SplitDateTimeField($2) +endsnippet + +snippet ftime "TimeField" b +${1:FIELDNAME} = forms.TimeField($2) +endsnippet + +snippet ftchoice "TypedChoiceField" b +${1:FIELDNAME} = forms.TypedChoiceField($2) +endsnippet + +snippet ftmuchoice "TypedMultipleChoiceField" b +${1:FIELDNAME} = forms.TypedMultipleChoiceField($2) +endsnippet + +snippet furl "URLField" b +${1:FIELDNAME} = forms.URLField($2) +endsnippet + +# MODELS SNIPPETS + +snippet model "Model" b +class ${1:MODELNAME}(models.Model): + $0 + class Meta: + verbose_name = "$1" + verbose_name_plural = "$1s" + + def __str__(self): + return super($1, self).__str__() + +endsnippet + +snippet modelfull "Model" b +class ${1:MODELNAME}(models.Model): + ${2:# TODO: Define fields here} + + class Meta: + verbose_name = "$1" + verbose_name_plural = "$1s" + + def __str__(self): + return super($1, self).__str__() + + def save(self): + return super($1, self).save() + + def get_absolute_url(self): + return ('') + + ${3:# TODO: Define custom methods here} + +endsnippet + +snippet mauto "AutoField" b +${1:FIELDNAME} = models.AutoField($2) +endsnippet + +snippet mbigint "BigIntegerField" b +${1:FIELDNAME} = models.BigIntegerField($2) +endsnippet + +snippet mbool "BooleanField" b +${1:FIELDNAME} = models.BooleanField($2) +endsnippet + +snippet mchar "CharField" b +${1:FIELDNAME} = models.CharField($2, max_length=${3:50}) +endsnippet + +snippet mcoseint "CommaSeparatedIntegerField" b +${1:FIELDNAME} = models.CommaSeparatedIntegerField($2) +endsnippet + +snippet mdate "DateField" b +${1:FIELDNAME} = models.DateField($2) +endsnippet + +snippet mdatetime "DateTimeField" b +${1:FIELDNAME} = models.DateTimeField($2) +endsnippet + +snippet mdecimal "DecimalField" b +${1:FIELDNAME} = models.DecimalField(max_digits=${2:10}, decimal_places=${3:2}) +endsnippet + +snippet memail "EmailField" b +${1:FIELDNAME} = models.EmailField($2) +endsnippet + +snippet mfile "FileField" b +${1:FIELDNAME} = models.FileField($2) +endsnippet + +snippet mfilepath "FilePathField" b +${1:FIELDNAME} = models.FilePathField($2) +endsnippet + +snippet mfloat "FloatField" b +${1:FIELDNAME} = models.FloatField($2) +endsnippet + +snippet fk "ForeignKey" b +${1:FIELDNAME} = models.ForeignKey($2) +endsnippet + +snippet mip "IPAddressField" b +${1:FIELDNAME} = models.IPAddressField($2) +endsnippet + +snippet mimg "ImageField" b +${1:FIELDNAME} = models.ImageField($2) +endsnippet + +snippet mint "IntegerField" b +${1:FIELDNAME} = models.IntegerField($2) +endsnippet + +snippet m2m "ManyToManyField" b +${1:FIELDNAME} = models.ManyToManyField($2) +endsnippet + +snippet mnullbool "NullBooleanField" b +${1:FIELDNAME} = models.NullBooleanField($2) +endsnippet + +snippet o2o "OneToOneField" b +${1:FIELDNAME} = models.OneToOneField($2) +endsnippet + +snippet mphone "PhoneNumberField" b +${1:FIELDNAME} = models.PhoneNumberField($2) +endsnippet + +snippet mposint "PositiveIntegerField" b +${1:FIELDNAME} = models.PositiveIntegerField($2) +endsnippet + +snippet mpossmallint "PositiveSmallIntegerField" b +${1:FIELDNAME} = models.PositiveSmallIntegerField($2) +endsnippet + +snippet mslug "SlugField" b +${1:FIELDNAME} = models.SlugField($2) +endsnippet + +snippet msmallint "SmallIntegerField" b +${1:FIELDNAME} = models.SmallIntegerField($2) +endsnippet + +snippet mtext "TextField" b +${1:FIELDNAME} = models.TextField($2) +endsnippet + +snippet mtime "TimeField" b +${1:FIELDNAME} = models.TimeField($2) +endsnippet + +snippet murl "URLField" b +${1:FIELDNAME} = models.URLField($2) +endsnippet + +snippet musstate "USStateField" b +${1:FIELDNAME} = models.USStateField($2) +endsnippet + +snippet mxml "XMLField" b +${1:FIELDNAME} = models.XMLField($2) +endsnippet + +# VIEWS SNIPPETS + +snippet adminview "Model Admin View" b +class $1Admin(admin.ModelAdmin): + ''' + Admin View for $1 + ''' + list_display = ('$2',) + list_filter = ('$3',) + inlines = [ + $4Inline, + ] + raw_id_fields = ('$5',) + readonly_fields = ('$6',) + search_fields = ['$7'] +admin.site.register($1, $1Admin) +endsnippet + +snippet createview "Generic Create View" b +class ${1:MODEL_NAME}CreateView(CreateView): + model = $1 + template_name = "${2:TEMPLATE_NAME}" +endsnippet + +snippet deleteview "Generic Delete View" b +class ${1:MODEL_NAME}DeleteView(DeleteView): + model = $1 + template_name = "${2:TEMPLATE_NAME}" +endsnippet + +snippet detailview "Generic Detail View" b +class ${1:MODEL_NAME}DetailView(DetailView): + model = $1 + template_name = "${2:TEMPLATE_NAME}" +endsnippet + +snippet listview "Generic List View" b +class ${1:MODEL_NAME}ListView(ListView): + model = $1 + template_name = "${2:TEMPLATE_NAME}" +endsnippet + +snippet stackedinline "Stacked Inline" b +class $1Inline(admin.StackedInline): + ''' + Stacked Inline View for $1 + ''' + model = ${2:$1} + min_num = ${3:3} + max_num = ${4:20} + extra = ${5:1} + raw_id_fields = ($6,) +endsnippet + +snippet tabularinline "Tabular Inline" b +class $1Inline(admin.TabularInline): + ''' + Tabular Inline View for $1 + ''' + model = ${2:$1} + min_num = ${3:3} + max_num = ${4:20} + extra = ${5:1} + raw_id_fields = ($6,) +endsnippet + +snippet templateview "Generic Template View" b +class ${1:CLASS_NAME}(TemplateView): + template_name = "${2:TEMPLATE_NAME}" +endsnippet + +snippet updateview "Generic Update View" b +class ${1:MODEL_NAME}UpdateView(UpdateView): + model = $1 + template_name = "${2:TEMPLATE_NAME}" +endsnippet + +snippet dispatch "Dispatch View method" b +def dispatch(self, request, *args, **kwargs): + return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs) +endsnippet + +snippet context "get_context_data view method" b +def get_context_data(self, **kwargs): + kwargs['extra_context'] = ${1:'New Value'} + return super(${2:CLASS_NAME}, self).get_context_data(**kwargs) +endsnippet diff --git a/UltiSnips/eelixir.snippets b/UltiSnips/eelixir.snippets new file mode 100755 index 0000000..3c490db --- /dev/null +++ b/UltiSnips/eelixir.snippets @@ -0,0 +1,43 @@ +priority -50 + +extends html + +snippet % "<% %>" w +<% $0 %> +endsnippet + +snippet = "<%= %>" w +<%= $0 %> +endsnippet + +snippet end "<% end %>" w +<% end %> +endsnippet + +snippet for +<%= for ${1:item} <- ${2:$1s} ${3:@conn} do %> + $0 +<% end %> +endsnippet + +snippet ft "form_tag" w +<%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %> + $0 + +endsnippet + +snippet lin "link" w +<%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %> +endsnippet + +snippet ff "form_for" w +<%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %> + $0 + + <%= submit "Submit" %> +<% end %> +endsnippet + +snippet gt "gettext" w +<%= gettext("${0:${VISUAL}}") %> +endsnippet diff --git a/UltiSnips/ejs.snippets b/UltiSnips/ejs.snippets new file mode 100755 index 0000000..1e3c004 --- /dev/null +++ b/UltiSnips/ejs.snippets @@ -0,0 +1,10 @@ +snippet for "ejs for loop" b +<% for (let ${1:i = 0}; ${2:i + ${0:body} +<% } %> +endsnippet +snippet forE "ejs for Each loop" b +<% ${1:array}.forEach((${2:single var}) => { %> + ${0:body} +<% }) %> +endsnippet diff --git a/UltiSnips/elm.snippets b/UltiSnips/elm.snippets new file mode 100755 index 0000000..6e21bb5 --- /dev/null +++ b/UltiSnips/elm.snippets @@ -0,0 +1,9 @@ +priority -50 + +snippet impa "Qualified import" +import ${1:Json.Encode} as ${0:`!p snip.rv = t[1].split(".")[-1]`} +endsnippet + +snippet impae "Qualified import with exposing" +import ${1:Json.Encode} as ${2:`!p snip.rv = t[1].split(".")[-1]`} exposing (${0:Value}) +endsnippet diff --git a/UltiSnips/erlang.snippets b/UltiSnips/erlang.snippets new file mode 100755 index 0000000..0ac9f5c --- /dev/null +++ b/UltiSnips/erlang.snippets @@ -0,0 +1,24 @@ +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### + +priority -50 + +snippet pat "Case:Receive:Try Clause" +${1:pattern}${2: when ${3:guard}} -> + ${4:body} +endsnippet + +snippet mod "Module Directive" b +-module(${1:`!p snip.rv = snip.basename or "module"`}). +endsnippet + +snippet || "List Comprehension" +[${1:X} || ${2:X} <- ${3:List}${4:, gen}] +endsnippet + +snippet gen "Generator Expression" +${1:X} <- ${2:List}${3:, gen} +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/eruby.snippets b/UltiSnips/eruby.snippets new file mode 100755 index 0000000..8d97277 --- /dev/null +++ b/UltiSnips/eruby.snippets @@ -0,0 +1,237 @@ +extends html + +priority -50 + +# TextMate added these variables to cope with changes in ERB handling +# in different versions of Rails -- for instance, Rails 3 automatically +# strips whitespace so that it's no longer necessary to use a form like +# <% end -%>, but if you're still maintaining Rails 2 projects, you +# can't omit the minus sign and get the same behavior. +# +# The following regex replace substitutes the function below for the +# TextMate variable references after the snippets are converted: +# +# /\v\$\{(TM_RAILS_TEMPLATE_([^_]+)_RUBY_([^_\s]+))\}/`!p textmate_var('\1', snip)`/g +# +global !p +def textmate_var(var, snip): + lookup = dict( + TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '), + TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'), + TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '), + TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'), + TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>' + ) + snip.rv = lookup[var] + return +endglobal + + +snippet % "<% $0 %>" i +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` +endsnippet + +snippet = "<%= $0 %>" i +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +########################################################################### +# GENERATED FROM get_tm_snippets.py + REGEX REPLACE # +########################################################################### + +snippet fi "<%= Fixtures.identify(:symbol) %>" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`Fixtures.identify(:${1:name})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`$0 +endsnippet + +snippet ft "form_tag" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1:action: '${2:update}'}${3:, ${4:${5:class}: '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet ffs "form_for submit 2" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, disable_with: '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f_fields_for (nff)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`f.fields_for :${1:attribute} do |${2:f}|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet f. "f.checkbox" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.file_field" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.hidden_field" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.label" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.password_field" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.radio_button" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_button :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.submit" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, disable_with: '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.text_area" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet f. "f.text_field" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet ffe "form_for with errors" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet ff "form_for" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + $0 +`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` +endsnippet + +snippet ist "image_submit_tag" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, id: "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, name: "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, class: "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, disabled: ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet it "image_tag" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, title: "${5:title}"}${6:, class: "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet layout "layout" +layout "${1:template_name}"${2:${3:, only: ${4:[:${5:action}, :${6:action}]}}${7:, except: ${8:[:${9:action}, :${10:action}]}}} +endsnippet + +snippet jit "javascript_include_tag" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lt "link_to (name, dest)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", ${2:dest}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lia "link_to (action)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet liai "link_to (action, id)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:edit}", id: ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lic "link_to (controller)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lica "link_to (controller, action)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet licai "link_to (controller, action, id)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:edit}", id: ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet linpp "link_to (nested path plural)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:$10})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet linp "link_to (nested path)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lipp "link_to (path plural)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${4:model}s_path}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lip "link_to (path)" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:$12})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet lim "link_to model" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:model}.${2:name}, ${3:${4:$1}_path(${14:$1})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet hide "page.hide (*ids)" +page.hide ${1:"${2:id(s)}"} +endsnippet + +snippet ins "page.insert_html (position, id, partial)" +page.insert_html :${1:top}, ${2:"${3:id}"}, ${4:partial: "${5:template}"} +endsnippet + +snippet rep "page.replace (id, partial)" +page.replace ${1:"${2:id}"}, ${3:partial: "${4:template}"} +endsnippet + +snippet reph "page.replace_html (id, partial)" +page.replace_html ${1:"${2:id}"}, ${3:partial: "${4:template}"} +endsnippet + +snippet show "page.show (*ids)" +page.show ${1:"${2:id(s)}"} +endsnippet + +snippet tog "page.toggle (*ids)" +page.toggle ${1:"${2:id(s)}"} +endsnippet + +snippet vis "page.visual_effect (effect, id)" +page.visual_effect :${1:toggle_slide}, ${2:"${3:DOM ID}"} +endsnippet + +snippet rp "render (partial) (rp)" +render partial: "${1:item}" +endsnippet + +snippet rpc "render (partial,collection) (rpc)" +render partial: "${1:item}", collection: ${2:@$1s} +endsnippet + +snippet rpl "render (partial,locals) (rpl)" +render partial: "${1:item}", locals: { ${2:$1}: ${3:@$1}$0 } +endsnippet + +snippet rpo "render (partial,object) (rpo)" +render partial: "${1:item}", object: ${2:@$1} +endsnippet + +snippet rps "render (partial,status) (rps)" +render partial: "${1:item}", status: ${2:500} +endsnippet + +snippet slt "stylesheet_link_tag" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet st "submit_tag" w +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, id: "${3:submit}"}${4:, name: "${5:$3}"}${6:, class: "${7:form_$3}"}${8:, disabled: ${9:false}}${10:, disable_with: "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +snippet else "else (ERB)" +<% else %> + $0 +endsnippet + +snippet lf "link_to_function" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/gitcommit.snippets b/UltiSnips/gitcommit.snippets new file mode 100755 index 0000000..e2f1ba5 --- /dev/null +++ b/UltiSnips/gitcommit.snippets @@ -0,0 +1,130 @@ +global !p +def complete(t, opts): + if t: + opts = [ m[len(t):] for m in opts if m.startswith(t) ] + if len(opts) == 1: + return opts[0] + return '(' + '|'.join(opts) + ')' +endglobal + +snippet status "Status" bA +status $1`!p snip.rv = complete(t[1], ['build', 'ci', 'test', 'refactor', 'perf', 'improvement', 'docs', 'chore', 'feat', 'fix'])` +endsnippet + +snippet fix "fix conventional commit" +fix(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet feat "feat conventional commit" +feat(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet chore "chore conventional commit" +chore(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet docs "docs conventional commit" +docs(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet improvement "improvement conventional commit" +improvement(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet perf "perf conventional commit" +perf(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet refactor "refactor conventional commit" +refactor(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet test "test conventional commit" +test(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet ci "ci conventional commit" +ci(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet build "build conventional commit" +build(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet sign "Signature" +------------------------------------------------------------------------------- +${1:Company Name} + +${2:Author Name} + +${3:Streetname 21} +${4:City and Area} + +${5:Tel: +44 (0)987 / 888 8888} +${6:Fax: +44 (0)987 / 888 8882} +${7:Mail: Email} +${8:Web: https://} +------------------------------------------------------------------------------- +$0 +endsnippet + +snippet t "Todo" +TODO: ${1:What is it} (`date "+%b %d %Y %a (%H:%M:%S)"`, `echo $USER`) +$0 +endsnippet + +snippet cmt "Commit Structure" bA +${1:Summarize changes in around 50 characters or less} + +${2:More detailed explanatory text, if necessary. Wrap it to about 72 +characters or so. In some contexts, the first line is treated as the +subject of the commit and the rest of the text as the body. The +blank line separating the summary from the body is critical (unless +you omit the body entirely); various tools like `log`, `shortlog` +and `rebase` can get confused if you run the two together.} + +${3:Explain the problem that this commit is solving. Focus on why you +are making this change as opposed to how (the code explains that). +Are there side effects or other unintuitive consequences of this +change? Here's the place to explain them.} + +${4:Further paragraphs come after blank lines. + + - Bullet points are okay, too + + - Typically a hyphen or asterisk is used for the bullet, preceded + by a single space, with blank lines in between, but conventions + vary here} + +${5:Status} + +${6:If you use an issue tracker, put references to them at the bottom, +like this.} + +${7:Any todos} + +${8:Resolves: #123 +See also: #456, #789} + +${9:Signature} +endsnippet diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets new file mode 100755 index 0000000..35cf909 --- /dev/null +++ b/UltiSnips/go.snippets @@ -0,0 +1,115 @@ +# Snippets for Go + +priority -50 + +# when to abbriviate and when not? +# b doesn't work here, because it ignores whitespace +# optional local name? +snippet /^import/ "Import declaration" r +import ( + "${1:package}" +) +endsnippet + +snippet /^package/ "Package declaration" r +// Package $1 provides ... +package ${1:main} +endsnippet + +# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle +snippet /^cons/ "Constants declaration" r +const ( + ${1:constant}${2/(.+)/ /}${2:type} = ${0:value} +) +endsnippet + +snippet /^con/ "Constant declaration" r +const ${1:name}${2/(.+)/ /}${2:type} = ${0:value} +endsnippet + +snippet iota "Iota constant generator" b +const ( + ${1:constant}${2/(.+)/ /}${2:type} = iota +) +endsnippet + +snippet struct "Struct declaration" b +type ${1:Struct} struct { + ${0:${VISUAL}} +} +endsnippet + +snippet interface "Interface declaration" b +type ${1:Interface} interface { + ${0:${VISUAL}} +} +endsnippet + +snippet if "If statement" b +if ${1:condition}${1/(.+)/ /}{ + ${0:${VISUAL}} +} +endsnippet + +snippet switch "Switch statement" b +switch ${1:expression}${1/(.+)/ /}{ +case$0 +} +endsnippet + +# functions +snippet /^main/ "Main function" r +func main() { + ${0:${VISUAL}} +} +endsnippet + +snippet /^meth/ "Method" r +func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { + ${0:${VISUAL}} +} +endsnippet + +snippet func "Function" b +func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { + ${0:${VISUAL}} +} +endsnippet + +snippet funch "HTTP handler" b +func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) { + ${0:${VISUAL}} +} +endsnippet + +# types and variables +snippet map "Map type" b +map[${1:keytype}]${2:valtype} +endsnippet + +snippet : "Variable declaration :=" b +${1:name} := ${0:value} +endsnippet + +snippet var "Variable declaration" b +var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} +endsnippet + +snippet vars "Variables declaration" b +var ( + ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } +) +endsnippet + +snippet json "JSON field" +\`json:"${1:displayName}"\` +endsnippet + +# vim:ft=snippets: + +# error handling +snippet err "Basic error handling" b +if err != nil { + log.${1:Fatal}(err) +} +endsnippet diff --git a/UltiSnips/haskell.snippets b/UltiSnips/haskell.snippets new file mode 100755 index 0000000..ed83271 --- /dev/null +++ b/UltiSnips/haskell.snippets @@ -0,0 +1,13 @@ +priority -50 + +snippet imp "Simple import" +import ${1:${2:Data}.${0:Text}} +endsnippet + +snippet imp2 "Selective import" b +import ${1:${2:Data}.${3:Text}} (${4})${0} +endsnippet + +snippet impq "Qualified import" +import qualified ${1:${2:Data}.${3:Text}} as ${0:`!p snip.rv = t[1].split(".")[-1]`} +endsnippet diff --git a/UltiSnips/help.snippets b/UltiSnips/help.snippets new file mode 100755 index 0000000..b07a7de --- /dev/null +++ b/UltiSnips/help.snippets @@ -0,0 +1,37 @@ +# Snippets for VIM Help Files + +priority -50 + +global !p +def sec_title(snip, t): + file_start = snip.fn.split('.')[0] + sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') + return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) +endglobal + +snippet sec "Section marker" b +============================================================================== +${1:SECTION}`!p snip.rv = sec_title(snip, t)` + +$0 +endsnippet + +snippet ssec "Sub section marker" b +${1:Subsection}`!p snip.rv = sec_title(snip, t) +snip += "-"*len(t[1])` + +$0 +endsnippet + +snippet sssec "Subsub Section marker" b +${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)` + +$0 +endsnippet + +# For vim help, follow the same settings as the official docs. +snippet modeline "Vim help modeline" + `!v 'vim'`:tw=78:ts=8:ft=help:norl: +endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets new file mode 100755 index 0000000..75eff90 --- /dev/null +++ b/UltiSnips/html.snippets @@ -0,0 +1,534 @@ +priority -50 + +########################################################################### +# TextMate Snippets # +########################################################################### + +global !p +def x(snip): + if snip.ft.startswith("x"): + snip.rv = '/' + else: + snip.rv = "" +endglobal + +snippet doctype "HTML - 5.0 (doctype)" b + + +endsnippet + +############# +# Shortcuts # +############# +snippet down "Down (down)" +↓ +endsnippet + +snippet enter "Enter (enter)" +⌅ +endsnippet + +snippet escape "Escape (escape)" +⎋ +endsnippet + +snippet left "Left (left)" +← +endsnippet + +snippet return "Return (return)" +↩ +endsnippet + +snippet right "Right (right)" +→ +endsnippet + +snippet shift "Shift (shift)" +⇧ +endsnippet + +snippet tab "Tab (tab)" +⇥ +endsnippet + +snippet up "Up (up)" +↑ +endsnippet + +############# +# HTML TAGS # +############# +snippet a "Link" w +${4:Anchor Text} +endsnippet + +snippet abbr "" w +$1 +endsnippet + +snippet access "accesskey global attribute" +accesskey="$1" +endsnippet + +snippet address "

" w +
$1
+endsnippet + +snippet article "
" +
+ ${1:article content} +
+endsnippet + +snippet aside "