├── .gitignore ├── .travis.yml ├── AUTHORS ├── LICENSE ├── README.md ├── UltiSnips ├── README ├── ada.snippets ├── all.snippets ├── bib.snippets ├── bindzone.snippets ├── blade.snippets ├── c.snippets ├── coffee-jasmine.snippets ├── coffee-react.snippets ├── coffee.snippets ├── cpp.snippets ├── crystal.snippets ├── cs.snippets ├── css.snippets ├── cuda.snippets ├── d.snippets ├── django.snippets ├── eelixir.snippets ├── ejs.snippets ├── elm.snippets ├── erlang.snippets ├── eruby.snippets ├── gitcommit.snippets ├── go.snippets ├── haskell.snippets ├── help.snippets ├── html.snippets ├── html_minimal.snippets ├── htmldjango.snippets ├── htmljinja.snippets ├── java.snippets ├── javascript-angular.snippets ├── javascript-ember.snippets ├── javascript-jasmine-arrow.snippets ├── javascript-jsdoc.snippets ├── javascript-node.snippets ├── javascript.snippets ├── javascript_react.snippets ├── jinja2.snippets ├── json.snippets ├── julia.snippets ├── ledger.snippets ├── lhaskell.snippets ├── lua.snippets ├── mako.snippets ├── markdown.snippets ├── matlab.snippets ├── objc.snippets ├── ocaml.snippets ├── octave.snippets ├── pandoc.snippets ├── perl.snippets ├── php-laravel.snippets ├── php-phpspec.snippets ├── php-symfony2.snippets ├── php.snippets ├── plsql.snippets ├── proto.snippets ├── puppet.snippets ├── python.snippets ├── r.snippets ├── rails.snippets ├── rnoweb.snippets ├── robot.snippets ├── rst.snippets ├── ruby.snippets ├── rust.snippets ├── sh.snippets ├── smarty.snippets ├── snippets.snippets ├── soy.snippets ├── supercollider.snippets ├── svelte.snippets ├── tcl.snippets ├── tex.snippets ├── texmath.snippets ├── typescript.snippets ├── typescript_react.snippets ├── vim.snippets ├── vue.snippets ├── xhtml.snippets ├── xml.snippets └── zsh.snippets ├── addon-info.json ├── autoload └── vim_snippets.vim ├── plugin └── vimsnippets.vim ├── pythonx ├── javascript_snippets.py └── vimsnippets.py ├── snippets ├── _.snippets ├── actionscript.snippets ├── ada.snippets ├── all.snippets ├── alpaca.snippets ├── apache.snippets ├── arduino.snippets ├── asm.snippets ├── autoit.snippets ├── awk.snippets ├── bash.snippets ├── c.snippets ├── chef.snippets ├── clojure.snippets ├── cmake.snippets ├── codeigniter.snippets ├── coffee │ ├── angular_coffee.snippets │ ├── coffee.snippets │ ├── jquery_coffee.snippets │ └── requirejs_coffee.snippets ├── cpp.snippets ├── crystal.snippets ├── cs.snippets ├── css.snippets ├── cuda.snippets ├── d.snippets ├── dart-flutter.snippets ├── dart.snippets ├── diff.snippets ├── django.snippets ├── dosini.snippets ├── eelixir.snippets ├── elixir.snippets ├── elm.snippets ├── erlang.snippets ├── eruby.snippets ├── falcon.snippets ├── fortran.snippets ├── freemarker.snippets ├── fsharp.snippets ├── gdscript.snippets ├── gitcommit.snippets ├── gleam.snippets ├── go.snippets ├── haml.snippets ├── handlebars.snippets ├── haskell.snippets ├── heex.snippets ├── helm.snippets ├── html.snippets ├── htmldjango.snippets ├── htmltornado.snippets ├── idris.snippets ├── jade.snippets ├── java.snippets ├── javascript-bemjson.snippets ├── javascript-d3.snippets ├── javascript-jasmine.snippets ├── javascript-mocha.snippets ├── javascript-openui5.snippets ├── javascript │ ├── javascript-jquery.snippets │ ├── javascript-react.snippets │ ├── javascript-redux.snippets │ ├── javascript-requirejs.snippets │ ├── javascript.node.snippets │ └── javascript.snippets ├── jenkins.snippets ├── jinja.snippets ├── jsp.snippets ├── julia.snippets ├── kotlin.snippets ├── laravel.snippets ├── ledger.snippets ├── lfe.snippets ├── liquid.snippets ├── lpc.snippets ├── ls.snippets ├── lua.snippets ├── make.snippets ├── mako.snippets ├── markdown.snippets ├── matlab.snippets ├── mustache.snippets ├── objc.snippets ├── ocaml.snippets ├── octave.snippets ├── openfoam.snippets ├── org.snippets ├── pandoc.snippets ├── perl.snippets ├── perl6.snippets ├── phoenix.snippets ├── php.snippets ├── plsql.snippets ├── po.snippets ├── processing.snippets ├── progress.snippets ├── ps1.snippets ├── puppet.snippets ├── purescript.snippets ├── python.snippets ├── r.snippets ├── racket.snippets ├── rails.snippets ├── reason.snippets ├── rmd.snippets ├── rst.snippets ├── ruby.snippets ├── rust.snippets ├── sass.snippets ├── scala.snippets ├── scheme.snippets ├── scss.snippets ├── sh.snippets ├── simplemvcf.snippets ├── slim.snippets ├── smarty.snippets ├── snippets.snippets ├── sql.snippets ├── stylus.snippets ├── supercollider.snippets ├── svelte.snippets ├── systemverilog.snippets ├── tcl.snippets ├── tex.snippets ├── textile.snippets ├── twig.snippets ├── typescript.snippets ├── typescriptreact.snippets ├── verilog.snippets ├── vhdl.snippets ├── vim.snippets ├── vue.snippets ├── xml.snippets ├── xslt.snippets ├── yii-chtml.snippets ├── yii.snippets └── zsh.snippets └── tests.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *~ 3 | *.swo 4 | *.swp 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | 4 | notifications: 5 | email: false 6 | 7 | script: 8 | - ./tests.sh 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 see AUTHORS 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /UltiSnips/README: -------------------------------------------------------------------------------- 1 | This directory contains the snippets for UltiSnips. 2 | https://github.com/sirver/ultisnips 3 | 4 | Standing On The Shoulders of Giants 5 | =================================== 6 | 7 | The snippets have been collected from various other project which I want to 8 | express my gratitude for. My main source for inspiration where the following 9 | two projects: 10 | 11 | TextMate: http://svn.textmate.org/trunk/Bundles/ 12 | SnipMate: http://code.google.com/p/snipmate/ 13 | 14 | UltiSnips has seen contributions by many individuals. Those contributions have 15 | been merged into this collection seamlessly and without further comments. 16 | 17 | -- vim:ft=rst:nospell: 18 | -------------------------------------------------------------------------------- /UltiSnips/all.snippets: -------------------------------------------------------------------------------- 1 | # This file contains snippets that are always defined. I personally 2 | # have snippets for signatures and often needed texts 3 | 4 | # sligthly lower priority than everything else since specialized versions 5 | # should overwrite. The user needs to adjust her priority in her snippets to 6 | # ~-55 so that other filetypes will still overwrite. 7 | priority -60 8 | 9 | ############## 10 | # NICE BOXES # 11 | ############## 12 | global !p 13 | from vimsnippets import foldmarker, make_box, get_comment_format 14 | LOREM = """ 15 | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod \ 16 | tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At \ 17 | vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \ 18 | no sea takimata sanctus est Lorem ipsum dolor sit amet. 19 | """ 20 | endglobal 21 | 22 | snippet box "A nice box with the current comment symbol" b 23 | `!p 24 | box = make_box(len(t[1])) 25 | snip.rv = box[0] 26 | snip += box[1] 27 | `${1:${VISUAL:content}}`!p 28 | box = make_box(len(t[1])) 29 | snip.rv = box[2] 30 | snip += box[3]` 31 | $0 32 | endsnippet 33 | 34 | snippet bbox "A nice box over the full width" b 35 | `!p 36 | if not snip.c: 37 | width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71 38 | box = make_box(len(t[1]), width) 39 | snip.rv = box[0] 40 | snip += box[1] 41 | `${1:${VISUAL:content}}`!p 42 | box = make_box(len(t[1]), width) 43 | snip.rv = box[2] 44 | snip += box[3]` 45 | $0 46 | endsnippet 47 | 48 | snippet fold "Insert a vim fold marker" b 49 | `!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = get_comment_format()[2]` 50 | endsnippet 51 | 52 | snippet foldc "Insert a vim fold close marker" b 53 | `!p snip.rv = get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = get_comment_format()[2]` 54 | endsnippet 55 | 56 | snippet foldp "Insert a vim fold marker pair" b 57 | `!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = get_comment_format()[2]` 58 | ${2:${VISUAL:Content}} 59 | `!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]` 60 | endsnippet 61 | 62 | ########################## 63 | # LOREM IPSUM GENERATORS # 64 | ########################## 65 | snippet "lorem(([1-4])?[0-9])?" "Lorem Ipsum" r 66 | `!p snip.rv = " ".join(LOREM.split()[:int(match.group(1))]) if match.group(1) else LOREM` 67 | endsnippet 68 | 69 | ########################## 70 | # VIM MODELINE GENERATOR # 71 | ########################## 72 | # See advice on `:help 'tabstop'` for why these values are set. Uses second 73 | # modeline form ('set') to work in languages with comment terminators 74 | # (/* like C */). 75 | snippet modeline "Vim modeline" 76 | 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 : '') . ':'` 77 | endsnippet 78 | 79 | ######### 80 | # DATES # 81 | ######### 82 | snippet date "YYYY-MM-DD" w 83 | `!v strftime("%Y-%m-%d")` 84 | endsnippet 85 | 86 | snippet ddate "Month DD, YYYY" w 87 | `!v strftime("%b %d, %Y")` 88 | endsnippet 89 | 90 | snippet diso "ISO format datetime" w 91 | `!v strftime("%Y-%m-%d %H:%M:%S%z")` 92 | endsnippet 93 | 94 | snippet time "hh:mm" w 95 | `!v strftime("%H:%M")` 96 | endsnippet 97 | 98 | snippet datetime "YYYY-MM-DD hh:mm" w 99 | `!v strftime("%Y-%m-%d %H:%M")` 100 | endsnippet 101 | 102 | snippet todo "TODO comment" bw 103 | `!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]` 104 | endsnippet 105 | 106 | ########## 107 | # Misc # 108 | ########## 109 | snippet uuid "Random UUID" w 110 | `!p if not snip.c: import uuid; snip.rv = str(uuid.uuid4())` 111 | endsnippet 112 | 113 | # vim:ft=snippets: 114 | -------------------------------------------------------------------------------- /UltiSnips/bib.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet online "Online resource" b 4 | @online{${1:name}, 5 | author={${2:author}}, 6 | title={${3:title}}, 7 | date={${4:date}}, 8 | url={${5:url}} 9 | } 10 | $0 11 | endsnippet 12 | 13 | snippet article "Article reference" b 14 | @article{${1:name}, 15 | author={${2:author}}, 16 | title={${3:title}}, 17 | journaltitle={${4:journal}}, 18 | volume={${5:NN}}, 19 | number={${6:NN}}, 20 | year={${7:YYYY}}, 21 | pages={${8:NN}--${9:NN}} 22 | } 23 | $0 24 | endsnippet 25 | 26 | snippet book "Book reference" b 27 | @book{${1:name}, 28 | author={${2:author}}, 29 | title={${3:title}}, 30 | subtitle={${4:subtitle}}, 31 | year={${5:YYYY}}, 32 | location={${6:somewhere}}, 33 | publisher={${7:publisher}}, 34 | pages={${8:NN}--${9:NN}} 35 | } 36 | $0 37 | endsnippet 38 | 39 | snippet inb "In Book reference" b 40 | @inbook{${1:name}, 41 | author={${2:author}}, 42 | title={${3:title}}, 43 | subtitle={${4:subtitle}}, 44 | booktitle={${5:book}}, 45 | editor={${6:editor}}, 46 | year={${7:YYYY}}, 47 | location={${8:somewhere}}, 48 | publisher={${9:publisher}}, 49 | pages={${10:NN}--${11:NN}} 50 | } 51 | $0 52 | endsnippet 53 | -------------------------------------------------------------------------------- /UltiSnips/bindzone.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | global !p 4 | def newsoa(): 5 | import datetime 6 | now = datetime.datetime.now() 7 | # return standard SOA formatted serial for today 8 | return now.strftime("%Y%m%d00") 9 | endglobal 10 | 11 | snippet zone "Bootstrap a new Bind zonefile" b 12 | $TTL 86400 13 | @ IN SOA ${1:example.net}. ${2:hostmaster.$1}.( 14 | `!p snip.rv = newsoa()`; serial 15 | 21600; refresh every 6 hours 16 | 3600; retry after one hour 17 | 604800; expire after a week 18 | 86400 ); minimum TTL of 1 day 19 | 20 | IN NS ns01.$1. 21 | IN MX 10 mail.$1. 22 | 23 | ns01.$1 IN A 24 | mail.$1 IN A 25 | endsnippet 26 | 27 | snippet A "Insert A Record" b 28 | ${1:hostname} IN A ${2:ip} 29 | endsnippet 30 | -------------------------------------------------------------------------------- /UltiSnips/blade.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends html 4 | 5 | # We want to overwrite everything in parent ft. 6 | priority -49 7 | 8 | snippet break "@break" 9 | @break 10 | endsnippet 11 | 12 | snippet component "@component directive" 13 | @component('$1') 14 | ${2:${VISUAL}} 15 | @endcomponent 16 | endsnippet 17 | 18 | snippet each "@each directive" 19 | @each('$1', $$2, '$3') 20 | endsnippet 21 | 22 | snippet else "@else directive" 23 | @else 24 | endsnippet 25 | 26 | snippet eif "@else if directive" 27 | @else if ($1) 28 | ${2:${VISUAL}} 29 | endsnippet 30 | 31 | snippet for "@for directive" 32 | @for ($1) 33 | ${2:${VISUAL}} 34 | @endfor 35 | endsnippet 36 | 37 | snippet foreach "@foreach directive" 38 | @foreach ($$1 as $$2) 39 | ${3:${VISUAL}} 40 | @endforeach 41 | endsnippet 42 | 43 | snippet extends "@extends directive" 44 | @extends('$1') 45 | endsnippet 46 | 47 | snippet if "@if directive" 48 | @if ($1) 49 | ${2:${VISUAL}} 50 | @endif 51 | endsnippet 52 | 53 | snippet ife "@if @else structure" 54 | @if ($1) 55 | ${2:${VISUAL}} 56 | @else 57 | ${3:${VISUAL}} 58 | @endif 59 | endsnippet 60 | 61 | snippet include "@include directive" 62 | @include('$1') 63 | endsnippet 64 | 65 | snippet includeIf "@includeIf directive" 66 | @includeIf('$1') 67 | endsnippet 68 | 69 | snippet isset "@isset directive" 70 | @isset 71 | ${1:${VISUAL}} 72 | @endisset 73 | endsnippet 74 | 75 | snippet inject "@inject directive" 76 | @inject('$1', '$2') 77 | endsnippet 78 | 79 | snippet lang "@lang directive" i 80 | @lang('$1') 81 | endsnippet 82 | 83 | snippet php "@php directive" 84 | @php 85 | ${1:${VISUAL}} 86 | @endphp 87 | endsnippet 88 | 89 | snippet push "@push directive" 90 | @push('$1') 91 | ${2:${VISUAL}} 92 | @endpush 93 | endsnippet 94 | 95 | snippet section "@section directive" 96 | @section('$1') 97 | endsnippet 98 | 99 | snippet show "@show directive" 100 | @show 101 | endsnippet 102 | 103 | snippet slot "@slot directive" 104 | @slot('$1') 105 | ${2:${VISUAL}} 106 | @endslot 107 | endsnippet 108 | 109 | snippet unless "@unless directive" 110 | @unless 111 | ${1:${VISUAL}} 112 | @endunless 113 | endsnippet 114 | 115 | snippet verbatim "@verbatim directive" 116 | @verbatim 117 | ${0:$VISUAL} 118 | @endverbatim 119 | endsnippet 120 | 121 | snippet wh "@while directive" 122 | @while ($1) 123 | ${2:${VISUAL}} 124 | @endwhile 125 | endsnippet 126 | 127 | snippet yield "@yield directive" 128 | @yield('$1') 129 | endsnippet 130 | 131 | snippet { "{{ }} statement." i 132 | {{ $1 }} 133 | endsnippet 134 | 135 | snippet {! "{!! !!} statement" i 136 | {!! $1 !!} 137 | endsnippet 138 | 139 | # vim:ft=snippets: 140 | -------------------------------------------------------------------------------- /UltiSnips/coffee-react.snippets: -------------------------------------------------------------------------------- 1 | # 2 | # CoffeeScript versions -- adapted from coffee-jasmine 3 | # for some ReactJS matchers. 4 | # 5 | priority -50 6 | 7 | extends coffee 8 | 9 | priority -49 10 | 11 | snippet createClass "React define Class" b 12 | ${1:classname}Class = React.createClass 13 | displayName: "$1" 14 | render: -> 15 | $2 16 | $1 = React.createFactory($1) 17 | endsnippet 18 | 19 | snippet PropTypes "React define propTypes" b 20 | propTypes: -> 21 | ${1:myVar}: React.PropTypes.${2:type}${3:.isRequired} 22 | endsnippet 23 | 24 | snippet propType "React propType (key/value)" b 25 | ${1:myVar}: React.PropTypes.${2:type}${3:.isRequired} 26 | $4 27 | endsnippet 28 | 29 | snippet setState "React setState" b 30 | @setState 31 | ${1:myvar}: ${2:myvalue} 32 | $3 33 | endsnippet 34 | 35 | snippet getInitialState "React define getInitialState" b 36 | getInitialState: -> 37 | ${1:myvar}: ${2:myvalue} 38 | $3 39 | endsnippet 40 | 41 | snippet getDefaultProps "React define getDefaultProps" b 42 | getDefaultProps: -> 43 | ${1:myvar}: ${2:myvalue} 44 | $3 45 | endsnippet 46 | 47 | snippet componentWillMount "React define componentWillMount" b 48 | componentWillMount: -> 49 | $1 50 | endsnippet 51 | 52 | snippet componentDidMount "React define componentDidMount" b 53 | componentDidMount: -> 54 | $1 55 | endsnippet 56 | 57 | snippet componentWillReceiveProps "React define componentWillReceiveProps" b 58 | componentWillReceiveProps: (nextProps) -> 59 | $1 60 | endsnippet 61 | 62 | snippet shouldComponentUpdate "React define shouldComponentUpdate" b 63 | shouldComponentUpdate: (nextProps, nextState) -> 64 | $1 65 | endsnippet 66 | 67 | snippet componentWillUpdate "React define componentWillUpdate" b 68 | componentWillUpdate: (nextProps, nextState) -> 69 | $1 70 | endsnippet 71 | 72 | snippet componentDidUpdate "React define componentDidUpdate" b 73 | componentDidUpdate: (prevProps, prevState) -> 74 | $1 75 | endsnippet 76 | 77 | snippet componentWillUnmount "React define componentWillUnmount" b 78 | componentWillUnmount: -> 79 | $1 80 | endsnippet 81 | -------------------------------------------------------------------------------- /UltiSnips/coffee.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet fun "Function" b 4 | ${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`-> 5 | ${0:# body...} 6 | endsnippet 7 | 8 | snippet bfun "Function (bound)" i 9 | `!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} 10 | endsnippet 11 | 12 | snippet if "If" b 13 | if ${1:condition} 14 | ${0:# body...} 15 | endsnippet 16 | 17 | snippet ife "If .. Else" b 18 | if ${1:condition} 19 | ${2:# body...} 20 | else 21 | ${3:# body...} 22 | endsnippet 23 | 24 | snippet elif "Else if" b 25 | else if ${1:condition} 26 | ${0:# body...} 27 | endsnippet 28 | 29 | snippet ifte "Ternary if" b 30 | if ${1:condition} then ${2:value} else ${3:other} 31 | endsnippet 32 | 33 | snippet unl "Unless" b 34 | ${1:action} unless ${2:condition} 35 | endsnippet 36 | 37 | snippet fora "Array Comprehension" b 38 | for ${1:name} in ${2:array} 39 | ${0:# body...} 40 | endsnippet 41 | 42 | snippet foro "Object Comprehension" b 43 | for ${1:key}, ${2:value} of ${3:Object} 44 | ${0:# body...} 45 | endsnippet 46 | 47 | snippet forr "Range Comprehension (inclusive)" b 48 | for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} 49 | ${0:# body...} 50 | endsnippet 51 | 52 | snippet forrex "Range Comprehension (exclusive)" b 53 | for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} 54 | ${0:# body...} 55 | endsnippet 56 | 57 | snippet swi "Switch" b 58 | switch ${1:object} 59 | when ${2:value} 60 | ${3:# body...} 61 | else 62 | $0 63 | endsnippet 64 | 65 | snippet swit "Switch when .. then" b 66 | switch ${1:object} 67 | when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} 68 | else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value} 69 | endsnippet 70 | 71 | snippet cla "Class" b 72 | class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor} 73 | 74 | ${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` -> 75 | ${5:# body...}} 76 | $0 77 | endsnippet 78 | 79 | snippet try "Try .. Catch" b 80 | try 81 | $1 82 | catch ${2:error} 83 | $3 84 | endsnippet 85 | 86 | snippet req "Require" b 87 | ${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'}) 88 | endsnippet 89 | 90 | snippet # "Interpolated Code" i 91 | #{$1}$0 92 | endsnippet 93 | 94 | snippet log "Log" b 95 | console.log ${1:"${2:msg}"} 96 | endsnippet 97 | 98 | snippet kv "Key:value for object" b 99 | ${1:key}:${2:value} 100 | endsnippet 101 | -------------------------------------------------------------------------------- /UltiSnips/crystal.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet "\b(de)?f" "def ..." r 4 | def ${1:method_name}${2:(${3:*args})} 5 | $0 6 | end 7 | endsnippet 8 | 9 | snippet "\b(pde)?f" "private def ..." r 10 | private def ${1:method_name}${2:(${3:*args})} 11 | $0 12 | end 13 | endsnippet 14 | -------------------------------------------------------------------------------- /UltiSnips/cuda.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends cpp 4 | 5 | # vim:ft=snippets: 6 | -------------------------------------------------------------------------------- /UltiSnips/eelixir.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends html 4 | 5 | snippet % "<% %>" w 6 | <% $0 %> 7 | endsnippet 8 | 9 | snippet = "<%= %>" w 10 | <%= $0 %> 11 | endsnippet 12 | 13 | snippet end "<% end %>" w 14 | <% end %> 15 | endsnippet 16 | 17 | snippet for 18 | <%= for ${1:item} <- ${2:$1s} ${3:@conn} do %> 19 | $0 20 | <% end %> 21 | endsnippet 22 | 23 | snippet ft "form_tag" w 24 | <%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %> 25 | $0 26 | 27 | endsnippet 28 | 29 | snippet lin "link" w 30 | <%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %> 31 | endsnippet 32 | 33 | snippet ff "form_for" w 34 | <%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %> 35 | $0 36 | 37 | <%= submit "Submit" %> 38 | <% end %> 39 | endsnippet 40 | 41 | snippet gt "gettext" w 42 | <%= gettext("${0:${VISUAL}}") %> 43 | endsnippet 44 | -------------------------------------------------------------------------------- /UltiSnips/ejs.snippets: -------------------------------------------------------------------------------- 1 | snippet for "ejs for loop" b 2 | <% for (let ${1:i = 0}; ${2:i 3 | ${0:body} 4 | <% } %> 5 | endsnippet 6 | snippet forE "ejs for Each loop" b 7 | <% ${1:array}.forEach((${2:single var}) => { %> 8 | ${0:body} 9 | <% }) %> 10 | endsnippet 11 | -------------------------------------------------------------------------------- /UltiSnips/elm.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet impa "Qualified import" 4 | import ${1:Json.Encode} as ${0:`!p snip.rv = t[1].split(".")[-1]`} 5 | endsnippet 6 | 7 | snippet impae "Qualified import with exposing" 8 | import ${1:Json.Encode} as ${2:`!p snip.rv = t[1].split(".")[-1]`} exposing (${0:Value}) 9 | endsnippet 10 | -------------------------------------------------------------------------------- /UltiSnips/erlang.snippets: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # TEXTMATE SNIPPETS # 3 | ########################################################################### 4 | 5 | priority -50 6 | 7 | snippet pat "Case:Receive:Try Clause" 8 | ${1:pattern}${2: when ${3:guard}} -> 9 | ${4:body} 10 | endsnippet 11 | 12 | snippet mod "Module Directive" b 13 | -module(${1:`!p snip.rv = snip.basename or "module"`}). 14 | endsnippet 15 | 16 | snippet || "List Comprehension" 17 | [${1:X} || ${2:X} <- ${3:List}${4:, gen}] 18 | endsnippet 19 | 20 | snippet gen "Generator Expression" 21 | ${1:X} <- ${2:List}${3:, gen} 22 | endsnippet 23 | 24 | # vim:ft=snippets: 25 | -------------------------------------------------------------------------------- /UltiSnips/gitcommit.snippets: -------------------------------------------------------------------------------- 1 | global !p 2 | def complete(t, opts): 3 | if t: 4 | opts = [ m[len(t):] for m in opts if m.startswith(t) ] 5 | if len(opts) == 1: 6 | return opts[0] 7 | return '(' + '|'.join(opts) + ')' 8 | endglobal 9 | 10 | snippet status "Status" bA 11 | status $1`!p snip.rv = complete(t[1], ['build', 'ci', 'test', 'refactor', 'perf', 'improvement', 'docs', 'chore', 'feat', 'fix'])` 12 | endsnippet 13 | 14 | snippet fix "fix conventional commit" 15 | fix(${1:scope}): ${2:title} 16 | 17 | ${0:${VISUAL}} 18 | endsnippet 19 | 20 | snippet feat "feat conventional commit" 21 | feat(${1:scope}): ${2:title} 22 | 23 | ${0:${VISUAL}} 24 | endsnippet 25 | 26 | snippet chore "chore conventional commit" 27 | chore(${1:scope}): ${2:title} 28 | 29 | ${0:${VISUAL}} 30 | endsnippet 31 | 32 | snippet docs "docs conventional commit" 33 | docs(${1:scope}): ${2:title} 34 | 35 | ${0:${VISUAL}} 36 | endsnippet 37 | 38 | snippet improvement "improvement conventional commit" 39 | improvement(${1:scope}): ${2:title} 40 | 41 | ${0:${VISUAL}} 42 | endsnippet 43 | 44 | snippet perf "perf conventional commit" 45 | perf(${1:scope}): ${2:title} 46 | 47 | ${0:${VISUAL}} 48 | endsnippet 49 | 50 | snippet refactor "refactor conventional commit" 51 | refactor(${1:scope}): ${2:title} 52 | 53 | ${0:${VISUAL}} 54 | endsnippet 55 | 56 | snippet test "test conventional commit" 57 | test(${1:scope}): ${2:title} 58 | 59 | ${0:${VISUAL}} 60 | endsnippet 61 | 62 | snippet ci "ci conventional commit" 63 | ci(${1:scope}): ${2:title} 64 | 65 | ${0:${VISUAL}} 66 | endsnippet 67 | 68 | snippet build "build conventional commit" 69 | build(${1:scope}): ${2:title} 70 | 71 | ${0:${VISUAL}} 72 | endsnippet 73 | 74 | snippet Co-authored-by "Co-authored-by:" 75 | Co-authored-by: ${1:Author Name} <${2:Email}> 76 | endsnippet 77 | 78 | snippet sign "Signature" 79 | ------------------------------------------------------------------------------- 80 | ${1:Company Name} 81 | 82 | ${2:Author Name} 83 | 84 | ${3:Streetname 21} 85 | ${4:City and Area} 86 | 87 | ${5:Tel: +44 (0)987 / 888 8888} 88 | ${6:Fax: +44 (0)987 / 888 8882} 89 | ${7:Mail: Email} 90 | ${8:Web: https://} 91 | ------------------------------------------------------------------------------- 92 | $0 93 | endsnippet 94 | 95 | snippet t "Todo" 96 | TODO: ${1:What is it} (`date "+%b %d %Y %a (%H:%M:%S)"`, `echo $USER`) 97 | $0 98 | endsnippet 99 | 100 | snippet cmt "Commit Structure" bA 101 | ${1:Summarize changes in around 50 characters or less} 102 | 103 | ${2:More detailed explanatory text, if necessary. Wrap it to about 72 104 | characters or so. In some contexts, the first line is treated as the 105 | subject of the commit and the rest of the text as the body. The 106 | blank line separating the summary from the body is critical (unless 107 | you omit the body entirely); various tools like `log`, `shortlog` 108 | and `rebase` can get confused if you run the two together.} 109 | 110 | ${3:Explain the problem that this commit is solving. Focus on why you 111 | are making this change as opposed to how (the code explains that). 112 | Are there side effects or other unintuitive consequences of this 113 | change? Here's the place to explain them.} 114 | 115 | ${4:Further paragraphs come after blank lines. 116 | 117 | - Bullet points are okay, too 118 | 119 | - Typically a hyphen or asterisk is used for the bullet, preceded 120 | by a single space, with blank lines in between, but conventions 121 | vary here} 122 | 123 | ${5:Status} 124 | 125 | ${6:If you use an issue tracker, put references to them at the bottom, 126 | like this.} 127 | 128 | ${7:Any todos} 129 | 130 | ${8:Resolves: #123 131 | See also: #456, #789} 132 | 133 | ${9:Signature} 134 | endsnippet 135 | -------------------------------------------------------------------------------- /UltiSnips/go.snippets: -------------------------------------------------------------------------------- 1 | # Snippets for Go 2 | 3 | priority -50 4 | 5 | # when to abbriviate and when not? 6 | # b doesn't work here, because it ignores whitespace 7 | # optional local name? 8 | snippet /^import/ "Import declaration" r 9 | import ( 10 | "${1:package}" 11 | ) 12 | endsnippet 13 | 14 | snippet /^package/ "Package declaration" r 15 | // Package $1 provides ... 16 | package ${1:main} 17 | endsnippet 18 | 19 | # Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle 20 | snippet /^cons/ "Constants declaration" r 21 | const ( 22 | ${1:constant}${2/(.+)/ /}${2:type} = ${0:value} 23 | ) 24 | endsnippet 25 | 26 | snippet /^con/ "Constant declaration" r 27 | const ${1:name}${2/(.+)/ /}${2:type} = ${0:value} 28 | endsnippet 29 | 30 | snippet iota "Iota constant generator" b 31 | const ( 32 | ${1:constant}${2/(.+)/ /}${2:type} = iota 33 | ) 34 | endsnippet 35 | 36 | snippet struct "Struct declaration" b 37 | type ${1:Struct} struct { 38 | ${0:${VISUAL}} 39 | } 40 | endsnippet 41 | 42 | snippet interface "Interface declaration" b 43 | type ${1:Interface} interface { 44 | ${0:${VISUAL}} 45 | } 46 | endsnippet 47 | 48 | snippet if "If statement" b 49 | if ${1:condition}${1/(.+)/ /}{ 50 | ${0:${VISUAL}} 51 | } 52 | endsnippet 53 | 54 | snippet switch "Switch statement" b 55 | switch ${1:expression}${1/(.+)/ /}{ 56 | case$0 57 | } 58 | endsnippet 59 | 60 | # functions 61 | snippet /^main/ "Main function" r 62 | func main() { 63 | ${0:${VISUAL}} 64 | } 65 | endsnippet 66 | 67 | snippet /^meth/ "Method" r 68 | func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { 69 | ${0:${VISUAL}} 70 | } 71 | endsnippet 72 | 73 | snippet func "Function" b 74 | func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { 75 | ${0:${VISUAL}} 76 | } 77 | endsnippet 78 | 79 | snippet funch "HTTP handler" b 80 | func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) { 81 | ${0:${VISUAL}} 82 | } 83 | endsnippet 84 | 85 | # types and variables 86 | snippet map "Map type" b 87 | map[${1:keytype}]${2:valtype} 88 | endsnippet 89 | 90 | snippet : "Variable declaration :=" b 91 | ${1:name} := ${0:value} 92 | endsnippet 93 | 94 | snippet var "Variable declaration" b 95 | var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} 96 | endsnippet 97 | 98 | snippet vars "Variables declaration" b 99 | var ( 100 | ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } 101 | ) 102 | endsnippet 103 | 104 | snippet json "JSON field" 105 | \`json:"${1:displayName}"\` 106 | endsnippet 107 | 108 | # vim:ft=snippets: 109 | 110 | # error handling 111 | snippet err "Basic error handling" b 112 | if err != nil { 113 | log.${1:Fatal}(err) 114 | } 115 | endsnippet 116 | -------------------------------------------------------------------------------- /UltiSnips/haskell.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet imp "Simple import" 4 | import ${1:${2:Data}.${0:Text}} 5 | endsnippet 6 | 7 | snippet imp2 "Selective import" b 8 | import ${1:${2:Data}.${3:Text}} (${4})${0} 9 | endsnippet 10 | 11 | snippet impq "Qualified import" 12 | import qualified ${1:${2:Data}.${3:Text}} as ${0:`!p snip.rv = t[1].split(".")[-1]`} 13 | endsnippet 14 | -------------------------------------------------------------------------------- /UltiSnips/help.snippets: -------------------------------------------------------------------------------- 1 | # Snippets for VIM Help Files 2 | 3 | priority -50 4 | 5 | global !p 6 | def sec_title(snip, t): 7 | file_start = snip.fn.split('.')[0] 8 | sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') 9 | return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) 10 | endglobal 11 | 12 | snippet sec "Section marker" b 13 | ============================================================================== 14 | ${1:SECTION}`!p snip.rv = sec_title(snip, t)` 15 | 16 | $0 17 | endsnippet 18 | 19 | snippet ssec "Sub section marker" b 20 | ${1:Subsection}`!p snip.rv = sec_title(snip, t) 21 | snip += "-"*len(t[1])` 22 | 23 | $0 24 | endsnippet 25 | 26 | snippet sssec "Subsub Section marker" b 27 | ${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)` 28 | 29 | $0 30 | endsnippet 31 | 32 | # For vim help, follow the same settings as the official docs. 33 | snippet modeline "Vim help modeline" 34 | `!v 'vim'`:tw=78:ts=8:ft=help:norl: 35 | endsnippet 36 | 37 | # vim:ft=snippets: 38 | -------------------------------------------------------------------------------- /UltiSnips/html_minimal.snippets: -------------------------------------------------------------------------------- 1 | # more can be found in snippets/html_minimal.snippets 2 | # these UltiSnips override snippets because nested placeholders are being used 3 | 4 | priority -49 5 | 6 | snippet id 7 | id="$1"$2 8 | endsnippet 9 | 10 | snippet idn 11 | id="$1" name="${2:$1}" 12 | endsnippet 13 | 14 | snippet label_and_input 15 | 16 | $8 17 | endsnippet 18 | 19 | snippet input 20 | $7 21 | endsnippet 22 | 23 | snippet submit 24 | $7 25 | endsnippet 26 | 27 | snippet textarea 28 | 29 | endsnippet 30 | 31 | snippet img 32 | $3 33 | endsnippet 34 | -------------------------------------------------------------------------------- /UltiSnips/htmljinja.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends html, jinja2 4 | -------------------------------------------------------------------------------- /UltiSnips/javascript-angular.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet iti "it (js, inject)" b 4 | it('${1:description}', inject(function($2) { 5 | $0 6 | })); 7 | endsnippet 8 | 9 | snippet befi "before each (js, inject)" b 10 | beforeEach(inject(function($1) { 11 | $0 12 | })); 13 | endsnippet 14 | 15 | snippet aconf "angular config" i 16 | config(function($1) { 17 | $0 18 | }); 19 | endsnippet 20 | 21 | snippet acont "angular controller" i 22 | controller('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 23 | $0 24 | }]); 25 | endsnippet 26 | 27 | snippet aconts "angular controller with scope" i 28 | controller('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 29 | $0 30 | }]); 31 | endsnippet 32 | 33 | snippet adir "angular directive" i 34 | directive('$1', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 35 | return { 36 | restrict: '${3:EA}', 37 | link: function(scope, element, attrs) { 38 | $0 39 | } 40 | }; 41 | }]); 42 | endsnippet 43 | 44 | snippet adirs "angular directive with scope" i 45 | directive('$1', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 46 | return { 47 | restrict: '${3:EA}', 48 | link: function(scope, element, attrs) { 49 | $0 50 | } 51 | }; 52 | }]); 53 | endsnippet 54 | 55 | snippet afact "angular factory" i 56 | factory('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 57 | $0 58 | }]); 59 | endsnippet 60 | 61 | snippet afacts "angular factory with scope" i 62 | factory('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 63 | $0 64 | }]); 65 | endsnippet 66 | 67 | snippet aserv "angular service" i 68 | service('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 69 | $0 70 | }]); 71 | endsnippet 72 | 73 | snippet aservs "angular service" i 74 | service('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) { 75 | $0 76 | }]); 77 | endsnippet 78 | -------------------------------------------------------------------------------- /UltiSnips/javascript-ember.snippets: -------------------------------------------------------------------------------- 1 | ################################################################### 2 | # Ember snippets # 3 | ################################################################### 4 | 5 | priority -50 6 | 7 | # Application 8 | snippet eapp "App.Name = Ember.Application.create({});" 9 | import Application from '@ember/application'; 10 | 11 | export default Application.extend({ 12 | ${0://Properties here...} 13 | }); 14 | endsnippet 15 | 16 | # Models 17 | snippet emod "import DS from 'ember-data';" 18 | import DS from 'ember-data'; 19 | 20 | export default DS.Model.extend({ 21 | ${0://Properties here...} 22 | }); 23 | endsnippet 24 | 25 | # Controller 26 | snippet econtroller "import Controller from '@ember/controller';" 27 | import Controller from '@ember/controller'; 28 | 29 | export default Controller.extend({ 30 | ${0://Properties here...} 31 | }); 32 | endsnippet 33 | 34 | # Route 35 | snippet eroute "import Route from '@ember/routing/route';" 36 | import Route from '@ember/routing/route'; 37 | 38 | export default Route.extend({ 39 | ${0://Properties here...} 40 | }); 41 | endsnippet 42 | 43 | # Component 44 | snippet ecomponent "import Component from '@ember/component';" 45 | import Component from '@ember/component'; 46 | 47 | export default Component.extend({ 48 | ${0://Properties here...} 49 | }); 50 | endsnippet 51 | 52 | # Object 53 | snippet eobj "import EmberObject from '@ember/object';" 54 | import EmberObject from '@ember/object'; 55 | 56 | export default EmberObject.extend({ 57 | ${0://Properties here...} 58 | }); 59 | endsnippet 60 | 61 | # Mixin 62 | snippet emix "App.MixinName = Ember.Model.extend({...});" 63 | import Mixin from '@ember/object/mixin'; 64 | 65 | export default Mixin.create({ 66 | ${0://Properties here...} 67 | }); 68 | endsnippet 69 | 70 | # Ember getter and setter 71 | snippet eget "this.get('property');" 72 | ${1:this}.get('${2:property}'); 73 | endsnippet 74 | 75 | snippet eset "this.set('property', value);" 76 | ${1:this}.set('${2:property}', ${3:value}); 77 | endsnippet 78 | 79 | # Computed properties 80 | snippet cproimport "import { computed } from '@ember/object';" 81 | import { computed } from '@ember/object'; 82 | endsnippet 83 | 84 | snippet cpro "property_name: computed('...', function() {...})," 85 | ${1:property_name}: computed('${3:argument}', function() { 86 | ${0://body...} 87 | }), 88 | endsnippet 89 | 90 | # Observers 91 | snippet prooimport "import { observer } from '@ember/object';" 92 | import { observer } from '@ember/object'; 93 | endsnippet 94 | 95 | snippet proo "property_name: observer('...', function() {...})," 96 | ${1:property_name}: observer('${3:argument}', function() { 97 | ${0://body...} 98 | }), 99 | endsnippet 100 | 101 | # vim:ft=snippets: 102 | -------------------------------------------------------------------------------- /UltiSnips/javascript-jasmine-arrow.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | # JavaScript versions -- from the TextMate bundle + some additions 4 | # for jasmine-jquery matchers 5 | # 6 | 7 | snippet des "Describe (js)" b 8 | describe('${1:description}', () => { 9 | $0 10 | }); 11 | endsnippet 12 | 13 | snippet it "it (js)" b 14 | it('${1:description}', () => { 15 | $0 16 | }); 17 | endsnippet 18 | 19 | snippet bef "before each (js)" b 20 | beforeEach(() => { 21 | $0 22 | }); 23 | endsnippet 24 | 25 | snippet aft "after each (js)" b 26 | afterEach(() => { 27 | $0 28 | }); 29 | endsnippet 30 | 31 | snippet befa "before all (js)" b 32 | beforeAll(() => { 33 | $0 34 | }); 35 | endsnippet 36 | 37 | snippet afta "after all (js)" b 38 | afterAll(() => { 39 | $0 40 | }); 41 | endsnippet 42 | 43 | snippet ru "runs (js)" b 44 | runs(() => { 45 | $0 46 | }); 47 | endsnippet 48 | 49 | -------------------------------------------------------------------------------- /UltiSnips/javascript-jsdoc.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | # JSDoc snippets 4 | 5 | snippet /* "A JSDoc comment" b 6 | /** 7 | * ${1:${VISUAL}}$0 8 | */ 9 | endsnippet 10 | 11 | snippet @au "@author email (First Last)" 12 | @author ${1:`!v g:snips_author`} [${2:`!v g:snips_author_email`}] 13 | endsnippet 14 | 15 | snippet @li "@license Description" 16 | @license ${1:MIT}$0 17 | endsnippet 18 | 19 | snippet @ver "@version Semantic version" 20 | @version ${1:0.1.0}$0 21 | endsnippet 22 | 23 | snippet @fileo "@fileoverview Description" b 24 | /** 25 | * @fileoverview ${1:${VISUAL:A description of the file}}$0 26 | */ 27 | endsnippet 28 | 29 | snippet @constr "@constructor" 30 | @constructor 31 | endsnippet 32 | 33 | snippet @p "@param {Type} varname Description" 34 | @param {${1:Type}} ${2:varname} ${3:Description} 35 | endsnippet 36 | 37 | snippet @ret "@return {Type} Description" 38 | @return {${1:Type}} ${2:Description} 39 | endsnippet 40 | 41 | snippet @pri "@private" 42 | @private 43 | endsnippet 44 | 45 | snippet @over "@override" 46 | @override 47 | endsnippet 48 | 49 | snippet @pro "@protected" 50 | @protected 51 | endsnippet 52 | -------------------------------------------------------------------------------- /UltiSnips/javascript-node.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet #! "#!/usr/bin/env node" b 4 | #!/usr/bin/env node 5 | endsnippet 6 | 7 | snippet vreq "assign a CommonJS-style module to a var" 8 | var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('$1'); 9 | endsnippet 10 | 11 | snippet ex "module.exports" 12 | module.exports = $1; 13 | endsnippet 14 | 15 | snippet hcs "http.createServer" 16 | http.createServer($1).listen($2); 17 | endsnippet 18 | 19 | snippet ncs "net.createServer" 20 | net.createServer(function(${1:socket}){ 21 | $1.on('data', function(${3:data}){ 22 | $4 23 | }); 24 | $1.on('end', function(){ 25 | $5 26 | }); 27 | }).listen(${6:8124}); 28 | endsnippet 29 | 30 | snippet pipe "pipe" 31 | pipe(${1:stream})$2 32 | endsnippet 33 | 34 | # Express snippets 35 | 36 | snippet eget "express GET" 37 | ${1:app}.get('$2', $3); 38 | endsnippet 39 | 40 | snippet epost "express POST" 41 | ${1:app}.post('$2', $3); 42 | endsnippet 43 | 44 | snippet eput "express PUT" 45 | ${1:app}.put('$2', $3); 46 | endsnippet 47 | 48 | snippet edelete "express DELETE" 49 | ${1:app}.delete('$2', $3); 50 | endsnippet 51 | 52 | # process snippets 53 | 54 | snippet stdout "stdout" 55 | process.stdout 56 | endsnippet 57 | 58 | snippet stdin "stdin" 59 | process.stdin 60 | endsnippet 61 | 62 | snippet stderr "stderr" 63 | process.stderr 64 | endsnippet 65 | 66 | -------------------------------------------------------------------------------- /UltiSnips/javascript_react.snippets: -------------------------------------------------------------------------------- 1 | global !p 2 | # Capitalize the first letter without affecting the rest of the letters 3 | def capitalize_first(word): 4 | if(word): 5 | word = word[0].upper() + word[1:] 6 | return word 7 | endglobal 8 | 9 | # Functional components 10 | snippet rfc "react functional component" b 11 | import React, {useState} from "react" 12 | 13 | function ${1:`!p snip.rv = snip.basename`}(${2}){ 14 | return( 15 |
16 | ${3:

Body

} 17 |
18 | ) 19 | } 20 | 21 | export default $4`!p snip.rv = snip.basename` 22 | endsnippet 23 | # React Hooks 24 | snippet useS "useState Hook" b 25 | const [${1}, set`!p snip.rv=capitalize_first(t[1])`] = useState(${3:"${4}"}) 26 | endsnippet 27 | snippet useE "useEffect Hook" b 28 | useEffect(() => { 29 | ${1:${0}} 30 | }${2}) 31 | endsnippet 32 | snippet useC "useContext Hook" b 33 | const ${1:context} = useContext(${2}) 34 | endsnippet 35 | snippet useRe "useReducer Hook" b 36 | const [${3:state}, ${4:dispatch}] = useReducer(${5:reducer}, ${2:initial_value}) 37 | endsnippet 38 | snippet useCB "useCallback(fn, inputs)" b 39 | const ${1:callback} = useCallback((${2})) => ${3:{ 40 | ${4} 41 | }}, [${5}]) 42 | endsnippet 43 | snippet useM "useMemo(fn, inputs)" b 44 | const ${1:memorized} = useMemo(() => ${2:{ 45 | ${3} 46 | }}, [${4}]) 47 | endsnippet 48 | snippet useR "useRef(defaultValue)" b 49 | const ${1:ref} = useRef(${2:null}) 50 | endsnippet 51 | snippet ir "import React" 52 | import React from "react" 53 | endsnippet 54 | snippet irc "import React and Component" 55 | import React, { Component } from "react" 56 | endsnippet 57 | -------------------------------------------------------------------------------- /UltiSnips/json.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet s "String" b 4 | "${1:key}": "${0:value}", 5 | endsnippet 6 | 7 | snippet n "Number" b 8 | "${1:key}": ${0:value}, 9 | endsnippet 10 | 11 | snippet a "Array" b 12 | [ 13 | ${VISUAL}$0 14 | ], 15 | endsnippet 16 | 17 | snippet na "Named array" b 18 | "${1:key}": [ 19 | ${VISUAL}$0 20 | ], 21 | endsnippet 22 | 23 | snippet o "Object" b 24 | { 25 | ${VISUAL}$0 26 | }, 27 | endsnippet 28 | 29 | snippet no "Named object" b 30 | "${1:key}": { 31 | ${VISUAL}$0 32 | }, 33 | endsnippet 34 | 35 | snippet null "Null" b 36 | "${0:key}": null, 37 | endsnippet 38 | 39 | 40 | global !p 41 | def compB(t, opts): 42 | if t: 43 | opts = [m[len(t):] for m in opts if m.startswith(t)] 44 | if len(opts) == 1: 45 | return opts[0] 46 | return "(" + '|'.join(opts) + ')' 47 | endglobal 48 | 49 | snippet b "Bool" b 50 | "${1:key}": $2`!p snip.rv=compB(t[2], ['true', 'false'])`, 51 | endsnippet 52 | -------------------------------------------------------------------------------- /UltiSnips/julia.snippets: -------------------------------------------------------------------------------- 1 | # Documentation 2 | snippet docf "function documentation" b 3 | #' @description 4 | #' 5 | #' ${1:function description} 6 | #' 7 | #' ${2:@param ${3:name}::${4:Type} ${5:Description}} 8 | #' 9 | #' ${6:@returns ${7:name}::${8:Type} ${9:Description}} 10 | #' 11 | #' @examples 12 | #' 13 | #' ${10: function call examples} 14 | endsnippet 15 | 16 | snippet doct "type definition" b 17 | #' @description 18 | #' 19 | #' ${1:type description} 20 | #' 21 | #' ${2:@field ${3:name}::${4:Type} ${5:Description}} 22 | #' 23 | #' @examples 24 | #' 25 | #' ${10: constructor examples} 26 | endsnippet 27 | 28 | snippet par "function parameter documentation" b 29 | #' @param ${1:name}::${2:Type} ${0:Description} 30 | endsnippet 31 | 32 | snippet fld "type field documentation" b 33 | #' @field ${1:name}::${2:Type} ${0:Description} 34 | endsnippet 35 | 36 | # Debugging 37 | snippet deb "Debugger breakpoint" b 38 | Main.@bp 39 | endsnippet 40 | 41 | snippet inf "Infiltrator breakpoint" b 42 | Main.@infiltrate 43 | endsnippet 44 | -------------------------------------------------------------------------------- /UltiSnips/ledger.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet t "Transaction" b 4 | ${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee} 5 | ${6:Expenses} \$${7:0.00} 6 | ${8:Assets:Checking}$0 7 | endsnippet 8 | -------------------------------------------------------------------------------- /UltiSnips/lhaskell.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends haskell 4 | -------------------------------------------------------------------------------- /UltiSnips/lua.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ################################# 4 | # Snippets for the Lua language # 5 | ################################# 6 | snippet #! "#!/usr/bin/env lua" b 7 | #!/usr/bin/env lua 8 | $0 9 | endsnippet 10 | 11 | snippet assert "Assertion" b 12 | assert(${1:condition}`!p 13 | if t[2]: 14 | snip.rv = ", " 15 | else: 16 | snip.rv = "" 17 | `${2:msg}) 18 | endsnippet 19 | 20 | snippet !fun(ction)?! "New function" br 21 | function ${1:new_function}(${2:args}) 22 | $0 23 | end 24 | endsnippet 25 | 26 | snippet forp "pair for loop" b 27 | for ${1:name},${2:val} in pairs(${3:table_name}) do 28 | $0 29 | end 30 | endsnippet 31 | 32 | snippet fori "ipair for foop" b 33 | for ${1:idx},${2:val} in ipairs(${3:table_name}) do 34 | $0 35 | end 36 | endsnippet 37 | 38 | snippet for "numeric for loop" b 39 | for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do 40 | $0 41 | end 42 | endsnippet 43 | 44 | snippet do "do block" 45 | do 46 | $0 47 | end 48 | endsnippet 49 | 50 | snippet repeat "repeat loop" b 51 | repeat 52 | $1 53 | until $0 54 | endsnippet 55 | 56 | snippet while "while loop" b 57 | while $1 do 58 | $0 59 | end 60 | endsnippet 61 | 62 | snippet if "if statement" b 63 | if $1 then 64 | $0 65 | end 66 | endsnippet 67 | 68 | snippet ife "if/else statement" b 69 | if $1 then 70 | $2 71 | else 72 | $0 73 | end 74 | endsnippet 75 | 76 | snippet eif "if/elseif statement" b 77 | if $1 then 78 | $2 79 | elseif $3 then 80 | $0 81 | end 82 | endsnippet 83 | 84 | snippet eife "if/elseif/else statement" b 85 | if $1 then 86 | $2 87 | elseif $3 then 88 | $4 89 | else 90 | $0 91 | end 92 | endsnippet 93 | 94 | snippet pcall "pcall statement" b 95 | local ok, err = pcall(${1:your_function}) 96 | if not ok then 97 | handler(${2:ok, err}) 98 | ${3:else 99 | success(${4:ok, err}) 100 | }end 101 | endsnippet 102 | 103 | snippet local "local x = 1" 104 | local ${1:x} = ${0:1} 105 | endsnippet 106 | 107 | snippet use "Use" b 108 | use { '$1' } 109 | endsnippet 110 | 111 | snippet req "Require" b 112 | require('$1') 113 | endsnippet 114 | 115 | 116 | # vim:ft=snippets: 117 | -------------------------------------------------------------------------------- /UltiSnips/mako.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ################# 4 | # From snipmate # 5 | ################# 6 | snippet def "definition" b 7 | <%def name="${1:name}"> 8 | ${2:} 9 | 10 | endsnippet 11 | 12 | snippet call "call" b 13 | <%call expr="${1:name}"> 14 | ${2:} 15 | 16 | endsnippet 17 | 18 | snippet doc "doc" b 19 | <%doc> 20 | ${1:} 21 | 22 | endsnippet 23 | 24 | snippet text "text" b 25 | <%text> 26 | ${1:} 27 | 28 | endsnippet 29 | 30 | snippet for "for" b 31 | % for ${1:i} in ${2:iter}: 32 | ${3:} 33 | % endfor 34 | endsnippet 35 | 36 | snippet if "if " b 37 | % if ${1:condition}: 38 | ${2:} 39 | % endif 40 | endsnippet 41 | 42 | snippet if "if/else" b 43 | % if ${1:condition}: 44 | ${2:} 45 | % else: 46 | ${3:} 47 | % endif 48 | endsnippet 49 | 50 | snippet try "try" b 51 | % try: 52 | ${1:} 53 | % except${2:}: 54 | ${3:pass} 55 | % endtry 56 | endsnippet 57 | 58 | snippet wh "wh" b 59 | % while ${1:}: 60 | ${2:} 61 | % endwhile 62 | endsnippet 63 | 64 | snippet $ "$" i 65 | ${${1:}} 66 | endsnippet 67 | 68 | snippet <% "<%" b 69 | <% ${1:} %> 70 | endsnippet 71 | 72 | snippet 74 | endsnippet 75 | 76 | snippet inherit "inherit" b 77 | <%inherit file="${1:filename}" /> 78 | endsnippet 79 | 80 | snippet include "include" b 81 | <%include file="${1:filename}" /> 82 | endsnippet 83 | 84 | snippet namespace "namespace" b 85 | <%namespace file="${1:name}" /> 86 | endsnippet 87 | 88 | snippet page "page" b 89 | <%page args="${1:}" /> 90 | endsnippet 91 | 92 | # vim:ft=snippets: 93 | -------------------------------------------------------------------------------- /UltiSnips/matlab.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet switch "switch ... otherwise" 4 | switch ${1:n} 5 | case ${2:0} 6 | ${3}${4: 7 | otherwise 8 | ${5}} 9 | end 10 | endsnippet 11 | 12 | snippet clc "class with constructor" b 13 | classdef ${1:`!p 14 | snip.rv = snip.basename or "class_name"`} 15 | properties 16 | ${2} 17 | end 18 | methods 19 | function obj = $1(${3}) 20 | ${4} 21 | end${0} 22 | end 23 | end 24 | endsnippet 25 | -------------------------------------------------------------------------------- /UltiSnips/ocaml.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet rs "raise" b 4 | raise (${1:Not_found}) 5 | endsnippet 6 | 7 | snippet open "open" 8 | let open ${1:module} in 9 | ${2:e} 10 | endsnippet 11 | 12 | snippet try "try" 13 | try ${1:e} 14 | with ${2:Not_found} -> ${3:()} 15 | endsnippet 16 | 17 | snippet ref "ref" 18 | let ${1:name} = ref ${2:val} in 19 | ${3:e} 20 | endsnippet 21 | 22 | snippet matchl "pattern match on a list" 23 | match ${1:list} with 24 | | [] -> ${2:()} 25 | | x::xs -> ${3:()} 26 | endsnippet 27 | 28 | snippet matcho "pattern match on an option type" 29 | match ${1:x} with 30 | | Some(${2:y}) -> ${3:()} 31 | | None -> ${4:()} 32 | endsnippet 33 | 34 | snippet fun "anonymous function" 35 | (fun ${1:x} -> ${2:x}) 36 | endsnippet 37 | 38 | snippet cc "commment" 39 | (* ${1:comment} *) 40 | endsnippet 41 | 42 | snippet let "let .. in binding" 43 | let ${1:x} = ${2:v} in 44 | ${3:e} 45 | endsnippet 46 | 47 | snippet lr "let rec" 48 | let rec ${1:f} = 49 | ${2:expr} 50 | endsnippet 51 | 52 | snippet if "if" 53 | if ${1:(* condition *)} then 54 | ${2:(* A *)} 55 | else 56 | ${3:(* B *)} 57 | endsnippet 58 | 59 | snippet If "If" 60 | if ${1:(* condition *)} then 61 | ${2:(* A *)} 62 | endsnippet 63 | 64 | snippet while "while" 65 | while ${1:(* condition *)} do 66 | ${2:(* A *)} 67 | done 68 | endsnippet 69 | 70 | snippet for "for" 71 | for ${1:i} = ${2:1} to ${3:10} do 72 | ${4:(* BODY *)} 73 | done 74 | endsnippet 75 | 76 | snippet match "match" 77 | match ${1:(* e1 *)} with 78 | | ${2:p} -> ${3:e2} 79 | endsnippet 80 | 81 | snippet Match "match" 82 | match ${1:(* e1 *)} with 83 | | ${2:p} -> ${3:e2} 84 | endsnippet 85 | 86 | snippet class "class" 87 | class ${1:name} = object 88 | ${2:methods} 89 | end 90 | endsnippet 91 | 92 | snippet obj "obj" 93 | object 94 | ${2:methods} 95 | end 96 | endsnippet 97 | 98 | snippet Obj "object" 99 | object (self) 100 | ${2:methods} 101 | end 102 | endsnippet 103 | 104 | snippet {{ "object functional update" 105 | {< ${1:x} = ${2:y} >} 106 | endsnippet 107 | 108 | snippet beg "beg" 109 | begin 110 | ${1:block} 111 | end 112 | endsnippet 113 | 114 | snippet ml "module instantiantion with functor" 115 | module ${1:Mod} = ${2:Functor}(${3:Arg}) 116 | endsnippet 117 | 118 | snippet mod "module - no signature" 119 | module ${1:(* Name *)} = struct 120 | ${2:(* BODY *)} 121 | end 122 | endsnippet 123 | 124 | snippet Mod "module with signature" 125 | module ${1:(* Name *)} : ${2:(* SIG *)} = struct 126 | ${3:(* BODY *)} 127 | end 128 | endsnippet 129 | 130 | snippet sig "anonymous signature" 131 | sig 132 | ${2:(* BODY *)} 133 | end 134 | endsnippet 135 | 136 | snippet sigf "functor signature or anonymous functor" 137 | functor (${1:Arg} : ${2:ARG}) -> ${3:(* BODY *)} 138 | endsnippet 139 | 140 | snippet func "define functor - no signature" 141 | module ${1:M} (${2:Arg} : ${3:ARG}) = struct 142 | ${4:(* BODY *)} 143 | end 144 | endsnippet 145 | 146 | snippet Func "define functor - with signature" 147 | module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct 148 | ${5:(* BODY *)} 149 | end 150 | endsnippet 151 | 152 | snippet mot "Declare module signature" 153 | module type ${1:(* Name *)} = sig 154 | ${2:(* BODY *)} 155 | end 156 | endsnippet 157 | 158 | snippet module "Module with anonymous signature" 159 | module ${1:(* Name *)} : sig 160 | ${2:(* SIGNATURE *)} 161 | end = struct 162 | ${3:(* BODY *)} 163 | end 164 | endsnippet 165 | 166 | snippet oo "odoc" 167 | (** ${1:odoc} *) 168 | endsnippet 169 | 170 | snippet qt "inline qtest" 171 | (*$T ${1:name} 172 | ${2:test} 173 | *) 174 | endsnippet 175 | -------------------------------------------------------------------------------- /UltiSnips/octave.snippets: -------------------------------------------------------------------------------- 1 | extends matlab 2 | 3 | -------------------------------------------------------------------------------- /UltiSnips/pandoc.snippets: -------------------------------------------------------------------------------- 1 | extends markdown 2 | 3 | # overwrite if necessary 4 | priority -49 5 | 6 | snippet title "Title Header" b 7 | % ${1:`!v vim_snippets#Filename('$1', 'title')`} 8 | % ${2:`!v g:snips_author`} 9 | % ${3:`!v strftime("%d %B %Y")`} 10 | 11 | $0 12 | endsnippet 13 | -------------------------------------------------------------------------------- /UltiSnips/perl.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ########################################################################### 4 | # TextMate Snippets # 5 | ########################################################################### 6 | snippet ife "Conditional if..else (ife)" 7 | if ($1) { 8 | ${2:# body...} 9 | } 10 | else { 11 | ${3:# else...} 12 | } 13 | 14 | endsnippet 15 | 16 | snippet ifee "Conditional if..elsif..else (ifee)" 17 | if ($1) { 18 | ${2:# body...} 19 | } 20 | elsif ($3) { 21 | ${4:# elsif...} 22 | } 23 | else { 24 | ${5:# else...} 25 | } 26 | 27 | endsnippet 28 | 29 | snippet xunless "Conditional one-line (unless)" 30 | ${1:expression} unless ${2:condition}; 31 | 32 | endsnippet 33 | 34 | snippet xif "Conditional one-line (xif)" 35 | ${1:expression} if ${2:condition}; 36 | 37 | endsnippet 38 | 39 | snippet sub "Function (sub)" 40 | sub ${1:function_name} { 41 | ${2:# body...} 42 | } 43 | 44 | endsnippet 45 | 46 | snippet xfore "Loop one-line (xforeach)" 47 | ${1:expression} foreach @${2:array}; 48 | 49 | endsnippet 50 | 51 | snippet xwhile "Loop one-line (xwhile)" 52 | ${1:expression} while ${2:condition}; 53 | 54 | endsnippet 55 | 56 | snippet test "Test" 57 | #!/usr/bin/env perl -w 58 | 59 | use strict; 60 | use Test::More tests => ${1:1}; 61 | use ${2:ModuleName}; 62 | 63 | ok(${3:assertion}); 64 | 65 | endsnippet 66 | 67 | snippet class "class" 68 | package ${1:ClassName}; 69 | 70 | ${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new { 71 | my $class = shift; 72 | $class = ref $class if ref $class; 73 | my $self = bless {}, $class; 74 | $self; 75 | } 76 | 77 | 1; 78 | 79 | endsnippet 80 | 81 | snippet eval "eval" 82 | local $@; 83 | eval { 84 | ${1:# do something risky...} 85 | }; 86 | if (my $${2:exception} = $@) { 87 | ${3:# handle failure...} 88 | } 89 | 90 | endsnippet 91 | 92 | snippet for "for" 93 | for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) { 94 | ${3:# body...} 95 | } 96 | 97 | endsnippet 98 | 99 | snippet fore "foreach" 100 | foreach ${1:my $${2:x}} (@${3:array}) { 101 | ${4:# body...} 102 | } 103 | 104 | endsnippet 105 | 106 | snippet if "if" 107 | if ($1) { 108 | ${2:# body...} 109 | } 110 | 111 | endsnippet 112 | 113 | snippet slurp "slurp" 114 | my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> }; 115 | 116 | endsnippet 117 | 118 | snippet unless "unless" 119 | unless ($1) { 120 | ${2:# body...} 121 | } 122 | 123 | endsnippet 124 | 125 | snippet while "while" 126 | while ($1) { 127 | ${2:# body...} 128 | } 129 | 130 | endsnippet 131 | 132 | snippet until "until" 133 | until ($1) { 134 | ${2:# body...} 135 | } 136 | 137 | endsnippet 138 | 139 | # vim:ft=snippets: 140 | -------------------------------------------------------------------------------- /UltiSnips/proto.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | global !p 4 | from vimsnippets import complete 5 | 6 | FIELD_TYPES = [ 7 | 'double', 8 | 'float', 9 | 'int32', 10 | 'int64', 11 | 'uint32', 12 | 'uint64', 13 | 'sint32', 14 | 'sint64', 15 | 'fixed32', 16 | 'fixed64', 17 | 'sfixed32', 18 | 'sfixed64', 19 | 'bool', 20 | 'string', 21 | 'bytes'] 22 | endglobal 23 | 24 | snippet mess "Proto message" b 25 | // ${2:TODO(`whoami`): Describe this message.} 26 | message ${1:Name} { 27 | $0 28 | 29 | // Next available id: 1 30 | } 31 | endsnippet 32 | 33 | snippet reqf "Required field" b 34 | // ${4:TODO(`whoami`): Describe this field.} 35 | optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required 36 | endsnippet 37 | 38 | snippet optf "Optional field" b 39 | // ${4:TODO(`whoami`): Describe this field.} 40 | optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; 41 | endsnippet 42 | 43 | snippet repf "Repeated field" b 44 | // ${4:TODO(`whoami`): Describe this field.} 45 | repeated $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; 46 | endsnippet 47 | 48 | snippet enum "Enumeration" b 49 | // ${2:TODO(`whoami`): Describe this enum.} 50 | enum ${1:Name} { 51 | } 52 | endsnippet 53 | -------------------------------------------------------------------------------- /UltiSnips/rnoweb.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends tex, r 4 | -------------------------------------------------------------------------------- /UltiSnips/rust.snippets: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # Rust Snippets # 3 | ####################################################################### 4 | 5 | priority -50 6 | 7 | snippet fn "fn name(?) -> ? {}" 8 | fn ${1:function_name}($2)${3/..*/ -> /}$3 { 9 | ${VISUAL}$0 10 | } 11 | endsnippet 12 | 13 | snippet pfn "pub fn name(?) -> ? {}" 14 | pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { 15 | ${VISUAL}$0 16 | } 17 | endsnippet 18 | 19 | snippet afn "async fn name(?) -> ? {}" 20 | async fn ${1:function_name}($2)${3/..*/ -> /}$3 { 21 | ${VISUAL}$0 22 | } 23 | endsnippet 24 | 25 | snippet pafn "pub async fn name(?) -> ? {}" 26 | pub async fn ${1:function_name}($2)${3/..*/ -> /}$3 { 27 | ${VISUAL}$0 28 | } 29 | endsnippet 30 | 31 | snippet pri "print!(..)" b 32 | print!("$1"${2/..*/, /}$2); 33 | endsnippet 34 | 35 | snippet pln "println!(..)" b 36 | println!("$1"${2/..*/, /}$2); 37 | endsnippet 38 | 39 | snippet fmt "format!(..)" 40 | format!("$1"${2/..*/, /}$2); 41 | endsnippet 42 | 43 | snippet .it ".iter()" i 44 | .iter()$0 45 | endsnippet 46 | 47 | snippet impl "Struct/Trait implementation" b 48 | impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} { 49 | ${0} 50 | } 51 | endsnippet 52 | 53 | # vim:ft=snippets: 54 | -------------------------------------------------------------------------------- /UltiSnips/sh.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | global !p 4 | import vim 5 | 6 | # Tests for the existence of a variable declared by Vim's filetype detection 7 | # suggesting the type of shell script of the current file 8 | def testShell(scope, shell): 9 | return vim.eval("exists('" + scope + ":is_" + shell + "')") 10 | 11 | # Loops over the possible variables, checking for global variables 12 | # first since they indicate an override by the user. 13 | def getShell(): 14 | for scope in ["g", "b"]: 15 | for shell in ["bash", "posix", "sh", "kornshell"]: 16 | if testShell(scope, shell) == "1": 17 | if shell == "kornshell": 18 | return "ksh" 19 | if shell == "posix": 20 | return "sh" 21 | return shell 22 | return "sh" 23 | endglobal 24 | 25 | ########################################################################### 26 | # TextMate Snippets # 27 | ########################################################################### 28 | snippet #! "#!/usr/bin/env (!env)" b 29 | `!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n" ` 30 | endsnippet 31 | 32 | snippet sbash "safe bash options" b 33 | #!/usr/bin/env bash 34 | set -euo pipefail 35 | IFS=$'\n\t' 36 | `!p snip.rv ='\n\n' ` 37 | endsnippet 38 | 39 | snippet temp "Tempfile" b 40 | ${1:TMPFILE}="$(mktemp -t ${3:--suffix=${4:.SUFFIX}} ${2:`!p 41 | snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled" 42 | `}.XXXXXX)" 43 | ${5:${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'}${6/(.+)/" 0 # EXIT\n/}${7/(.+)/trap "/}${7:rm -f '$${1/.*\s//}'; exit 1}${7/(.+)/" 2 # INT\n/}${8/(.+)/trap "/}${8:rm -f '$${1/.*\s//}'; exit 1}${8/(.+)/" 1 15 # HUP TERM\n/}} 44 | 45 | endsnippet 46 | 47 | snippet /case|sw(itch)?/ "case .. esac (case)" rb 48 | case ${1:word} in 49 | ${2:pattern} ) 50 | ${0:${VISUAL}};; 51 | esac 52 | endsnippet 53 | 54 | snippet elif "elif .. (elif)" b 55 | elif ${2:[[ ${1:condition} ]]}; then 56 | ${0:${VISUAL}} 57 | endsnippet 58 | 59 | snippet for "for ... done (for)" b 60 | for (( i = 0; i < ${1:10}; i++ )); do 61 | ${0:${VISUAL}} 62 | done 63 | endsnippet 64 | 65 | snippet forin "for ... in ... done (forin)" b 66 | for ${1:i}${2/.+/ in /}${2:words}; do 67 | ${0:${VISUAL}} 68 | done 69 | endsnippet 70 | 71 | snippet here "here document (here)" 72 | <<-${2:'${1:TOKEN}'} 73 | $0`echo \\n`${1/['"`](.+)['"`]/$1/} 74 | endsnippet 75 | 76 | snippet /ift(est)?/ "if ... then (if)" rb 77 | if ${2:[ ${1:condition} ]}; then 78 | ${0:${VISUAL}} 79 | fi 80 | endsnippet 81 | 82 | snippet if "if ... then (if)" b 83 | if [[ ${1:condition} ]]; then 84 | ${0:${VISUAL}} 85 | fi 86 | endsnippet 87 | 88 | snippet until "until ... (done)" b 89 | until ${2:[[ ${1:condition} ]]}; do 90 | ${0:${VISUAL}} 91 | done 92 | endsnippet 93 | 94 | snippet /wh(ile)?/ "while ... (done)" rb 95 | while ${2:[[ ${1:condition} ]]}; do 96 | ${0:${VISUAL}} 97 | done 98 | endsnippet 99 | 100 | snippet func "function() {...}" b 101 | ${1:function} () { 102 | ${0:${VISUAL}} 103 | } 104 | endsnippet 105 | 106 | # vim:ft=snippets: 107 | -------------------------------------------------------------------------------- /UltiSnips/smarty.snippets: -------------------------------------------------------------------------------- 1 | # snippets for smarty3 2 | 3 | extends html 4 | extends javascript 5 | extends css 6 | 7 | 8 | 9 | 10 | # https://www.smarty.net/docs/en/language.function.append.tpl 11 | snippet append "{append} is used for creating or appending template variable arrays during the execution of a template." 12 | {append var='${1}' value='${2}'${3: index='${4|first,last|}'}${5: scope='${6|parent,root,global|}'}} 13 | endsnippet 14 | 15 | # https://www.smarty.net/docs/en/language.function.assign.tpl 16 | snippet assign "{assign} is used for assigning template variables during the execution of a template." 17 | {assign var='${1}' value='${2}'${3: scope='${4|parent,root,global|}'}} 18 | endsnippet 19 | 20 | # https://www.smarty.net/docs/en/language.function.config.load.tpl 21 | snippet config_load "config_load" 22 | {config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}} 23 | endsnippet 24 | 25 | # https://www.smarty.net/docs/en/language.function.include.tpl 26 | snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template." 27 | {include file='${1}'${2: assign='${3}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11|parent,root,global|}'}${12: variables}} 28 | endsnippet 29 | -------------------------------------------------------------------------------- /UltiSnips/snippets.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | # We use a little hack so that the snippet is expanded 4 | # and parsed correctly 5 | snippet usnip "Ultisnips snippet definition" b 6 | `!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b} 7 | ${0:${VISUAL}} 8 | `!p snip.rv = "endsnippet"` 9 | endsnippet 10 | 11 | snippet global "Global snippet" b 12 | `!p snip.rv = "global"` !p 13 | ${0:${VISUAL}} 14 | `!p snip.rv = "endglobal"` 15 | endsnippet 16 | 17 | snippet vis "${VISUAL}" i 18 | \$\{VISUAL${1:${2:default}${3:/transform/}}\} 19 | endsnippet 20 | 21 | # vim:ft=snippets: 22 | -------------------------------------------------------------------------------- /UltiSnips/soy.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends html 4 | 5 | snippet ns "Namespace" b 6 | {namespace ${1:name}} 7 | endsnippet 8 | 9 | snippet tmpl "Template" b 10 | /** 11 | * ${2:TODO(`whoami`): Describe this template.} 12 | */ 13 | {template .${1:name}} 14 | $0 15 | {/template} 16 | endsnippet 17 | 18 | snippet msg "Message" b 19 | {msg desc="${1:description}"} 20 | $0 21 | {/msg} 22 | endsnippet 23 | 24 | snippet let "let command" b 25 | {let $${1:identifier}: ${2:expression} /} 26 | endsnippet 27 | 28 | snippet if "if .. (if)" b 29 | {if ${1:expression}} 30 | $0 31 | {/if} 32 | endsnippet 33 | 34 | snippet ife "if .. else (ife)" b 35 | {if ${1:expression}} 36 | $2 37 | {else} 38 | $0 39 | {/if} 40 | endsnippet 41 | 42 | snippet eli "else if .. (eli)" b 43 | {elif ${1:expression}} 44 | $0 45 | endsnippet 46 | 47 | snippet fore "foreach command" b 48 | {foreach $${1:var} in ${2:ref}} 49 | $0 50 | {/foreach} 51 | endsnippet 52 | 53 | snippet for "for command" b 54 | {for $${1:var} in range(${2:rangeexpr})} 55 | $0 56 | {/for} 57 | endsnippet 58 | 59 | snippet call "template call" b 60 | {call ${1:tmpl}} 61 | $0 62 | {/call} 63 | endsnippet 64 | -------------------------------------------------------------------------------- /UltiSnips/supercollider.snippets: -------------------------------------------------------------------------------- 1 | snippet for 2 | for (${1:1}, ${2:10}) {${3: |i}|} 3 | $0 4 | } 5 | endsnippet 6 | snippet sdef 7 | SynthDef(\\${1:synthName}, {${2: |${3:x}|} 8 | $0 9 | }).add; 10 | endsnippet 11 | -------------------------------------------------------------------------------- /UltiSnips/svelte.snippets: -------------------------------------------------------------------------------- 1 | extends html, javascript, css 2 | -------------------------------------------------------------------------------- /UltiSnips/tcl.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ########################################################################### 4 | # TEXTMATE SNIPPETS # 5 | ########################################################################### 6 | snippet for "for... (for)" b 7 | for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} { 8 | $4 9 | } 10 | 11 | endsnippet 12 | 13 | snippet foreach "foreach... (foreach)" 14 | foreach ${1:var} ${2:\$list} { 15 | $3 16 | } 17 | 18 | endsnippet 19 | 20 | snippet if "if... (if)" b 21 | if {${1:condition}} { 22 | $2 23 | } 24 | 25 | endsnippet 26 | 27 | snippet proc "proc... (proc)" b 28 | proc ${1:name} {${2:args}} \ 29 | { 30 | $3 31 | } 32 | 33 | endsnippet 34 | 35 | snippet switch "switch... (switch)" b 36 | switch ${1:-exact} -- ${2:\$var} { 37 | ${3:match} { 38 | $4 39 | } 40 | default {$5} 41 | } 42 | 43 | endsnippet 44 | 45 | snippet while "while... (while)" b 46 | while {${1:condition}} { 47 | $2 48 | } 49 | 50 | endsnippet 51 | 52 | # vim:ft=snippets: 53 | -------------------------------------------------------------------------------- /UltiSnips/texmath.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ############## 4 | # MATH STUFF # 5 | ############## 6 | 7 | snippet eqnn "Equation without a number" b 8 | \begin{equation*} 9 | ${0:${VISUAL}} 10 | \end{equation*} 11 | endsnippet 12 | 13 | snippet al "Align" b 14 | \begin{align} 15 | ${0:${VISUAL}} 16 | \end{align} 17 | endsnippet 18 | 19 | snippet alnn "Align without a number" b 20 | \begin{align*} 21 | ${0:${VISUAL}} 22 | \end{align*} 23 | endsnippet 24 | 25 | snippet eqa "Equation array" b 26 | \begin{eqnarray} 27 | ${1:${VISUAL}} & ${2:${VISUAL}} & ${0:${VISUAL}} 28 | \end{eqnarray} 29 | endsnippet 30 | 31 | snippet eqann "Equation array without a number" b 32 | \begin{eqnarray*} 33 | ${1:${VISUAL}} & ${2:${VISUAL}} & ${0:${VISUAL}} 34 | \end{eqnarray*} 35 | endsnippet 36 | 37 | ################# 38 | # PHYSICS STUFF # 39 | ################# 40 | 41 | snippet dv "Derivative" w 42 | \dv[${1:${VISUAL}}]{${2}}{${3}} 43 | endsnippet 44 | 45 | snippet pdv "Partial Derivative" w 46 | \pdv[${1:${VISUAL}}]{${2}}{${3}} 47 | endsnippet 48 | 49 | snippet SI "SI-Unit" w 50 | \SI{${1:${VISUAL}}}{${2}} 51 | endsnippet 52 | 53 | # vim:ft=snippets: 54 | -------------------------------------------------------------------------------- /UltiSnips/typescript.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends javascript 4 | 5 | snippet int "interface" 6 | interface ${1} { 7 | } 8 | endsnippet 9 | snippet nspc "namespace" 10 | namespace ${1} { 11 | } 12 | endsnippet 13 | priority -49 14 | snippet fun "function (named)" b 15 | function ${1:function_name} (${2:argument}: ${3:argument_type}) { 16 | ${VISUAL}$0 17 | } 18 | endsnippet 19 | -------------------------------------------------------------------------------- /UltiSnips/typescript_react.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | extends javascript_react 3 | extends typescript 4 | 5 | priority -49 6 | snippet rfc "react functional component" 7 | import React, { FC } from "react" 8 | 9 | interface ${1:function_name}Props {${4:props_types}} 10 | 11 | export const ${1:function_name}: FC<${1:function_name}Props> = (${2:props}) => ${3:function_body} 12 | endsnippet 13 | -------------------------------------------------------------------------------- /UltiSnips/vim.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | ########################################################################### 4 | # SnipMate Snippets # 5 | ########################################################################### 6 | snippet gvar "Global / configuration variable" b 7 | if !exists("g:${1:MyUltraImportantVar}") 8 | let g:$1 = ${2:"${3:}"} 9 | endif 10 | endsnippet 11 | 12 | snippet guard "script reload guard" b 13 | if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} 14 | finish 15 | endif 16 | let $1 = 1$3 17 | endsnippet 18 | 19 | snippet f "function" b 20 | fun ${1:function_name}($2) 21 | ${3:" code} 22 | endf 23 | endsnippet 24 | # vim:ft=snippets: 25 | -------------------------------------------------------------------------------- /UltiSnips/vue.snippets: -------------------------------------------------------------------------------- 1 | extends html, javascript, css 2 | -------------------------------------------------------------------------------- /UltiSnips/xhtml.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends html 4 | -------------------------------------------------------------------------------- /UltiSnips/xml.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | snippet xml "XML declaration" b 4 | 5 | 6 | endsnippet 7 | 8 | snippet t "Simple tag" b 9 | <${1:tag}> 10 | ${2:${VISUAL}} 11 | 12 | endsnippet 13 | 14 | snippet ti "Inline tag" b 15 | <${1:tag}>${2:${VISUAL}} 16 | endsnippet 17 | -------------------------------------------------------------------------------- /UltiSnips/zsh.snippets: -------------------------------------------------------------------------------- 1 | priority -50 2 | 3 | extends sh 4 | 5 | priority -49 6 | 7 | snippet #! "#!/usr/bin/env zsh" b 8 | #!/usr/bin/env zsh 9 | $0 10 | endsnippet 11 | 12 | # vim:ft=snippets: 13 | -------------------------------------------------------------------------------- /addon-info.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "vim-snippets", 3 | "author" : "community", 4 | "maintainer" : "honza @ github & others", 5 | "repository" : {"type": "git", "url": "git://github.com/honza/vim-snippets.git"}, 6 | "dependencies" : { 7 | }, 8 | "description" : "community driven set of snippets for snipmate" 9 | } 10 | -------------------------------------------------------------------------------- /autoload/vim_snippets.vim: -------------------------------------------------------------------------------- 1 | " this is well known Filename found in snipmate (and the other engines), but 2 | " rewritten and documented :) 3 | " 4 | " optional arg1: string in which to replace '$1' by filename with extension 5 | " and path dropped. Defaults to $1 6 | " optional arg2: return this value if buffer has no filename 7 | " But why not use the template in this case, too? 8 | " Doesn't make sense to me 9 | fun! vim_snippets#Filename(...) 10 | let template = get(a:000, 0, "$1") 11 | let arg2 = get(a:000, 1, "") 12 | 13 | let basename = expand('%:t:r') 14 | 15 | if basename == '' 16 | return arg2 17 | else 18 | return substitute(template, '$1', basename, 'g') 19 | endif 20 | endf 21 | 22 | " original code: 23 | " fun! Filename(...) 24 | " let filename = expand('%:t:r') 25 | " if filename == '' | return a:0 == 2 ? a:2 : '' | endif 26 | " return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g') 27 | " endf 28 | -------------------------------------------------------------------------------- /plugin/vimsnippets.vim: -------------------------------------------------------------------------------- 1 | if exists("b:done_vimsnippets") 2 | finish 3 | endif 4 | let b:done_vimsnippets = 1 5 | 6 | " Some variables need default value 7 | if !exists("g:snips_author") 8 | let g:snips_author = "yourname" 9 | endif 10 | 11 | if !exists("g:snips_email") 12 | let g:snips_email = "yourname@email.com" 13 | endif 14 | 15 | if !exists("g:snips_github") 16 | let g:snips_github = "https://github.com/yourname" 17 | endif 18 | 19 | " Expanding the path is not needed on Vim 7.4 20 | if &cp || version >= 704 21 | finish 22 | endif 23 | 24 | " Add pythonx to the python search path if needed (i.e. <= Vim 7.3). 25 | if !has("python") && !has("python3") 26 | finish 27 | end 28 | 29 | " This will fail if UltiSnips is not installed. 30 | try 31 | call UltiSnips#bootstrap#Bootstrap() 32 | catch /E117/ 33 | finish 34 | endtry 35 | 36 | 37 | " This should have been set by UltiSnips, otherwise something is wrong. 38 | if !exists("g:_uspy") 39 | finish 40 | end 41 | 42 | 43 | " Expand our path 44 | let s:SourcedFile=expand("") 45 | exec g:_uspy "import vim, os, sys" 46 | exec g:_uspy "sourced_file = vim.eval('s:SourcedFile')" 47 | exec g:_uspy "while not os.path.exists(os.path.join(sourced_file, 'pythonx')): 48 | \ sourced_file = os.path.dirname(sourced_file)" 49 | exec g:_uspy "module_path = os.path.join(sourced_file, 'pythonx')" 50 | exec g:_uspy "sys.path.append(module_path)" 51 | -------------------------------------------------------------------------------- /pythonx/javascript_snippets.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """ 4 | Helper utilities to format javascript snippets. 5 | """ 6 | 7 | ALWAYS = 'always' 8 | NEVER = 'never' 9 | 10 | 11 | def get_option(snip, option, default=None): 12 | return snip.opt('g:ultisnips_javascript["{}"]'.format(option), default) 13 | 14 | 15 | def semi(snip): 16 | option = get_option(snip, 'semi', ALWAYS) 17 | 18 | if option == NEVER: 19 | ret = '' 20 | elif option == ALWAYS: 21 | ret = ';' 22 | else: 23 | ret = ';' 24 | return ret 25 | 26 | 27 | def space_before_function_paren(snip): 28 | option = get_option(snip, 'space-before-function-paren', NEVER) 29 | 30 | if option == NEVER: 31 | ret = '' 32 | elif option == ALWAYS: 33 | ret = ' ' 34 | else: 35 | ret = '' 36 | return ret 37 | 38 | 39 | def keyword_spacing(snip): 40 | option = get_option(snip, 'keyword-spacing', ALWAYS) 41 | 42 | if option == NEVER: 43 | ret = '' 44 | elif option == ALWAYS: 45 | ret = ' ' 46 | else: 47 | ret = '' 48 | return ret 49 | -------------------------------------------------------------------------------- /snippets/actionscript.snippets: -------------------------------------------------------------------------------- 1 | snippet main 2 | package { 3 | import flash.display.*; 4 | import flash.Events.*; 5 | 6 | public class Main extends Sprite { 7 | public function Main ( ) { 8 | trace("start"); 9 | stage.scaleMode = StageScaleMode.NO_SCALE; 10 | stage.addEventListener(Event.RESIZE, resizeListener); 11 | } 12 | 13 | private function resizeListener (e:Event):void { 14 | trace("The application window changed size!"); 15 | trace("New width: " + stage.stageWidth); 16 | trace("New height: " + stage.stageHeight); 17 | } 18 | 19 | } 20 | 21 | } 22 | snippet class 23 | ${1:public|internal} class ${2:name} ${0:extends } { 24 | public function $2 ( ) { 25 | ("start"); 26 | } 27 | } 28 | snippet all 29 | package name { 30 | 31 | ${1:public|internal|final} class ${2:name} ${0:extends } { 32 | private|public| static const FOO = "abc"; 33 | private|public| static var BAR = "abc"; 34 | 35 | // class initializer - no JIT !! one time setup 36 | if Cababilities.os == "Linux|MacOS" { 37 | FOO = "other"; 38 | } 39 | 40 | // constructor: 41 | public function $2 ( ){ 42 | super2(); 43 | trace("start"); 44 | } 45 | public function name (a, b...){ 46 | super.name(..); 47 | lable:break 48 | } 49 | } 50 | } 51 | 52 | function A(){ 53 | // A can only be accessed within this file 54 | } 55 | snippet switch 56 | switch(${1}){ 57 | case ${2}: 58 | ${0} 59 | break; 60 | default: 61 | } 62 | snippet case 63 | case ${1}: 64 | ${0} 65 | break; 66 | snippet package 67 | package ${1:package}{ 68 | ${0} 69 | } 70 | snippet wh 71 | while ${1:cond}{ 72 | ${0} 73 | } 74 | snippet do 75 | do { 76 | ${0} 77 | } while (${1:cond}) 78 | snippet for enumerate names 79 | for (${1:var} in ${2:object}){ 80 | ${0} 81 | } 82 | snippet for enumerate values 83 | for each (${1:var} in ${2:object}){ 84 | ${0} 85 | } 86 | snippet get_set 87 | function get ${1:name} { 88 | return ${2} 89 | } 90 | function set $1 (newValue) { 91 | ${0} 92 | } 93 | snippet interface 94 | interface name { 95 | function method(${1}):${0:returntype}; 96 | } 97 | snippet try 98 | try { 99 | ${1:${VISUAL}} 100 | } catch (error:ErrorType) { 101 | ${2} 102 | } finally { 103 | ${0} 104 | } 105 | # For Loop (same as c.snippet) 106 | snippet for for (..) {..} 107 | for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { 108 | ${0} 109 | } 110 | # Custom For Loop 111 | snippet forr 112 | for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { 113 | ${0} 114 | } 115 | # If Condition 116 | snippet if 117 | if ($1) { 118 | ${0:${VISUAL}} 119 | } 120 | snippet el 121 | else { 122 | ${0:${VISUAL}} 123 | } 124 | # Ternary conditional 125 | snippet t Ternary: `condition ? true : false` 126 | $1 ? $2 : $0 127 | snippet fun 128 | function ${1:function_name}(${2})${3} 129 | { 130 | ${0} 131 | } 132 | # FlxSprite (usefull when using the flixel library) 133 | snippet FlxSprite 134 | package 135 | { 136 | import org.flixel.* 137 | 138 | public class ${1:ClassName} extends ${2:FlxSprite} 139 | { 140 | public function $1(${3: X:Number, Y:Number}):void 141 | { 142 | super(X,Y); 143 | ${4} 144 | } 145 | 146 | override public function update():void 147 | { 148 | super.update(); 149 | ${0} 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /snippets/all.snippets: -------------------------------------------------------------------------------- 1 | extends _ 2 | -------------------------------------------------------------------------------- /snippets/alpaca.snippets: -------------------------------------------------------------------------------- 1 | snippet mod 2 | module ${0:`expand('%:t:r')`} 3 | snippet imp 4 | import ${0:http} 5 | snippet impt 6 | import type ${0:option.option} 7 | snippet exp 8 | export ${0} 9 | snippet expt 10 | export ${0} 11 | snippet fn 12 | val ${1:fn} ${2}: fn ${3:'a} -> ${4:'a} 13 | let $1 ${5} = 14 | ${0:${VISUAL}} 15 | snippet mat 16 | match ${1} with 17 | | ${2} -> ${0} 18 | snippet - 19 | | ${1} -> ${0} 20 | snippet let 21 | let ${1} = ${2:${VISUAL}} in 22 | ${0} 23 | snippet letf 24 | let ${1} = 25 | ${0:${VISUAL}} 26 | snippet ty 27 | type ${1:msg} 28 | = ${0} 29 | snippet test 30 | test "${1}" = 31 | ${0:${VISUAL}} 32 | snippet doc 33 | {-| ${0} 34 | -} 35 | snippet p 36 | |> ${0} 37 | snippet ae 38 | assert.equal ${0} 39 | -------------------------------------------------------------------------------- /snippets/apache.snippets: -------------------------------------------------------------------------------- 1 | # Snippets for code blocks used oftenly in Apache files. 2 | # 3 | snippet dir 4 | 5 | DirectoryIndex ${0:index.html} 6 | Order Deny,Allow 7 | Deny from All 8 | 9 | # 10 | snippet filesmatch 11 | 12 | ${0:${VISUAL}} 13 | 14 | # 15 | snippet ifmodule 16 | 17 | ${0:${VISUAL}} 18 | 19 | # 20 | snippet limitexcept 21 | 22 | ${0:${VISUAL}} 23 | 24 | # 25 | snippet proxy 26 | 27 | ${0:${VISUAL}} 28 | 29 | # 30 | snippet virtualhost 31 | 32 | ServerAdmin ${3:webmaster@example.com} 33 | DocumentRoot ${4:/www/example.com} 34 | ServerName ${0:www.example.com} 35 | 36 | -------------------------------------------------------------------------------- /snippets/arduino.snippets: -------------------------------------------------------------------------------- 1 | snippet setup 2 | void setup() 3 | { 4 | Serial.begin(${1:9600}); 5 | ${2} 6 | } 7 | 8 | snippet loop 9 | void loop() 10 | { 11 | ${0} 12 | } 13 | 14 | snippet inc 15 | #include <${1}.h> 16 | 17 | snippet def 18 | #define ${1} 19 | 20 | # if 21 | snippet if 22 | if ($1) { 23 | ${0:${VISUAL}} 24 | } 25 | # else 26 | snippet el 27 | else { 28 | ${1} 29 | } 30 | # else if 31 | snippet elif 32 | else if ($1) { 33 | ${2} 34 | } 35 | # ifi 36 | snippet ifi 37 | if ($1) ${2}; 38 | 39 | # switch 40 | snippet switch 41 | switch (${1:/* variable */}) { 42 | case ${2:/* variable case */}: 43 | ${3} 44 | ${4:break;}${5} 45 | default: 46 | ${6} 47 | } 48 | 49 | snippet case 50 | case ${1:/* variable case */}: 51 | ${2} 52 | ${3:break;} 53 | 54 | # for 55 | snippet for 56 | for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { 57 | ${4} 58 | } 59 | # for (custom) 60 | snippet forr 61 | for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { 62 | ${5} 63 | } 64 | # while 65 | snippet wh 66 | while ($1) { 67 | ${2} 68 | } 69 | # do... while 70 | snippet do 71 | do { 72 | ${2} 73 | } while ($1); 74 | ## 75 | ## Functions 76 | # function definition 77 | snippet fun 78 | ${1:void} ${2:function_name}(${3}) 79 | { 80 | ${4} 81 | } 82 | 83 | ## IO 84 | # pinMode OUTPUT 85 | snippet pinout 86 | pinMode(${1}, OUTPUT); 87 | # pinMode INPUT 88 | snippet pinin 89 | pinMode(${1}, INPUT); 90 | # digitalWrite HIGH 91 | snippet dwHigh 92 | digitalWrite(${1}, HIGH); 93 | # digitalWrite LOW 94 | snippet dwLow 95 | digitalWrite(${1}, LOW); 96 | # digitalRead 97 | snippet dr 98 | digitalRead(${1}); 99 | # analogRead 100 | snippet ar 101 | analogRead(${1}); 102 | # analogWrite 103 | snippet aw 104 | analogWrite(${1}); 105 | # serialRead 106 | snippet sr 107 | Serial.read(); 108 | # serialWrite 109 | snippet sw 110 | Serial.write(); 111 | # serial.print 112 | snippet sp 113 | Serial.print(${1}); 114 | # serial.println 115 | snippet sl 116 | Serial.println(${1}); 117 | 118 | 119 | # delay 120 | snippet dl 121 | delay(${1}); 122 | # millis 123 | snippet ml 124 | millis(); 125 | -------------------------------------------------------------------------------- /snippets/asm.snippets: -------------------------------------------------------------------------------- 1 | snippet scode Start basic code for assembly 2 | .data 3 | 4 | 5 | .text 6 | 7 | 8 | .global main 9 | 10 | 11 | main: 12 | 13 | 14 | snippet scodes Start basic code for assembly with _start label 15 | .data 16 | 17 | 18 | .text 19 | 20 | 21 | .globl _start 22 | 23 | 24 | _start: 25 | 26 | 27 | snippet lo Long 28 | $1: .long $2 29 | snippet wo Word 30 | $1: .word $2 31 | snippet by Byte 32 | $1: .byte $2 33 | snippet sp Space 34 | $1: .space $2 35 | snippet ai Ascii 36 | $1: .ascii "$2" 37 | snippet az Asciz 38 | $1: .asciz "$2" 39 | snippet ze Zero 40 | $1: .zero "$2" 41 | snippet qu Quad 42 | $1: .quad "$2" 43 | snippet si Single 44 | $1: .single "$2" 45 | snippet do Double 46 | $1: .single "$2" 47 | snippet fl Float 48 | $1: .single "$2" 49 | snippet oc Octa 50 | $1: .single "$2" 51 | snippet sh Short 52 | $1: .single "$2" 53 | snippet exit0 Exit without error 54 | movl \$1, %eax 55 | xorl %ebx, %ebx 56 | int \$0x80 57 | 58 | snippet exit Exit with error 59 | mov \$1, %eax 60 | mov $1, %ebx 61 | int \$0x80 62 | 63 | snippet readfstdin Read fixed length text from stdin 64 | mov \$3, %eax 65 | mov \$2, %ebx 66 | mov $1, %ecx 67 | mov $2, %edx 68 | int \$0x80 69 | 70 | snippet writestdout Write text to stdout 71 | mov \$4, %eax 72 | mov \$1, %ebx 73 | mov $1, %ecx 74 | mov $2, %edx 75 | int \$0x80 76 | 77 | snippet writestderr Write text to stderr 78 | mov \$4, %eax 79 | mov \$2, %ebx 80 | mov $1, %ecx 81 | mov $2, %edx 82 | int \$0x80 83 | 84 | snippet * Multiplication 85 | mov $1, %eax 86 | mul $2 87 | 88 | snippet / Division 89 | mov $1, %eax 90 | div $2 91 | 92 | snippet jmpl Conditional lower jump 93 | cmp $1, $2 94 | jl $3 95 | 96 | snippet jmple Conditional lower or equal jump 97 | cmp $1, $2 98 | jle $3 99 | 100 | snippet jmpe Conditional equal jump 101 | cmp $1, $2 102 | je $3 103 | 104 | snippet jmpn Conditional not equal jump 105 | cmp $1, $2 106 | jn $3 107 | 108 | snippet jmpg Conditional greater jump 109 | cmp $1, $2 110 | jg $3 111 | 112 | snippet jmpge Conditional greater or equal jump 113 | cmp $1, $2 114 | je $3 115 | 116 | snippet loopn Loop n times 117 | mov $1, %ecx 118 | 119 | et_for: 120 | $2 121 | 122 | loop et_for 123 | 124 | snippet loopnn Loop n-1 times 125 | mov $1, %ecx 126 | dec %ecx 127 | 128 | et_for: 129 | $2 130 | 131 | loop et_for 132 | 133 | snippet loopv Loop through a vector 134 | lea $1, %edi 135 | xor %ecx, %ecx 136 | 137 | et_for: 138 | cmp %ecx, $2 139 | je $3 140 | 141 | $4 142 | 143 | inc %ecx 144 | jmp et_for 145 | 146 | snippet mul Multiply 147 | xor %edx, %edx 148 | mov $1, %eax 149 | mul $2 150 | snippet mul64 Multiply numbers greater than 2^32 151 | mov $1, %edx 152 | mov $2, %eax 153 | mul $3 154 | snippet div Divide 155 | xor %edx, %edx 156 | mov $1, %eax 157 | div $2 158 | snippet div64 Divide numbers greater than 2^32 159 | mov $1, %edx 160 | mov $2, %eax 161 | div $3 162 | snippet pr Call printf 163 | pushl $1 164 | call printf 165 | popl $2 166 | snippet sc Call scanf 167 | pushl $1 168 | call scanf 169 | popl $2 170 | snippet mindex Current index from a matrix 171 | xor %edx, %edx 172 | movl $1, %eax 173 | mull $2 174 | addl $3, %eax 175 | snippet ffl Call fflush 176 | pushl \$0 177 | call fflush 178 | popl $1 179 | snippet at Call atoi 180 | pushl $1 181 | call atoi 182 | popl $2 183 | snippet len Call strlen 184 | pushl $1 185 | call strlen 186 | popl $2 187 | snippet proc Basic procedure 188 | $1: 189 | pushl %ebp 190 | movl %esp, %ebp 191 | 192 | $2 193 | 194 | popl %ebp 195 | ret 196 | -------------------------------------------------------------------------------- /snippets/autoit.snippets: -------------------------------------------------------------------------------- 1 | snippet if 2 | If $1 Then 3 | ${0:; True code} 4 | EndIf 5 | snippet el 6 | Else 7 | ${0} 8 | snippet eif 9 | ElseIf $1 Then 10 | ${0:; True code} 11 | # If/Else block 12 | snippet ife 13 | If $1 Then 14 | ${2:; True code} 15 | Else 16 | ${0:; Else code} 17 | EndIf 18 | # If/ElseIf/Else block - because there is eif this is not really neccessary 19 | snippet ifelif 20 | If ${1:condition 1} Then 21 | ${2:; True code} 22 | ElseIf ${3:condition 2} Then 23 | ${4:; True code} 24 | Else 25 | ${0:; Else code} 26 | EndIf 27 | # Switch block 28 | snippet switch 29 | Switch ($1) 30 | Case ${2:case1}: 31 | ${3:; Case 1 code} 32 | Case Else: 33 | ${0:; Else code} 34 | EndSwitch 35 | # Select block 36 | snippet select 37 | Select ($1) 38 | Case ${2:case1}: 39 | ${3:; Case 1 code} 40 | Case Else: 41 | ${0:; Else code} 42 | EndSelect 43 | # While loop 44 | snippet wh 45 | While ($1) 46 | ${0:; code...} 47 | WEnd 48 | # For loop 49 | snippet for 50 | For ${1:n} = ${3:1} to ${2:count} 51 | ${0:; code...} 52 | Next 53 | # New Function 54 | snippet func 55 | Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): 56 | ${0:Return} 57 | EndFunc 58 | # Message box 59 | snippet msg 60 | MsgBox(${0:MsgType}, ${1:"Title"}, ${2:"Message Text"}) 61 | # Debug Message 62 | snippet debug 63 | MsgBox(0, "Debug", ${0:"Debug Message"}) 64 | # Show Variable Debug Message 65 | snippet showvar 66 | MsgBox(0, "${0:VarName}", $1) 67 | -------------------------------------------------------------------------------- /snippets/awk.snippets: -------------------------------------------------------------------------------- 1 | # cannot use /usr/bin/env because it does not support parameters (as -f) 2 | snippet #! #!/usr/bin/awk -f 3 | #!/usr/bin/awk -f 4 | # @include is a gawk extension 5 | snippet inc @include 6 | @include "${1}"${0} 7 | # @load is a gawk extension 8 | snippet loa @load 9 | @load "${1}"${0} 10 | snippet beg BEGIN { ... } 11 | BEGIN { 12 | ${0} 13 | } 14 | # BEGINFILE is a gawk extension 15 | snippet begf BEGINFILE { ... } 16 | BEGINFILE { 17 | ${0} 18 | } 19 | snippet end END { ... } 20 | END { 21 | ${0} 22 | } 23 | # ENDFILE is a gawk extension 24 | snippet endf ENDFILE { ... } 25 | ENDFILE { 26 | ${0} 27 | } 28 | snippet pri print 29 | print ${1:"${2}"}${0} 30 | snippet printf printf 31 | printf("${1:%s}\n", ${2})${0} 32 | snippet ign IGNORECASE 33 | IGNORECASE = ${1:1} 34 | snippet if if {...} 35 | if (${1}) { 36 | ${0:${VISUAL}} 37 | } 38 | snippet ife if ... else ... 39 | if (${1}) { 40 | ${2:${VISUAL}} 41 | } else { 42 | ${0} 43 | } 44 | snippet eif else if ... 45 | else if (${1}) { 46 | ${0} 47 | } 48 | snippet el else {...} 49 | else { 50 | ${0} 51 | } 52 | snippet wh while 53 | while (${1}) { 54 | ${2} 55 | } 56 | snippet do do ... while 57 | do { 58 | ${0} 59 | } while (${1}) 60 | snippet for for 61 | for (${2:i} = 0; i < ${1:n}; ${3:++i}) { 62 | ${0} 63 | } 64 | snippet fore for each 65 | for (${1:i} in ${2:array}) { 66 | ${0} 67 | } 68 | # the switch is a gawk extension 69 | snippet sw switch 70 | switch (${1}) { 71 | case ${2}: 72 | ${3} 73 | break 74 | default: 75 | ${0} 76 | break 77 | } 78 | # the switch is a gawk extension 79 | snippet case case 80 | case ${1}: 81 | ${0} 82 | break 83 | -------------------------------------------------------------------------------- /snippets/bash.snippets: -------------------------------------------------------------------------------- 1 | extends sh 2 | 3 | # Shebang 4 | snippet #! 5 | #!/usr/bin/env bash 6 | 7 | snippet s#! 8 | #!/usr/bin/env bash 9 | set -eu 10 | 11 | snippet if 12 | if [[ $1 ]]; then 13 | ${0:${VISUAL}} 14 | fi 15 | snippet elif 16 | elif [[ $1 ]]; then 17 | ${0:${VISUAL}} 18 | snippet wh 19 | while [[ $1 ]]; do 20 | ${0:${VISUAL}} 21 | done 22 | snippet until 23 | until [[ $1 ]]; do 24 | ${0:${VISUAL}} 25 | done 26 | -------------------------------------------------------------------------------- /snippets/clojure.snippets: -------------------------------------------------------------------------------- 1 | snippet comm 2 | (comment 3 | ${0}) 4 | snippet condp 5 | (condp ${1:pred} ${2:expr} 6 | ${0}) 7 | snippet def 8 | (def ${0}) 9 | snippet defm 10 | (defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}] 11 | ${0:code}) 12 | snippet defmm 13 | (defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn}) 14 | snippet defma 15 | (defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn}) 16 | snippet defn 17 | (defn ${1:name} "${2:doc-string}" [${3:arg-list}] 18 | ${0:code}) 19 | snippet defp 20 | (defprotocol ${1:name} 21 | ${0:code}) 22 | snippet defr 23 | (defrecord ${1:name} [${2:fields}] 24 | ${3:protocol} 25 | ${0:code}) 26 | snippet deft 27 | (deftest ${1:name} 28 | (is (= ${0:assertion}))) 29 | snippet is 30 | (is (= ${1} ${0})) 31 | snippet defty 32 | (deftype ${1:Name} [${2:fields}] 33 | ${3:Protocol} 34 | ${0:code}) 35 | snippet doseq 36 | (doseq [${1:elem} ${2:coll}] 37 | ${0:code}) 38 | snippet fn 39 | (fn [${1:arg-list}] ${0:code}) 40 | snippet if 41 | (if ${1:test-expr} 42 | ${2:then-expr} 43 | ${0:else-expr}) 44 | snippet if-let 45 | (if-let [${1:result} ${2:test-expr}] 46 | (${3:then-expr} $1) 47 | (${0:else-expr})) 48 | snippet imp 49 | (:import [${1:package}]) 50 | & {:keys [${1:keys}] :or {${0:defaults}}} 51 | snippet let 52 | (let [${1:name} ${2:expr}] 53 | ${0:code}) 54 | snippet letfn 55 | (letfn [(${1:name}) [${2:args}] 56 | ${0:code})]) 57 | snippet map 58 | (map ${1:func} ${0:coll}) 59 | snippet mapl 60 | (map #(${1:lambda}) ${0:coll}) 61 | snippet met 62 | (${1:name} [${2:this} ${3:args}] 63 | ${0:code}) 64 | snippet ns 65 | (ns ${0:name}) 66 | snippet dotimes 67 | (dotimes [_ 10] 68 | (time 69 | (dotimes [_ ${1:times}] 70 | ${0:code}))) 71 | snippet pmethod 72 | (${1:name} [${2:this} ${0:args}]) 73 | snippet refer 74 | (:refer-clojure :exclude [${0}]) 75 | snippet require 76 | (:require [${1:namespace} :as [${0}]]) 77 | snippet use 78 | (:use [${1:namespace} :only [${0}]]) 79 | snippet print 80 | (println ${0}) 81 | snippet reduce 82 | (reduce ${1:(fn [p n] ${3})} ${2}) 83 | snippet when 84 | (when ${1:test} $0) 85 | snippet when-let 86 | (when-let [${1:result} ${2:test}] 87 | $0) 88 | -------------------------------------------------------------------------------- /snippets/cmake.snippets: -------------------------------------------------------------------------------- 1 | snippet init 2 | cmake_minimum_required(VERSION ${1:2.8.2}) 3 | project(${2:ProjectName}) 4 | 5 | find_package(${3:library}) 6 | 7 | include_directories(${$3_INCLUDE_DIRS}) 8 | 9 | add_subdirectory(${0:src}) 10 | 11 | add_executable($2) 12 | 13 | target_link_libraries($2 ${$3_LIBRARIES}) 14 | 15 | snippet proj 16 | project(${0:Name}) 17 | 18 | snippet min 19 | cmake_minimum_required(VERSION ${0:2.8.2}) 20 | 21 | snippet include 22 | include_directories(${${0:include_dir}}) 23 | 24 | snippet find 25 | find_package(${1:library} ${0:REQUIRED}) 26 | 27 | snippet glob 28 | file(glob ${1:srcs} *.${0:cpp}) 29 | 30 | snippet subdir 31 | add_subdirectory(${0:src}) 32 | 33 | snippet lib 34 | add_library(${1:lib} ${${0:srcs}}) 35 | 36 | snippet link 37 | target_link_libraries(${1:bin} ${0:somelib}) 38 | 39 | snippet bin 40 | add_executable(${1:bin}) 41 | 42 | snippet set 43 | set(${1:var} ${0:val}) 44 | 45 | snippet dep 46 | add_dependencies(${1:target} 47 | ${0:dep} 48 | ) 49 | 50 | snippet Ext_url 51 | include(ExternalProject) 52 | ExternalProject_Add(${1:googletest} 53 | URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip} 54 | URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af} 55 | SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}" 56 | BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}" 57 | CONFIGURE_COMMAND "" 58 | BUILD_COMMAND "" 59 | INSTALL_COMMAND "" 60 | TEST_COMMAND "" 61 | ) 62 | 63 | snippet Ext_git 64 | include(ExternalProject) 65 | ExternalProject_Add(${1:googletest} 66 | GIT_REPOSITORY ${2:https://github.com/google/googletest.git} 67 | GIT_TAG ${3:master} 68 | SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}" 69 | BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}" 70 | CONFIGURE_COMMAND "" 71 | BUILD_COMMAND "" 72 | INSTALL_COMMAND "" 73 | TEST_COMMAND "" 74 | ) 75 | 76 | snippet props 77 | set_target_properties(${1:target} 78 | ${2:properties} ${3:compile_flags} 79 | ${0:"-O3 -Wall -pedantic"} 80 | ) 81 | 82 | snippet test 83 | add_test(${1:ATestName} ${0:testCommand --options}) 84 | -------------------------------------------------------------------------------- /snippets/coffee/coffee.snippets: -------------------------------------------------------------------------------- 1 | # Closure loop 2 | snippet forindo 3 | for ${1:name} in ${2:array} 4 | do ($1) -> 5 | $0 6 | # Array comprehension 7 | snippet fora 8 | for ${1:name} in ${2:array} 9 | $0 10 | # Object comprehension 11 | snippet foro 12 | for ${1:key}, ${2:value} of ${3:object} 13 | $0 14 | # Range comprehension (inclusive) 15 | snippet forr 16 | for ${1:name} in [${2:start}..${3:finish}] 17 | $0 18 | snippet forrb 19 | for ${1:name} in [${2:start}..${3:finish}] by ${4:step} 20 | $0 21 | # Range comprehension (exclusive) 22 | snippet forrex 23 | for ${1:name} in [${2:start}...${3:finish}] 24 | $0 25 | snippet forrexb 26 | for ${1:name} in [${2:start}...${3:finish}] by ${4:step} 27 | $0 28 | # Function 29 | snippet fun 30 | (${1:args}) -> 31 | $0 32 | # Function (bound) 33 | snippet bfun 34 | (${1:args}) => 35 | $0 36 | # Class 37 | snippet cla class .. 38 | class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} 39 | ${0} 40 | snippet cla class .. constructor: .. 41 | class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} 42 | constructor: (${2:args}) -> 43 | ${3} 44 | 45 | ${0} 46 | snippet cla class .. extends .. 47 | class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} 48 | ${0} 49 | snippet cla class .. extends .. constructor: .. 50 | class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} 51 | constructor: (${3:args}) -> 52 | ${4} 53 | 54 | ${0} 55 | # If 56 | snippet if 57 | if $1 58 | ${0:${VISUAL}} 59 | # If __ Else 60 | snippet ife 61 | if $1 62 | ${2:${VISUAL}} 63 | else 64 | ${0} 65 | # Else if 66 | snippet eif 67 | else if $1 68 | ${0:${VISUAL}} 69 | # Ternary If 70 | snippet ifte Ternary 71 | if $1 then $2 else $0 72 | # Unless 73 | snippet unl Unless 74 | $1 unless $0 75 | # Switch 76 | snippet swi 77 | switch ${1:object} 78 | when ${2:value} 79 | $0 80 | 81 | # Log 82 | snippet log 83 | console.log ${0} 84 | # Try __ Catch 85 | snippet try 86 | try 87 | ${1:${VISUAL}} 88 | catch ${2:error} 89 | ${0} 90 | # Require 91 | snippet req 92 | ${2:$1} = require '${1:sys}' 93 | # Export 94 | snippet exp 95 | ${0:root} = exports ? this 96 | 97 | snippet jsonp 98 | JSON.parse ${0:jstr} 99 | # JSON.stringify 100 | snippet jsons 101 | JSON.stringify ${0:object} 102 | -------------------------------------------------------------------------------- /snippets/coffee/requirejs_coffee.snippets: -------------------------------------------------------------------------------- 1 | snippet def 2 | define ["${1:#dependencies1}"], (${2:#dependencies2}) -> 3 | ${0:TARGET} 4 | 5 | snippet defn 6 | define "${1:#name}", ["${2:#dependencies1}"], (${3:#dependencies2}) -> 7 | ${0:TARGET} 8 | 9 | snippet reqjs 10 | require ["${1:#dependencies1}"], (${2:#dependencies2}) -> 11 | ${0:TARGET} 12 | -------------------------------------------------------------------------------- /snippets/crystal.snippets: -------------------------------------------------------------------------------- 1 | snippet req require 2 | require "${1}" 3 | snippet case 4 | case $1 5 | when $2 6 | ${0} 7 | end 8 | snippet when 9 | when $1 10 | ${0} 11 | snippet def 12 | def ${1:method_name} 13 | ${0} 14 | end 15 | snippet pdef 16 | private def ${1:method_name} 17 | ${0} 18 | end 19 | snippet if 20 | if $1 21 | ${0:${VISUAL}} 22 | end 23 | snippet ife 24 | if $1 25 | ${2:${VISUAL}} 26 | else 27 | ${0} 28 | end 29 | snippet wh 30 | while $1 31 | ${0:${VISUAL}} 32 | end 33 | snippet cla class .. end 34 | class ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`} 35 | ${0} 36 | end 37 | snippet mod class .. end 38 | module ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`} 39 | ${0} 40 | end 41 | snippet r 42 | getter ${0:name} 43 | snippet r! 44 | getter! ${0:name} 45 | snippet r? 46 | getter? ${0:name} 47 | snippet w 48 | setter ${0:name} 49 | snippet w! 50 | setter! ${0:name} 51 | snippet w? 52 | setter? ${0:name} 53 | snippet rw 54 | property ${0:name} 55 | snippet rw! 56 | property! ${0:name} 57 | snippet rw? 58 | property? ${0:name} 59 | snippet defs 60 | def self.${1:class_method_name} 61 | ${0} 62 | end 63 | snippet defi 64 | def initialize(${1}) 65 | ${0} 66 | end 67 | snippet do 68 | do 69 | ${0:${VISUAL}} 70 | end 71 | snippet dov 72 | do |${1:v}| 73 | ${2} 74 | end 75 | snippet desc 76 | describe ${1:`substitute(substitute(vim_snippets#Filename(), "_spec$", "", ""), "\(_\|^\)\(.\)", "\u\2", "g")`} do 77 | ${0} 78 | end 79 | snippet it 80 | it "${1}" do 81 | ${0} 82 | end 83 | -------------------------------------------------------------------------------- /snippets/cuda.snippets: -------------------------------------------------------------------------------- 1 | extends cpp 2 | 3 | snippet kern "Kernel definition" 4 | __global__ void ${1:kernel}(${2:void}) { 5 | ${0:// TODO: Implement} 6 | } 7 | 8 | snippet dev "Device function definition" 9 | __device__ ${1:int} ${2:foo}(${3:void}) { 10 | ${0:// TODO: Implement} 11 | return 0; 12 | } 13 | 14 | snippet call "Kernel call" 15 | ${1:kernel}<<<${2:args}>>>(${3});${0} 16 | 17 | snippet sync "Synchonize threads" 18 | __syncthreads(); 19 | 20 | snippet tid "Thread Index" 21 | threadIdx.${0} 22 | 23 | snippet bid "Block Index" 24 | blockIdx.${0} 25 | 26 | snippet bdim "Block Dimension" 27 | blockDim.${0} 28 | 29 | snippet ii "Get current index (1D)" 30 | int ${1:index} = threadIdx.${2:x} + blockIdx.$2 * blockDim.$2; 31 | 32 | snippet ix "Get current X index (1D)" 33 | int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; 34 | 35 | snippet iy "Get current Y index (1D)" 36 | int ${1:y} = threadIdx.y + blockIdx.y * blockDim.y; 37 | 38 | snippet iz "Get current Z index (1D)" 39 | int ${1:z} = threadIdx.z + blockIdx.z * blockDim.z; 40 | 41 | snippet ixy "Get current X,Y index (2D)" 42 | int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; 43 | int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y; 44 | 45 | snippet ixz "Get current X,Z index (2D)" 46 | int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; 47 | int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z; 48 | 49 | snippet iyz "Get current Y,Z index (2D)" 50 | int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y; 51 | int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z; 52 | 53 | snippet ixyz "Get current X,Y,Z index (3D)" 54 | int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; 55 | int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y; 56 | int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z; 57 | 58 | snippet share "Shared memory declaration" 59 | __shared__ ${1:int} ${2:memo}[${3:SIZE}];${0} 60 | -------------------------------------------------------------------------------- /snippets/dart-flutter.snippets: -------------------------------------------------------------------------------- 1 | # Snippets for dart in flutter project, to use add the following to your .vimrc 2 | # `autocmd BufRead,BufNewFile,BufEnter *.dart UltiSnipsAddFiletypes dart-flutter` 3 | # Flutter stateless widget 4 | snippet stless 5 | class $1 extends StatelessWidget { 6 | const $1({super.key}); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | $2 12 | ); 13 | } 14 | } 15 | 16 | # Flutter stateful widget 17 | snippet stful 18 | class $1 extends StatefulWidget { 19 | const $1({super.key}); 20 | 21 | @override 22 | State<$1> createState() => _$1State(); 23 | } 24 | 25 | class _$1State extends State<$1> { 26 | @override 27 | Widget build(BuildContext context) { 28 | return Container( 29 | $2 30 | ); 31 | } 32 | } 33 | 34 | # Flutter widget with AnimationController 35 | snippet stanim 36 | class $1 extends StatefulWidget { 37 | const $1({super.key}); 38 | 39 | @override 40 | State<$1> createState() => _$1State(); 41 | } 42 | 43 | class _$1State extends State<$1> 44 | with SingleTickerProviderStateMixin { 45 | AnimationController _controller; 46 | 47 | @override 48 | void initState() { 49 | super.initState(); 50 | _controller = AnimationController(vsync: this); 51 | } 52 | 53 | @override 54 | void dispose() { 55 | super.dispose(); 56 | _controller.dispose(); 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Container( 62 | $2 63 | ); 64 | } 65 | } 66 | 67 | # Flutter scaffold application 68 | snippet fsa 69 | void main() { 70 | runApp( 71 | MaterialApp( 72 | title: 'Flutter Demo', 73 | theme: ThemeData( 74 | primarySwatch: Colors.blue, 75 | ), 76 | debugShowCheckedModeBanner: false, 77 | home: const HomePage(), 78 | ), 79 | ); 80 | } 81 | 82 | class HomePage extends StatelessWidget { 83 | const HomePage({Key? key}) : super(key: key); 84 | 85 | @override 86 | Widget build(BuildContext context) { 87 | return Scaffold( 88 | appBar: AppBar( 89 | title: const Text('Home Page'), 90 | ), 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /snippets/dart.snippets: -------------------------------------------------------------------------------- 1 | snippet af 2 | (${1}) {${2}}${0} 3 | snippet pr 4 | print(${1}); 5 | snippet deb 6 | debugger(); 7 | ${0} 8 | snippet lib 9 | library ${1}; 10 | ${0} 11 | snippet im 12 | import 'package:${1}/${2}.dart'; 13 | ${0} 14 | snippet rgx 15 | new RegExp(r'${1}') 16 | snippet var 17 | var ${1} = ${2}; 18 | snippet main 19 | main() { 20 | ${0} 21 | } 22 | snippet st 23 | static ${0} 24 | snippet fi 25 | final ${0} 26 | snippet re 27 | return ${0} 28 | snippet br 29 | break; 30 | snippet th 31 | throw ${0} 32 | snippet cl 33 | class ${1:`vim_snippets#Filename("", "untitled")`} ${0} 34 | snippet in 35 | interface ${1:`vim_snippets#Filename("", "untitled")`} ${0} 36 | snippet imp 37 | implements ${0} 38 | snippet ext 39 | extends ${0} 40 | snippet if 41 | if (${1:true}) { 42 | ${0} 43 | } 44 | snippet ife 45 | if (${1:true}) { 46 | ${2} 47 | } else { 48 | ${0} 49 | } 50 | snippet el 51 | else 52 | snippet sw 53 | switch (${1}) { 54 | ${0} 55 | } 56 | snippet cs 57 | case ${1}: 58 | ${0} 59 | snippet de 60 | default: 61 | ${0} 62 | snippet for 63 | for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) { 64 | ${0:$1[$2]} 65 | } 66 | snippet fore 67 | for (final ${2:item} in ${1:itemList}) { 68 | ${0} 69 | } 70 | snippet wh 71 | while ($1) { 72 | ${0} 73 | } 74 | snippet dowh 75 | do { 76 | ${0} 77 | } while ($0); 78 | snippet as 79 | assert($0); 80 | snippet try 81 | try { 82 | ${0:${VISUAL}} 83 | } catch (${1:Exception e}) { 84 | } 85 | snippet tryf 86 | try { 87 | ${0:${VISUAL}} 88 | } catch (${1:Exception e}) { 89 | } finally { 90 | } 91 | -------------------------------------------------------------------------------- /snippets/diff.snippets: -------------------------------------------------------------------------------- 1 | # DEP-3 (http://dep.debian.net/deps/dep3/) style patch header 2 | snippet header DEP-3 style header 3 | Description: ${1} 4 | Origin: ${2:vendor|upstream|other}, ${3:url of the original patch} 5 | Bug: ${4:url in upstream bugtracker} 6 | Forwarded: ${5:no|not-needed|url} 7 | Author: ${6:`g:snips_author`} 8 | Reviewed-by: ${7:name and email} 9 | Last-Update: ${8:`strftime("%Y-%m-%d")`} 10 | Applied-Upstream: ${0:upstream version|url|commit} 11 | 12 | -------------------------------------------------------------------------------- /snippets/dosini.snippets: -------------------------------------------------------------------------------- 1 | snippet ec 2 | ; http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = ${1:space_or_tab} 8 | indent_size = ${2:indent_size} 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | -------------------------------------------------------------------------------- /snippets/eelixir.snippets: -------------------------------------------------------------------------------- 1 | extends html 2 | 3 | snippet % <% %> 4 | <% ${0} %> 5 | snippet = <%= %> 6 | <%= ${0} %> 7 | snippet # <%# %> 8 | <%# ${0} %> 9 | snippet end 10 | <% end %> 11 | snippet for 12 | <%= for ${1:item} <- ${2:items} ${3:@conn} do %> 13 | ${0} 14 | <% end %> 15 | snippet if 16 | <%= if ${1} do %> 17 | ${0:${VISUAL}} 18 | <% end %> 19 | snippet ife 20 | <%= if ${1} do %> 21 | ${2:${VISUAL}} 22 | <% else %> 23 | ${0} 24 | <% end %> 25 | snippet cond 26 | <%= cond do %> 27 | <% ${1} -> %> 28 | ${2:${VISUAL}} 29 | 30 | <% true -> %> 31 | ${0} 32 | <% end %> 33 | snippet unless 34 | <%= unless ${1} do %> 35 | ${0:${VISUAL}} 36 | <% end %> 37 | snippet ft form_tag 38 | <%= form_tag(${1:"/users"}, method: ${2::post}) %> 39 | ${0} 40 | 41 | 42 | snippet sl select 43 | <%= select ${1:f}, :${2:field}, ${3:[{"key", "value"}]}, prompt: ${4:"Prompt"} %> 44 | 45 | snippet sb submit 46 | <%= submit ${1:"Submit"} %> 47 | 48 | snippet rb radio_button 49 | <%= radio_button ${1:f}, :${2:field}, ${3:"value"} %> 50 | 51 | 52 | snippet et error_tag 53 | <%= error_tag ${1:f}, :${2:field} %> 54 | snippet ti text_input 55 | <%= text_input ${1:f}, :${2:field} %> 56 | snippet la label 57 | <%= label ${1:f}, :${2:field}, "${3:Label}" %> 58 | snippet pi password_input 59 | <%= password_input ${1:f}, :${2:password} %> 60 | snippet render 61 | <%= render "${1:index}.html", ${2:var: @var} %> 62 | snippet lin link 63 | <%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %> 64 | snippet ff form_for 65 | <%= form_for @changeset, ${1:"/users"}, fn f -> %> 66 | ${0} 67 | 68 | <%= submit "Submit" %> 69 | <% end %> 70 | snippet pry 71 | <% require IEx; IEx.pry %> 72 | -------------------------------------------------------------------------------- /snippets/elm.snippets: -------------------------------------------------------------------------------- 1 | snippet mod 2 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1}) 3 | ${0} 4 | snippet imp 5 | import ${0:Http} 6 | snippet impe 7 | import ${1:Html} exposing (${0:..}) 8 | snippet impae 9 | import ${1:Json.Encode} as ${2:Encode} exposing (${0:Value}) 10 | snippet fn 11 | ${1:fn} : ${2:a} -> ${3:a} 12 | $1 ${4} = 13 | ${0} 14 | snippet fn1 15 | ${1:fn} : ${2:a} -> ${3:a} 16 | $1 ${4} = 17 | ${0} 18 | snippet fn2 19 | ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} 20 | $1 ${5} = 21 | ${0} 22 | snippet fn3 23 | ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} 24 | $1 ${6} = 25 | ${0} 26 | snippet fn0 27 | ${1:fn} : ${2:a} 28 | $1 = 29 | ${0} 30 | snippet case 31 | case ${1} of 32 | ${2} -> 33 | ${0} 34 | snippet - 35 | ${1} -> 36 | ${0} 37 | snippet let 38 | let 39 | ${1} = 40 | ${2} 41 | in 42 | ${0} 43 | snippet if 44 | if ${1} then 45 | ${2:${VISUAL}} 46 | else 47 | ${0} 48 | snippet ty 49 | type ${1:Msg} 50 | = ${0} 51 | snippet tya 52 | type alias ${1:Model} = 53 | ${0} 54 | snippet test 55 | test "${1}" <| \_ -> $0 56 | snippet desc 57 | describe "${1}" [ $0 ] 58 | snippet doc 59 | {-| ${0} 60 | -} 61 | snippet p 62 | |> ${0} 63 | snippet program Elm 0.18 program 64 | import Html exposing (Html) 65 | 66 | 67 | type alias Model = 68 | {} 69 | 70 | 71 | type Msg 72 | = Noop 73 | 74 | 75 | main : Program Never Model Msg 76 | main = 77 | Html.program 78 | { init = init 79 | , view = view 80 | , update = update 81 | , subscriptions = subscriptions 82 | } 83 | 84 | 85 | init : ( Model, Cmd Msg ) 86 | init = 87 | {} ! [] 88 | 89 | 90 | update : Msg -> Model -> ( Model, Cmd Msg ) 91 | update msg model = 92 | case msg of 93 | Noop -> 94 | model ! [] 95 | 96 | 97 | subscriptions : Model -> Sub Msg 98 | subscriptions model = 99 | Sub.none 100 | 101 | 102 | view : Model -> Html Msg 103 | view model = 104 | Html.text "Hello, sailor!" 105 | snippet element 106 | module Main exposing (Model, Msg(..), init, main, subscriptions, update, view) 107 | 108 | import Browser 109 | import Html exposing (..) 110 | import Json.Encode 111 | 112 | 113 | main : Program Flags Model Msg 114 | main = 115 | Browser.element 116 | { init = init 117 | , update = update 118 | , subscriptions = subscriptions 119 | , view = view 120 | } 121 | 122 | 123 | type alias Model = 124 | {} 125 | 126 | 127 | type alias Flags = 128 | Json.Encode.Value 129 | 130 | 131 | init : Flags -> ( Model, Cmd Msg ) 132 | init flags_ = 133 | ( {} 134 | , Cmd.none 135 | ) 136 | 137 | 138 | type Msg 139 | = Noop 140 | 141 | 142 | update : Msg -> Model -> ( Model, Cmd Msg ) 143 | update msg model = 144 | case msg of 145 | Noop -> 146 | ( model 147 | , Cmd.none 148 | ) 149 | 150 | 151 | subscriptions : Model -> Sub Msg 152 | subscriptions model = 153 | Sub.none 154 | 155 | 156 | view : Model -> Html Msg 157 | view model = 158 | h1 [] [ text "Hello, world!" ] 159 | -------------------------------------------------------------------------------- /snippets/falcon.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env falcon 3 | 4 | # Import 5 | snippet imp 6 | import ${0:module} 7 | 8 | # Function 9 | snippet fun 10 | function ${2:function_name}(${3}) 11 | ${0} 12 | end 13 | 14 | # Class 15 | snippet class 16 | class ${1:class_name}(${2:class_params}) 17 | ${0:/* members/methods */} 18 | end 19 | 20 | # If 21 | snippet if 22 | if $1 23 | ${0} 24 | end 25 | 26 | # If else 27 | snippet ife 28 | if $1 29 | ${0} 30 | else 31 | ${1} 32 | end 33 | 34 | # If else if 35 | snippet eif 36 | elif $1 37 | ${0} 38 | 39 | # Switch case 40 | snippet switch 41 | switch ${1:expression} 42 | case ${2:item} 43 | case ${0:item} 44 | default 45 | end 46 | 47 | # Select 48 | snippet select 49 | select ${1:variable} 50 | case ${2:TypeSpec} 51 | case ${0:TypeSpec} 52 | default 53 | end 54 | 55 | # For/in Loop 56 | snippet forin 57 | for ${1:element} in ${2:container} 58 | ${0} 59 | end 60 | 61 | # For/to Loop 62 | snippet forto 63 | for ${1:lowerbound} to ${2:upperbound} 64 | ${0} 65 | end 66 | 67 | # While Loop 68 | snippet wh 69 | while ${1:conidition} 70 | ${0} 71 | end 72 | -------------------------------------------------------------------------------- /snippets/fortran.snippets: -------------------------------------------------------------------------------- 1 | snippet impl 2 | implicit none 3 | ${0} 4 | snippet prog 5 | program ${1:main} 6 | ${0} 7 | end program $1 8 | snippet mod 9 | module ${1:modulename} 10 | ${0} 11 | end module $1 12 | snippet proc 13 | procedure ${1:name} 14 | ${0} 15 | end procedure $1 16 | snippet iface 17 | interface ${1:name} 18 | ${0} 19 | end interface $1 20 | snippet doc 21 | ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 22 | ! File: ${2:`vim_snippets#Filename('$1')`} 23 | ! Author: `g:snips_author` 24 | ! Email: `g:snips_email` 25 | ! Github: `g:snips_github` 26 | ! Description: $1 27 | ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 28 | ${0} 29 | snippet dox 30 | !> @brief ${1} 31 | !! 32 | !> ${2} 33 | !> @author `g:snips_author` 34 | ${0} 35 | snippet doxp 36 | !> @param[${1}]${0} 37 | # Variables definitions 38 | # Boolean 39 | snippet bool 40 | logical :: ${0} 41 | # Integer 42 | snippet int 43 | integer :: ${0} 44 | snippet real 45 | real :: ${0} 46 | # Double Precision 47 | snippet double 48 | double precision :: ${0} 49 | # Char 50 | snippet str 51 | character(len=${1:*}) :: ${0:} 52 | # Types 53 | snippet type 54 | type(${1:name}) 55 | ${0} 56 | end type 57 | snippet const 58 | ${1:type}, parameter :: $2 = ${0} 59 | snippet arr 60 | ${1:type}, ${2:allocatable, }dimension(${3::}) :: ${0} 61 | snippet intent 62 | ${1:type}, intent(inout) :: ${0} 63 | # Array 64 | snippet / 65 | (/ $1 /) ${2:,&} ${0} 66 | snippet if 67 | if ($1) then 68 | ${0} 69 | end if 70 | snippet case 71 | select case (${1:expr}) 72 | case ($2) 73 | case default 74 | $3 75 | end select ${0} 76 | snippet do 77 | do ${1:i} = ${2:start}, ${3:end}, ${4:incr} 78 | ${0} 79 | end do 80 | snippet dow 81 | do while ($1) 82 | $2 83 | end do 84 | snippet sub 85 | subroutine ${1:name}($2) 86 | ${0} 87 | end subroutine $1 88 | snippet func 89 | function ${1:name}($2) result($3) 90 | ${0} 91 | end function $1 92 | snippet pr 93 | write(*,*) ${0} 94 | snippet dpr 95 | write(*,*) '$1 = ', $1 96 | snippet read 97 | read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0} 98 | snippet write 99 | write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0} 100 | snippet open 101 | open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) ${0} 102 | snippet close 103 | close(unit = ${1:fp}) ${0} 104 | -------------------------------------------------------------------------------- /snippets/freemarker.snippets: -------------------------------------------------------------------------------- 1 | extends html 2 | 3 | # Freemarker version 4 | snippet ver "${.version}" 5 | \${.version} 6 | # Interpolation 7 | snippet int "${interpolation}" 8 | \${${0:interpolation${VISUAL}}\} 9 | # Interpolation with default string 10 | snippet intd "${interpolation!"default_string"}" 11 | \${${0:interpolation${VISUAL}}!"${1:default_string}"\} 12 | # Comment 13 | snippet com "<#-- comment -->" 14 | <#-- ${0:comment${VISUAL}} --> 15 | # Variable assignment on a single line 16 | snippet ass "<#assign variable_name = value />" 17 | <#assign ${1:variable_name} = ${0:value${VISUAL}} /> 18 | # Variable assignments on multiple lines 19 | snippet assm "<#assign <#-- multiple lines --> />" 20 | <#assign 21 | ${1:variable_name} = ${0:value${VISUAL}} 22 | /> 23 | # Local variable assignment on a single 24 | snippet loc "<#local variable_name = value />" 25 | <#local ${1:variable_name} = ${0:value${VISUAL}} /> 26 | # Local variable assignments on multiple lines 27 | snippet locm "<#local <#-- multiple lines --> />" 28 | <#local 29 | ${1:variable_name} = ${0:value${VISUAL}} 30 | /> 31 | # Include Freemarker file 32 | snippet inc "<#include \"file.ftl\" />" 33 | <#include "${0:file.ftl${VISUAL}}" /> 34 | # If statement 35 | snippet if "<#if condition>..." 36 | <#if ${1:true}> 37 | ${0:${VISUAL}} 38 | 39 | # If/else statement 40 | snippet ife "<#if condition>...<#else>..." 41 | <#if ${1:true}> 42 | ${0:${VISUAL}} 43 | <#else> 44 | ${2} 45 | 46 | # Iteration over a sequence 47 | snippet lis "<#list sequence as element>..." 48 | <#list ${1:sequence} as ${2:element}> 49 | ${0:${VISUAL}} 50 | 51 | # Iteration over an hashmap 52 | snippet lish "<#list hashmap?keys as element>..." 53 | <#list ${1:hashmap}?keys as ${2:key}> 54 | \${$2\}: \${$1[$2]\}${0:${VISUAL}} 55 | 56 | # Macro statement 57 | snippet mac "<#macro macro_name param1>..." 58 | <#macro ${1:macro_name} ${2:param1}> 59 | ${0:${VISUAL}} 60 | 61 | # Function statement 62 | snippet fun "<#function function_name param1>..." 63 | <#function ${1:function_name} ${2:param1}> 64 | ${0:${VISUAL}} 65 | 66 | # Attempt statement (try-catch to prevent runtime exceptions) 67 | snippet att "<#attempt>...<#recover>" 68 | <#attempt> 69 | ${0:${VISUAL}} 70 | <#recover> 71 | 72 | # Then built-in for booleans 73 | snippet ?th "?then(true, false)" 74 | ?then(${1:true}, ${0:false${VISUAL}}) 75 | -------------------------------------------------------------------------------- /snippets/fsharp.snippets: -------------------------------------------------------------------------------- 1 | snippet doc 2 | /// ${0} 3 | snippet comment 4 | // ${0} 5 | snippet let 6 | let ${1} = ${0} 7 | snippet lit 8 | [] 9 | let ${1} = ${0} 10 | snippet rec 11 | type ${1} = { ${0} } 12 | snippet arec 13 | {| ${0} |} 14 | snippet fn 15 | let ${1} = 16 | ${0} 17 | snippet fnr 18 | let rec ${1} = 19 | ${0} 20 | snippet lam 21 | (fun ${1} -> ${0}) 22 | snippet mod 23 | module ${1} = 24 | ${0} 25 | snippet for 26 | for ${1} in ${2} do 27 | ${0} 28 | snippet if 29 | if ${1} then 30 | ${2} 31 | snippet ife 32 | if ${1} then 33 | ${2} 34 | else 35 | ${0} 36 | snippet ifee 37 | if ${1} then 38 | ${2} 39 | elif ${3} then 40 | ${4} 41 | else 42 | ${0} 43 | snippet eif 44 | elif ${1} then 45 | ${0} 46 | snippet el 47 | else 48 | ${0} 49 | snippet try 50 | try 51 | ${1} 52 | with ${0} 53 | snippet match 54 | match ${1} with 55 | | ${2} -> ${0} 56 | snippet | 57 | | ${1} -> ${0} 58 | snippet p 59 | |> ${0} 60 | snippet pr 61 | printfn "${1}" ${0} 62 | snippet pri 63 | printfn \$"${0}" 64 | snippet amap 65 | |> Array.map (fun ${1} -> ${0}) 66 | snippet lmap 67 | |> List.map (fun ${1} -> ${0}) 68 | snippet smap 69 | |> Seq.map (fun ${1} -> ${0}) 70 | snippet atap 71 | |> Array.map (fun x -> printfn "%A" x; x) // tap 72 | snippet ltap 73 | |> List.map (fun x -> printfn "%A" x; x) // tap 74 | snippet stap 75 | |> Seq.map (fun x -> printfn "%A" x; x) // tap 76 | snippet main 77 | [] 78 | let main argv = 79 | ${0} 80 | 0 81 | -------------------------------------------------------------------------------- /snippets/gdscript.snippets: -------------------------------------------------------------------------------- 1 | snippet class 2 | class $1 extends ${2:Reference} 3 | \t$3 4 | 5 | 6 | snippet pr 7 | print($1) 8 | 9 | 10 | snippet ready 11 | func _ready(): 12 | \t${1:pass} 13 | 14 | 15 | snippet init 16 | func _init(): 17 | \t${1:pass} 18 | 19 | 20 | snippet process 21 | func _process(delta): 22 | \t${1:pass} 23 | 24 | 25 | snippet input 26 | func _input(event): 27 | \t${1:pass} 28 | 29 | 30 | snippet inpute 31 | func _input_event(event): 32 | \t${1:pass} 33 | 34 | 35 | snippet draw 36 | func _draw(): 37 | \t${1:pass} 38 | 39 | 40 | snippet guii 41 | func _gui_input(event): 42 | \t${1:pass} 43 | 44 | 45 | snippet for 46 | for $1 in $2: 47 | \t${3:pass} 48 | 49 | 50 | snippet for 51 | for $1 in range(${2:start}{$3:,end}): 52 | \t${4:pass} 53 | 54 | 55 | snippet if 56 | if ${1:condition}: 57 | \t${3:pass} 58 | elif ${2:condition}: 59 | \t${4:pass} 60 | else: 61 | \t${5:pass} 62 | 63 | 64 | snippet if 65 | if ${1:condition}: 66 | \t${2:pass} 67 | else: 68 | \t${3:pass} 69 | 70 | 71 | snippet if 72 | if ${1:condition}: 73 | \t${2:pass} 74 | 75 | 76 | snippet while 77 | while ${1:condition}: 78 | \t${2:pass} 79 | 80 | 81 | snippet func 82 | func ${1:method}(${2:args}): 83 | \t${3:pass} 84 | 85 | 86 | snippet signal 87 | signal ${1:signalname}(${2:args}) 88 | 89 | 90 | snippet export 91 | export(${1:type}${2:,other_configs}) var ${3:name}${4: = default}${5: setget } 92 | 93 | 94 | snippet var 95 | var ${1:name}${2: = default}${3: setget } 96 | 97 | 98 | snippet onready 99 | onready var ${1:name} = get_node($2) 100 | 101 | 102 | snippet is 103 | ${1:instance} is ${2:class} 104 | 105 | 106 | snippet in 107 | ${1:element} in ${$2:array} 108 | 109 | 110 | snippet gdscript 111 | extends ${1:BaseClass} 112 | 113 | # class member variables go here, for example: 114 | # var a = 2 115 | # var b = \textvar\ 116 | 117 | func _ready(): 118 | \t# Called every time the node is added to the scene. 119 | \t# Initialization here 120 | \tpass 121 | 122 | 123 | 124 | # snippet pass ##### do we really need this? 125 | # pass 126 | -------------------------------------------------------------------------------- /snippets/gitcommit.snippets: -------------------------------------------------------------------------------- 1 | snippet co 2 | Co-authored-by: ${1} <${2}> 3 | -------------------------------------------------------------------------------- /snippets/gleam.snippets: -------------------------------------------------------------------------------- 1 | snippet fn "fn" 2 | fn ${1:function_name}(${2}) -> ${3:Nil} { 3 | ${0:${VISUAL:todo}} 4 | } 5 | 6 | snippet pfn "pub fn" 7 | pub fn ${1:function_name}(${2}) -> ${3:Nil} { 8 | ${0:${VISUAL:todo}} 9 | } 10 | 11 | snippet test "test fn" 12 | pub fn ${1:name}_test() { 13 | ${0} 14 | } 15 | 16 | snippet af "anonymous fn" 17 | fn(${1}) { ${0:${VISUAL}} } 18 | 19 | snippet let "let binding" 20 | let ${1} = ${0} 21 | 22 | snippet l "let binding" 23 | let ${1} = ${0} 24 | 25 | snippet as "assert binding" 26 | let assert ${1} = ${0} 27 | 28 | snippet - "->" 29 | -> ${0} 30 | 31 | snippet case "case expression" 32 | case ${1} { 33 | ${2} -> ${0} 34 | } 35 | 36 | snippet ty "type" 37 | type ${1:Name} { 38 | ${0:$1} 39 | } 40 | 41 | snippet pty "pub type" 42 | pub type ${1:Name} { 43 | ${0:$1} 44 | } 45 | 46 | snippet tya "type alias" 47 | type ${1:Name} = 48 | ${0:$1} 49 | 50 | snippet ptya "pub type alias" 51 | pub type ${1:Name} = 52 | ${0:$1} 53 | 54 | snippet im "import" 55 | import ${0:gleam/result} 56 | 57 | snippet im. "import exposing" 58 | import ${1:gleam/result}.{${0}} 59 | 60 | snippet p "|>" 61 | |> ${0} 62 | 63 | snippet bl "block" 64 | { 65 | ${0:${VISUAL}} 66 | } 67 | 68 | snippet tf "fn(Type) -> Type" 69 | fn(${1}) -> ${0} 70 | 71 | snippet seq "should.equal" 72 | should.equal(${0:${VISUAL}}) 73 | 74 | snippet strue "should.be_true" 75 | should.be_true(${0:${VISUAL}}) 76 | 77 | snippet sfalse "should.be_false" 78 | should.be_false(${0:${VISUAL}}) 79 | -------------------------------------------------------------------------------- /snippets/haml.snippets: -------------------------------------------------------------------------------- 1 | snippet t 2 | %table 3 | %tr 4 | %th 5 | ${1:headers} 6 | %tr 7 | %td 8 | ${0:headers} 9 | snippet ul 10 | %ul 11 | %li 12 | ${0:item} 13 | %li 14 | snippet rp 15 | = render :partial => "${0:item}" 16 | snippet rpc 17 | = render :partial => "${1:item}", :collection => ${0:@$1s} 18 | snippet rpl 19 | = render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} } 20 | snippet rpo 21 | = render :partial => "${1:item}", :object => ${0:@$1} 22 | snippet lt 23 | = link_to ${1:name}, ${2:dest} 24 | snippet mt 25 | = mail_to ${1:email_address}, ${2:name} 26 | snippet mts 27 | = mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4} 28 | snippet ife 29 | - if $1 30 | ${2:${VISUAL}} 31 | - else 32 | ${0} 33 | snippet ifp 34 | - if $1.presence? 35 | ${0:${VISUAL}} 36 | snippet ntc 37 | = number_to_currency(${1}) 38 | -------------------------------------------------------------------------------- /snippets/handlebars.snippets: -------------------------------------------------------------------------------- 1 | snippet if # {{#if value}} ... {{/if}} 2 | {{#if ${1:value}}} 3 | ${0:${VISUAL}} 4 | {{/if}} 5 | snippet ifn # {{#unless value}} ... {{/unless}} 6 | {{#unless ${1:value}}} 7 | ${0:${VISUAL}} 8 | {{/unless}} 9 | snippet ife # {{#if value}} ... {{else}} .. {{/if}} 10 | {{#if ${1:value}}} 11 | ${2:${VISUAL}} 12 | {{else}} 13 | ${3} 14 | {{/if}} 15 | -------------------------------------------------------------------------------- /snippets/haskell.snippets: -------------------------------------------------------------------------------- 1 | snippet lang 2 | {-# LANGUAGE ${0:OverloadedStrings} #-} 3 | snippet haddock 4 | {-# OPTIONS_HADDOCK ${0:hide} #-} 5 | snippet ghc 6 | {-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-} 7 | snippet inline 8 | {-# INLINE ${0:name} #-} 9 | snippet info 10 | -- | 11 | -- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`} 12 | -- Copyright : ${2:Author} ${3:2011-2012} 13 | -- License : ${4:BSD3} 14 | -- 15 | -- Maintainer : ${5:email@something.com} 16 | -- Stability : ${6:experimental} 17 | -- Portability : ${7:unknown} 18 | -- 19 | -- ${0:Description} 20 | -- 21 | snippet imp 22 | import ${0:Data.Text} 23 | snippet import 24 | import ${0:Data.Text} 25 | snippet import2 26 | import ${1:Data.Text} (${0:head}) 27 | snippet impq 28 | import qualified ${1:Data.Text} as ${0:T} 29 | snippet importq 30 | import qualified ${1:Data.Text} as ${0:T} 31 | snippet inst 32 | instance ${1:Monoid} ${2:Type} where 33 | ${0} 34 | snippet ty 35 | type ${1:Type} = ${0:Type} 36 | snippet type 37 | type ${1:Type} = ${0:Type} 38 | snippet da 39 | data ${1:Type} = ${2:$1} ${0:Int} 40 | snippet data 41 | data ${1:Type} = ${2:$1} ${0:Int} 42 | snippet newtype 43 | newtype ${1:Type} = ${2:$1} ${0:Int} 44 | snippet class 45 | class ${1:Class} a where 46 | ${0} 47 | snippet module 48 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` ( 49 | ) where 50 | `expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""` 51 | 52 | snippet mod 53 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` 54 | ( ${1} 55 | ) where 56 | 57 | `expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""` 58 | snippet main 59 | main :: IO () 60 | main = ${0:undefined} 61 | snippet const 62 | ${1:name} :: ${2:a} 63 | $1 = ${0:undefined} 64 | snippet fn 65 | ${1:fn} :: ${2:a} -> ${3:a} 66 | $1 ${4} = ${0:undefined} 67 | snippet fn0 68 | ${1:fn} :: ${2:a} 69 | $1 = ${0:undefined} 70 | snippet fn1 71 | ${1:fn} :: ${2:a} -> ${3:a} 72 | $1 ${4} = ${0:undefined} 73 | snippet fn2 74 | ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} 75 | $1 ${5} = ${0:undefined} 76 | snippet fn3 77 | ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} 78 | $1 ${6} = ${0:undefined} 79 | snippet => "Type constraint" 80 | (${1:Class} ${2:a}) => $2 81 | snippet ap 82 | ${1:map} ${2:fn} ${0:list} 83 | snippet \ 84 | \\${1:x} -> ${0:expression} 85 | snippet (\ 86 | (\\${1:x} -> ${0:expression}) 87 | snippet <- 88 | ${1:a} <- ${0:m a} 89 | snippet -> 90 | ${1:m a} -> ${0:a} 91 | snippet tup 92 | (${1:a}, ${0:b}) 93 | snippet tup2 94 | (${1:a}, ${2:b}, ${0:c}) 95 | snippet tup3 96 | (${1:a}, ${2:b}, ${3:c}, ${0:d}) 97 | snippet rec 98 | ${1:Record} { ${2:recFieldA} = ${3:undefined} 99 | , ${4:recFieldB} = ${0:undefined} 100 | } 101 | snippet case 102 | case ${1:something} of 103 | ${2} -> ${0} 104 | snippet let 105 | let ${1} = ${2} 106 | in ${3} 107 | snippet where 108 | where 109 | ${1:fn} = ${0:undefined} 110 | snippet spec 111 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where 112 | 113 | import Test.Hspec 114 | import Test.QuickCheck 115 | 116 | main :: IO () 117 | main = hspec spec 118 | 119 | spec :: Spec 120 | spec = 121 | describe "${1}" $ do 122 | it "${2}" $ 123 | $0 124 | snippet specf 125 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where 126 | 127 | import Test.Hspec 128 | import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith) 129 | 130 | main :: IO () 131 | main = hspecWith defaultConfig {configFastFail = True} spec 132 | 133 | spec :: Spec 134 | spec = 135 | describe "${1}" $ do 136 | it "${2}" $ 137 | $0 138 | snippet desc 139 | describe "${1}" $ do 140 | $0 141 | snippet it 142 | it "${1}" $ 143 | $0 144 | snippet itp 145 | it "${1}" $ property $ 146 | $0 147 | snippet sb 148 | \`shouldBe\` $0 149 | snippet doc 150 | {-| ${0} 151 | -} 152 | -------------------------------------------------------------------------------- /snippets/heex.snippets: -------------------------------------------------------------------------------- 1 | extends eelixir 2 | -------------------------------------------------------------------------------- /snippets/htmldjango.snippets: -------------------------------------------------------------------------------- 1 | # Generic tags 2 | 3 | extends html 4 | 5 | snippet % 6 | {% ${1} %} 7 | snippet %% 8 | {% ${1:tag_name} %} 9 | ${0} 10 | {% end$1 %} 11 | snippet { 12 | {{ ${1} }} 13 | # Template Tags 14 | 15 | snippet autoescape 16 | {% autoescape ${1:off} %} 17 | ${0} 18 | {% endautoescape %} 19 | snippet block 20 | {% block ${1} %} 21 | ${0} 22 | {% endblock %} 23 | snippet # 24 | {# ${0:comment} #} 25 | snippet comment 26 | {% comment %} 27 | ${0} 28 | {% endcomment %} 29 | snippet cycle 30 | {% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} 31 | snippet debug 32 | {% debug %} 33 | snippet extends 34 | {% extends "${0:base.html}" %} 35 | snippet filter 36 | {% filter ${1} %} 37 | ${0} 38 | {% endfilter %} 39 | snippet firstof 40 | {% firstof ${1} %} 41 | snippet for 42 | {% for ${1} in ${2} %} 43 | ${0} 44 | {% endfor %} 45 | snippet empty 46 | {% empty %} 47 | ${0} 48 | snippet if 49 | {% if ${1} %} 50 | ${0} 51 | {% endif %} 52 | snippet el 53 | {% else %} 54 | ${1} 55 | snippet eif 56 | {% elif ${1} %} 57 | ${0} 58 | snippet ifchanged 59 | {% ifchanged %}${1}{% endifchanged %} 60 | snippet ifequal 61 | {% ifequal ${1} ${2} %} 62 | ${0} 63 | {% endifequal %} 64 | snippet ifnotequal 65 | {% ifnotequal ${1} ${2} %} 66 | ${0} 67 | {% endifnotequal %} 68 | snippet include 69 | {% include "${0}" %} 70 | snippet load 71 | {% load ${0} %} 72 | snippet now 73 | {% now "${0:jS F Y H:i}" %} 74 | snippet regroup 75 | {% regroup ${1} by ${2} as ${0} %} 76 | snippet spaceless 77 | {% spaceless %}${0}{% endspaceless %} 78 | snippet ssi 79 | {% ssi ${0} %} 80 | snippet trans 81 | {% trans "${0:string}" %} 82 | snippet url 83 | {% url ${1} as ${0} %} 84 | snippet widthratio 85 | {% widthratio ${1:this_value} ${2:max_value} ${0:100} %} 86 | snippet with 87 | {% with ${1} as ${2} %} 88 | ${0} 89 | {% endwith %} 90 | 91 | # Template Filters 92 | 93 | # Note: Since SnipMate can't determine which template filter you are 94 | # expanding without the "|" character, these do not add the "|" 95 | # character. These save a few keystrokes still. 96 | 97 | # Note: Template tags that take no arguments are not implemented. 98 | 99 | snippet add 100 | add:"${0}" 101 | snippet center 102 | center:"${0}" 103 | snippet cut 104 | cut:"${0}" 105 | snippet date 106 | date:"${0}" 107 | snippet default 108 | default:"${0}" 109 | snippet defaultifnone 110 | default_if_none:"${0}" 111 | snippet dictsort 112 | dictsort:"${0}" 113 | snippet dictsortrev 114 | dictsortreversed:"${0}" 115 | snippet divisibleby 116 | divisibleby:"${0}" 117 | snippet floatformat 118 | floatformat:"${0}" 119 | snippet getdigit 120 | get_digit:"${0}" 121 | snippet join 122 | join:"${0}" 123 | snippet lengthis 124 | length_is:"${0}" 125 | snippet pluralize 126 | pluralize:"${0}" 127 | snippet removetags 128 | removetags:"${0}" 129 | snippet slice 130 | slice:"${0}" 131 | snippet stringformat 132 | stringformat:"${0}" 133 | snippet time 134 | time:"${0}" 135 | snippet truncatewords 136 | truncatewords:${0} 137 | snippet truncatewordshtml 138 | truncatewords_html:${0} 139 | snippet urlizetrunc 140 | urlizetrunc:${0} 141 | snippet wordwrap 142 | wordwrap:${0} 143 | -------------------------------------------------------------------------------- /snippets/htmltornado.snippets: -------------------------------------------------------------------------------- 1 | # Generic tags 2 | 3 | snippet { 4 | {{ ${0} }} 5 | 6 | # Template tags 7 | 8 | snippet extends 9 | {% extends "${0:base.html}" %} 10 | snippet autoescape 11 | {% autoescape ${0:xhtml_escape | None} %} 12 | snippet apply 13 | {% apply ${1:function} %} 14 | ${0} 15 | {% end %} 16 | snippet block 17 | {% block ${1} %} 18 | ${0} 19 | {% end %} 20 | snippet for 21 | {% for ${1:item} in ${2} %} 22 | ${0} 23 | {% end %} 24 | snippet from 25 | {% from ${1:x} import ${0:y} %} 26 | snippet if 27 | {% if $1 %} 28 | ${0} 29 | {% end %} 30 | snippet eif 31 | {% elif $0 %} 32 | snippet el 33 | {% else %} 34 | snippet import 35 | {% import ${0:module} %} 36 | snippet include 37 | {% include "${0:filename}" %} 38 | snippet module 39 | {% module ${0:expression} %} 40 | snippet raw 41 | {% raw ${0:expression} %} 42 | snippet set 43 | {% set ${1:x} = ${0:y} %} 44 | snippet try 45 | {% try %} 46 | ${1:${VISUAL}} 47 | {% except %} 48 | ${2} 49 | {% finallly %} 50 | ${0} 51 | {% end %} 52 | snippet wh 53 | {% while $1 %} 54 | ${0} 55 | {% end %} 56 | -------------------------------------------------------------------------------- /snippets/idris.snippets: -------------------------------------------------------------------------------- 1 | snippet mod 2 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` 3 | ${0} 4 | snippet imp 5 | import ${0:List} 6 | snippet fn 7 | ${1:fn} : ${2:a} -> ${3:a} 8 | $1 ${4} = 9 | ${0} 10 | snippet fn1 11 | ${1:fn} : ${2:a} -> ${3:a} 12 | $1 ${4} = 13 | ${0} 14 | snippet fn2 15 | ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} 16 | $1 ${5} = 17 | ${0} 18 | snippet fn3 19 | ${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} 20 | $1 ${6} = 21 | ${0} 22 | snippet fn0 23 | ${1:fn} : ${2:a} 24 | $1 = 25 | ${0} 26 | snippet case 27 | case ${1} of 28 | ${2} => 29 | ${0} 30 | snippet let 31 | let 32 | ${1} = 33 | ${2} 34 | in 35 | ${0} 36 | snippet wh 37 | where 38 | ${0} 39 | snippet if 40 | if ${1} then 41 | ${2:${VISUAL}} 42 | else 43 | ${0} 44 | ${0} 45 | snippet \ "Lambda function (\x => ...)" 46 | (\\${1:_} => ${0}) 47 | -------------------------------------------------------------------------------- /snippets/jade.snippets: -------------------------------------------------------------------------------- 1 | # Angular HTML 2 | snippet rep 3 | div(ng-repeat='${1} in ${2}') 4 | 5 | snippet repf 6 | div(ng-repeat='${1} in ${2}' | ${3}) 7 | 8 | snippet repi 9 | div(ng-repeat='${1} in ${2}' track by $index) 10 | 11 | snippet hide 12 | div(ng-hide='${1}') 13 | 14 | snippet show 15 | div(ng-show='${1}') 16 | 17 | snippet if 18 | div(ng-if='${1}') 19 | -------------------------------------------------------------------------------- /snippets/javascript-bemjson.snippets: -------------------------------------------------------------------------------- 1 | # Snippet for bemjson. https://en.bem.info/platform/bemjson/ 2 | 3 | # Blocks 4 | snippet b 5 | { 6 | block : '${1:name}', 7 | content : [ 8 | '${2:content}' 9 | ] 10 | } 11 | 12 | # btc - BEM block with text content 13 | snippet btc 14 | { 15 | block : '${1:name}', 16 | content: '${2:content}' 17 | } 18 | 19 | # bwm - BEM block with modifier. 20 | snippet bwm 21 | { 22 | block : '${1:name}', 23 | mods: { ${2:modName}: '${3:modVal}' }, 24 | content : [ 25 | '${4:content}' 26 | ] 27 | } 28 | 29 | # Elems 30 | 31 | # e - BEM elem 32 | snippet e 33 | { 34 | elem : '${1:name}', 35 | content : [ 36 | '${2:content}' 37 | ] 38 | } 39 | 40 | 41 | # mo - Mods 42 | snippet mo 43 | mods : { ${1:modName} : '${2:modVal}' }, 44 | 45 | # mi - BEM mix mod 46 | snippet mi 47 | mix : [ { ${1:block} : '${2:block}' } ], 48 | 49 | # a - BEM attrs mod 50 | snippet a 51 | attrs : { ${1:attr} : '${2:val}' }, 52 | 53 | -------------------------------------------------------------------------------- /snippets/javascript-d3.snippets: -------------------------------------------------------------------------------- 1 | snippet .attr 2 | .attr("${1}", ${2}) 3 | snippet .style 4 | .style("${1}", ${2}) 5 | snippet axis 6 | d3.svg.axis() 7 | .orient(${1}) 8 | .scale(${2}) 9 | snippet fd 10 | function(d) { ${1} } 11 | snippet fdi 12 | function(d, i) { ${1} } 13 | snippet marginconvention 14 | var ${1:margin} = { top: ${2:10}, right: ${3:10}, bottom: ${4:10}, left: ${5:10} }; 15 | var ${6:width} = ${7:970} - $1.left - $1.right; 16 | var ${8:height} = ${9:500} - $1.top - $1.bottom; 17 | 18 | var ${10:svg} = d3.select("${11}").append("svg") 19 | .attr("width", $6 + $1.left + $1.right) 20 | .attr("height", $8 + $1.top + $1.bottom) 21 | .append("g") 22 | .attr("transform", "translate(" + $1.left + "," + $1.top + ")") 23 | snippet nest 24 | d3.nest() 25 | .key(${1}) 26 | .entries(${2}) 27 | snippet scale 28 | d3.scale.linear() 29 | .domain(${1}) 30 | .range(${2}) 31 | -------------------------------------------------------------------------------- /snippets/javascript-mocha.snippets: -------------------------------------------------------------------------------- 1 | snippet des "describe('thing', function() { ... })" b 2 | describe('${1:}', function() { 3 | ${0:${VISUAL}} 4 | }); 5 | snippet it "it('should do', function() { ... })" b 6 | it('${1:}', function() { 7 | ${0:${VISUAL}} 8 | }); 9 | snippet xit "xit('should do', function() { ... })" b 10 | xit('${1:}', function() { 11 | ${0:${VISUAL}} 12 | }); 13 | snippet bef "before(function() { ... })" b 14 | before(function() { 15 | ${0:${VISUAL}} 16 | }); 17 | snippet befe "beforeEach(function() { ... })" b 18 | beforeEach(function() { 19 | ${0:${VISUAL}} 20 | }); 21 | snippet aft "after(function() { ... })" b 22 | after(function() { 23 | ${0:${VISUAL}} 24 | }); 25 | snippet afte "afterEach(function() { ... })" b 26 | afterEach(function() { 27 | ${0:${VISUAL}} 28 | }); 29 | snippet exp "expect(...)" b 30 | expect(${1:})${0}; 31 | snippet expe "expect(...).to.equal(...)" b 32 | expect(${1:}).to.equal(${0}); 33 | snippet expd "expect(...).to.deep.equal(...)" b 34 | expect(${1:}).to.deep.equal(${0}); 35 | -------------------------------------------------------------------------------- /snippets/javascript/javascript-react.snippets: -------------------------------------------------------------------------------- 1 | # Import 2 | snippet ir import React 3 | import React from 'react'; 4 | 5 | snippet irc import React and Component 6 | import React, { Component } from 'react'; 7 | 8 | snippet irh import React hooks 9 | import { use$1 } from 'react'; 10 | 11 | snippet ird import ReactDOM 12 | import ReactDOM from 'react-dom'; 13 | 14 | snippet irp import PropTypes 15 | import PropTypes from 'prop-types'; 16 | 17 | # Lifecycle Methods 18 | snippet cdm componentDidMount 19 | componentDidMount() { 20 | ${1} 21 | }; 22 | 23 | snippet cdup componentDidUpdate 24 | componentDidUpdate(prevProps, prevState) { 25 | ${1} 26 | }; 27 | 28 | snippet cwm componentWillMount 29 | componentWillMount() { 30 | ${1} 31 | }; 32 | 33 | snippet cwr componentWillReceiveProps 34 | componentWillReceiveProps(nextProps) { 35 | ${1} 36 | }; 37 | 38 | snippet cwun componentWillUnmount 39 | componentWillUnmount() { 40 | ${1} 41 | }; 42 | 43 | snippet cwu componentWillUpdate 44 | componentWillUpdate(nextProps, nextState) { 45 | ${1} 46 | }; 47 | 48 | snippet scu shouldComponentUpdate 49 | shouldComponentUpdate(nextProps, nextState) { 50 | ${1} 51 | } 52 | 53 | # Props 54 | snippet spt static propTypes 55 | static propTypes = { 56 | ${1}: PropTypes.${2} 57 | }; 58 | 59 | snippet pt propTypes 60 | ${1}.propTypes = { 61 | ${2}: PropTypes.${2} 62 | }; 63 | 64 | snippet sdp static defaultProps 65 | static defaultProps = { 66 | ${1}: ${2} 67 | }; 68 | 69 | snippet dp defaultProps 70 | ${1}.defaultProps = { 71 | ${2}: ${3} 72 | }; 73 | 74 | snippet pp props 75 | props.${1}; 76 | 77 | snippet tp this props 78 | this.props.${1}; 79 | 80 | # State 81 | snippet st 82 | state = { 83 | ${1}: ${2}, 84 | }; 85 | 86 | snippet sst 87 | this.setState({ 88 | ${1}: ${2} 89 | }); 90 | 91 | snippet tst 92 | this.state.${1}; 93 | 94 | # Component 95 | snippet raf 96 | const ${1:ComponentName} = (${2:props}) => { 97 | ${3:state} 98 | 99 | return ( 100 | <> 101 | ${4} 102 | 103 | ); 104 | }; 105 | 106 | snippet rcla 107 | class ${1:ClassName} extends Component { 108 | render() { 109 | return ( 110 | <> 111 | ${2} 112 | 113 | ); 114 | } 115 | } 116 | 117 | snippet ercla 118 | export default class ${1:ClassName} extends Component { 119 | render() { 120 | return ( 121 | <> 122 | ${2} 123 | 124 | ); 125 | }; 126 | }; 127 | 128 | snippet ctor 129 | constructor() { 130 | super(); 131 | 132 | ${1:state} 133 | } 134 | 135 | snippet ren 136 | render() { 137 | return ( 138 | <> 139 | ${2} 140 | 141 | ); 142 | } 143 | 144 | snippet fup 145 | forceUpdate(${1:callback}); 146 | 147 | # Hooks 148 | snippet uses useState 149 | const [${1:state}, set${2}] = useState(${3:initialState}); 150 | 151 | snippet usee useEffect 152 | useEffect(() => { 153 | ${1} 154 | }); 155 | 156 | snippet userd useReducer 157 | const [${1:state}, ${2:dispatch}] = useReducer(${3:reducer}); 158 | 159 | snippet userf useRef 160 | const ${1:refContainer} = useRef(${2:initialValue}); 161 | 162 | snippet usect useContext 163 | const ${1:value} = useContext(${2:MyContext}); 164 | 165 | snippet usecb useCallback 166 | const ${1:memoizedCallback} = useCallback( 167 | () => { 168 | ${2}(${3}) 169 | }, 170 | [$3] 171 | ); 172 | 173 | snippet usem useMemo 174 | const ${1:memoizedCallback} = useMemo(() => ${2}(${3}), [$3]); 175 | 176 | snippet usei useImperativeHandle 177 | useImperativeHandle(${1:ref}, ${2:createHandle}); 178 | 179 | snippet used useDebugValue 180 | useDebugValue(${1:value}); 181 | 182 | # ReactDOM methods 183 | snippet rdr ReactDOM.render 184 | ReactDOM.render(${1}, ${2}); 185 | 186 | snippet rdh ReactDOM.hydrate 187 | ReactDOM.hydrate(${1:element}, ${2:container}[, ${3:callback}]); 188 | 189 | snippet rdcp ReactDOM.createPortal 190 | ReactDOM.createPortal(${1:child}, ${2:container}); 191 | -------------------------------------------------------------------------------- /snippets/javascript/javascript-redux.snippets: -------------------------------------------------------------------------------- 1 | snippet ist 2 | import { createStore } from 'redux'; 3 | snippet con 4 | connect(${1:mapStateToProps}, ${2:mapDispatchToProps})(<${3:VISUAL}/>); 5 | snippet act 6 | const ${1:actionName} = (${2:arg}) => { 7 | return { 8 | type: ${3:VISUAL}, 9 | $2 10 | }; 11 | }; 12 | snippet rdc 13 | const ${1:reducerName} = (state={}, action) => { 14 | switch(action.type) { 15 | case ${1:action}: 16 | return { 17 | ...state, 18 | $2 19 | }; 20 | default: 21 | return state; 22 | }; 23 | }; 24 | snippet mstp 25 | const mapStateToProps = (state) => { 26 | return { 27 | ${1:propName}: state.$1, 28 | }; 29 | }; 30 | snippet mdtp 31 | const mapDispatchToProps = (dispatch) => { 32 | return { 33 | ${1:propName}: () => { 34 | dispatch(${2:actionName}()); 35 | }, 36 | }; 37 | }; 38 | -------------------------------------------------------------------------------- /snippets/javascript/javascript-requirejs.snippets: -------------------------------------------------------------------------------- 1 | snippet def 2 | define(["${1:#dependencies1}"], function (${2:#dependencies2}) { 3 | return ${0:TARGET}; 4 | }); 5 | 6 | snippet defn 7 | define("${1:#name}", ["${2:#dependencies1}"], function (${3:#dependencies2}) { 8 | return ${0:TARGET}; 9 | }); 10 | 11 | snippet reqjs 12 | require(["${1:#dependencies1}"], function (${2:#dependencies2}) { 13 | return ${0:TARGET}; 14 | }); 15 | -------------------------------------------------------------------------------- /snippets/javascript/javascript.node.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env node 3 | # module exports 4 | snippet ex 5 | module.exports = ${1}; 6 | # require 7 | snippet re 8 | const ${1} = require('${2:module_name}'); 9 | # EventEmitter 10 | snippet on 11 | on('${1:event_name}', function(${2:stream}) { 12 | ${3} 13 | }); 14 | snippet emit 15 | emit('${1:event_name}', ${2:args}); 16 | snippet once 17 | once('${1:event_name}', function(${2:stream}) { 18 | ${3} 19 | }); 20 | # http. User js function snippet as handler 21 | snippet http 22 | http.createServer(${1:handler}).listen(${2:port_number}); 23 | # net 24 | snippet net 25 | net.createServer(function(${1:socket}){ 26 | ${1}.on('data', function('data'){ 27 | ${2} 28 | ]}); 29 | ${1}.on('end', function(){ 30 | ${3} 31 | }); 32 | }).listen(${4:8124}); 33 | # Stream snippets 34 | snippet pipe 35 | pipe(${1:stream})${2} 36 | # Express snippets 37 | snippet eget 38 | ${1:app}.get('${2:route}', ${3:handler}); 39 | snippet epost 40 | ${1:app}.post('${2:route}', ${3:handler}); 41 | snippet eput 42 | ${1:app}.put('${2:route}', ${3:handler}); 43 | snippet edel 44 | ${1:app}.delete('${2:route}', ${3:handler}); 45 | # process snippets 46 | snippet stdin 47 | process.stdin 48 | snippet stdout 49 | process.stdout 50 | snippet stderr 51 | process.stderr 52 | -------------------------------------------------------------------------------- /snippets/jinja.snippets: -------------------------------------------------------------------------------- 1 | # Generic tags 2 | 3 | extends html 4 | 5 | snippet % 6 | {% ${1} %} 7 | snippet %% 8 | {% ${1:tag_name} %} 9 | ${0} 10 | {% end$1 %} 11 | snippet { 12 | {{ ${1} }} 13 | # Template Tags 14 | 15 | snippet autoescape 16 | {% autoescape ${1:off} %} 17 | ${0} 18 | {% endautoescape %} 19 | snippet block 20 | {% block ${1} %} 21 | ${0} 22 | {% endblock %} 23 | snippet # 24 | {# ${0:comment} #} 25 | snippet comment 26 | {% comment %} 27 | ${0} 28 | {% endcomment %} 29 | snippet cycle 30 | {% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} 31 | snippet debug 32 | {% debug %} 33 | snippet extends 34 | {% extends "${0:base.html}" %} 35 | snippet filter 36 | {% filter ${1} %} 37 | ${0} 38 | {% endfilter %} 39 | snippet firstof 40 | {% firstof ${1} %} 41 | snippet for 42 | {% for ${1} in ${2} %} 43 | ${0} 44 | {% endfor %} 45 | snippet empty 46 | {% empty %} 47 | ${0} 48 | snippet if 49 | {% if ${1} %} 50 | ${0} 51 | {% endif %} 52 | snippet el 53 | {% else %} 54 | ${1} 55 | snippet eif 56 | {% elif ${1} %} 57 | ${0} 58 | snippet ifchanged 59 | {% ifchanged %}${1}{% endifchanged %} 60 | snippet ifequal 61 | {% ifequal ${1} ${2} %} 62 | ${0} 63 | {% endifequal %} 64 | snippet ifnotequal 65 | {% ifnotequal ${1} ${2} %} 66 | ${0} 67 | {% endifnotequal %} 68 | snippet include 69 | {% include "${0}" %} 70 | snippet load 71 | {% load ${0} %} 72 | snippet now 73 | {% now "${0:jS F Y H:i}" %} 74 | snippet regroup 75 | {% regroup ${1} by ${2} as ${0} %} 76 | snippet spaceless 77 | {% spaceless %}${0}{% endspaceless %} 78 | snippet ssi 79 | {% ssi ${0} %} 80 | snippet trans 81 | {% trans %}${0}{% endtrans %} 82 | snippet url 83 | {% url ${1} as ${0} %} 84 | snippet widthratio 85 | {% widthratio ${1:this_value} ${2:max_value} ${0:100} %} 86 | snippet with 87 | {% with ${1} as ${2} %} 88 | ${0} 89 | {% endwith %} 90 | 91 | # Template Filters 92 | 93 | # Note: Since SnipMate can't determine which template filter you are 94 | # expanding without the "|" character, these do not add the "|" 95 | # character. These save a few keystrokes still. 96 | 97 | # Note: Template tags that take no arguments are not implemented. 98 | 99 | snippet add 100 | add:"${0}" 101 | snippet center 102 | center:"${0}" 103 | snippet cut 104 | cut:"${0}" 105 | snippet date 106 | date:"${0}" 107 | snippet default 108 | default:"${0}" 109 | snippet defaultifnone 110 | default_if_none:"${0}" 111 | snippet dictsort 112 | dictsort:"${0}" 113 | snippet dictsortrev 114 | dictsortreversed:"${0}" 115 | snippet divisibleby 116 | divisibleby:"${0}" 117 | snippet floatformat 118 | floatformat:"${0}" 119 | snippet getdigit 120 | get_digit:"${0}" 121 | snippet join 122 | join:"${0}" 123 | snippet lengthis 124 | length_is:"${0}" 125 | snippet pluralize 126 | pluralize:"${0}" 127 | snippet removetags 128 | removetags:"${0}" 129 | snippet slice 130 | slice:"${0}" 131 | snippet stringformat 132 | stringformat:"${0}" 133 | snippet time 134 | time:"${0}" 135 | snippet truncatewords 136 | truncatewords:${0} 137 | snippet truncatewordshtml 138 | truncatewords_html:${0} 139 | snippet urlizetrunc 140 | urlizetrunc:${0} 141 | snippet wordwrap 142 | wordwrap:${0} 143 | -------------------------------------------------------------------------------- /snippets/jsp.snippets: -------------------------------------------------------------------------------- 1 | snippet @page 2 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 3 | snippet jstl 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 6 | snippet jstl:c 7 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 8 | snippet jstl:fn 9 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 10 | snippet cpath 11 | ${pageContext.request.contextPath} 12 | snippet cout 13 | 14 | snippet cset 15 | 16 | snippet cremove 17 | 18 | snippet ccatch 19 | 20 | snippet cif 21 | 22 | ${0} 23 | 24 | snippet cchoose 25 | 26 | ${0} 27 | 28 | snippet cwhen 29 | 30 | ${0} 31 | 32 | snippet cother 33 | 34 | ${0} 35 | 36 | snippet cfore 37 | 38 | ${0:} 39 | 40 | snippet cfort 41 | ${2:item1,item2,item3} 42 | 43 | ${0:} 44 | 45 | snippet cparam 46 | 47 | snippet cparam+ 48 | 49 | cparam+${0} 50 | snippet cimport 51 | 52 | snippet cimport+ 53 | 54 | 55 | cparam+${0} 56 | 57 | snippet curl 58 | 59 | ${0} 60 | snippet curl+ 61 | 62 | 63 | cparam+${0} 64 | 65 | ${3} 66 | snippet credirect 67 | 68 | snippet contains 69 | ${fn:contains(${1:string}, ${0:substr})} 70 | snippet contains:i 71 | ${fn:containsIgnoreCase(${1:string}, ${0:substr})} 72 | snippet endswith 73 | ${fn:endsWith(${1:string}, ${0:suffix})} 74 | snippet escape 75 | ${fn:escapeXml(${0:string})} 76 | snippet indexof 77 | ${fn:indexOf(${1:string}, ${0:substr})} 78 | snippet join 79 | ${fn:join(${1:collection}, ${0:delims})} 80 | snippet length 81 | ${fn:length(${0:collection_or_string})} 82 | snippet replace 83 | ${fn:replace(${1:string}, ${2:substr}, ${0:replace})} 84 | snippet split 85 | ${fn:split(${1:string}, ${0:delims})} 86 | snippet startswith 87 | ${fn:startsWith(${1:string}, ${0:prefix})} 88 | snippet substr 89 | ${fn:substring(${1:string}, ${2:begin}, ${0:end})} 90 | snippet substr:a 91 | ${fn:substringAfter(${1:string}, ${0:substr})} 92 | snippet substr:b 93 | ${fn:substringBefore(${1:string}, ${0:substr})} 94 | snippet lc 95 | ${fn:toLowerCase(${0:string})} 96 | snippet uc 97 | ${fn:toUpperCase(${0:string})} 98 | snippet trim 99 | ${fn:trim(${0:string})} 100 | -------------------------------------------------------------------------------- /snippets/julia.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env julia 3 | 4 | # Functions 5 | snippet fun function definition 6 | function ${1}(${2}) 7 | ${0} 8 | end 9 | 10 | snippet ret return 11 | return(${0}) 12 | 13 | # Printing to console 14 | snippet pr print 15 | print("${1}") 16 | ${0} 17 | 18 | snippet prl print line 19 | println("${1}") 20 | ${0} 21 | 22 | # Includes 23 | snippet use load a package 24 | using ${0} 25 | 26 | snippet incl include source code 27 | include("${1}") 28 | ${0} 29 | 30 | # Loops 31 | snippet forc for loop iterating over iterable container 32 | for ${1} in ${2} 33 | ${0} 34 | end 35 | 36 | snippet for standard for loop 37 | for ${1} = ${2} 38 | ${0} 39 | end 40 | 41 | snippet fornest nested for loop 42 | for ${1} = ${2}, ${3} = ${4} 43 | ${0} 44 | end 45 | 46 | snippet wh while loop 47 | while ${1} ${2:<=} ${3} 48 | ${0} 49 | end 50 | 51 | # Conditionals 52 | snippet if if statement 53 | if ${1} 54 | ${0} 55 | end 56 | 57 | snippet el else part of statement 58 | else 59 | ${0} 60 | 61 | snippet eif else if part of if statement 62 | else if ${1} 63 | ${0} 64 | 65 | snippet ife full if-else statement 66 | if ${1} 67 | ${2} 68 | else 69 | ${0} 70 | end 71 | 72 | snippet tern ternary operator 73 | ${1} ? ${2} : ${3:nothing} 74 | 75 | # Exceptions 76 | snippet try try catch 77 | try 78 | ${1:${VISUAL}} 79 | catch ${2} 80 | ${0} 81 | end 82 | 83 | snippet fin finally statement 84 | finally 85 | ${0} 86 | 87 | snippet thr throw 88 | throw(${1}) 89 | ${0} 90 | 91 | # Messages 92 | snippet @i 93 | @info "${1}" ${0} 94 | 95 | snippet @w 96 | @warn "${1}" ${0} 97 | 98 | snippet @e 99 | @error "${1}" ${0} 100 | 101 | snippet @d 102 | @debug "${1}" ${0} 103 | 104 | snippet @t @testset with @test 105 | @testset "${1}" begin 106 | ${2} 107 | @test ${0} 108 | end 109 | 110 | snippet @tt @testset with @test_throws 111 | @testset "${1}" begin 112 | ${2} 113 | @test_throws ${0} 114 | end 115 | -------------------------------------------------------------------------------- /snippets/kotlin.snippets: -------------------------------------------------------------------------------- 1 | snippet fun 2 | fun ${1:name}(${2}): ${3:String} { 3 | ${4} 4 | } 5 | snippet pfun 6 | private fun ${1:name}(${2}): ${3:String} { 7 | ${4} 8 | } 9 | snippet main 10 | @JvmStatic 11 | fun main(args: Array) { 12 | ${0} 13 | } 14 | snippet ret 15 | return ${0} 16 | snippet whe 17 | when (${1:${VISUAL}}) { 18 | ${2} -> ${3} 19 | } 20 | snippet cla 21 | class ${1} { 22 | ${0:${VISUAL}} 23 | } 24 | snippet cobj 25 | companion object { 26 | ${0:${VISUAL}} 27 | } 28 | snippet obj 29 | object ${1} { 30 | ${0:${VISUAL}} 31 | } 32 | snippet if 33 | if (${1}) { 34 | ${0:${VISUAL}} 35 | } 36 | snippet ife 37 | if (${1}) { 38 | ${2:${VISUAL}} 39 | } else { 40 | ${0} 41 | } 42 | -------------------------------------------------------------------------------- /snippets/ledger.snippets: -------------------------------------------------------------------------------- 1 | # Ledger 2 | snippet ent 3 | `strftime("%Y/%m/%d")` ${1:transaction} 4 | ${2:account} ${3:value} 5 | ${0:account} 6 | -------------------------------------------------------------------------------- /snippets/lfe.snippets: -------------------------------------------------------------------------------- 1 | snippet defmo 2 | (defmodule ${1:`vim_snippets#Filename()`} 3 | (export ${2:all})) 4 | $0 5 | snippet def 6 | (defun $1 ($2) 7 | $0) 8 | snippet ltest 9 | (defmodule ${1:`vim_snippets#Filename()`} 10 | (behaviour ltest-unit) 11 | (export all)) 12 | 13 | (include-lib "ltest/include/ltest-macros.lfe") 14 | 15 | $0 16 | snippet test 17 | (deftest $1 18 | $0) 19 | -------------------------------------------------------------------------------- /snippets/lpc.snippets: -------------------------------------------------------------------------------- 1 | ## 2 | ## Preprocessor 3 | # #include <...> 4 | snippet inc 5 | #include <${1:stdio}.h> 6 | # #include "..." 7 | snippet Inc 8 | #include "${1:`vim_snippets#Filename("$1.h")`}" 9 | # ifndef...define...endif 10 | snippet ndef 11 | #ifndef $1 12 | #define ${1:SYMBOL} ${2:value} 13 | #endif /* ifndef $1 */ 14 | # define 15 | snippet def 16 | #define 17 | # ifdef...endif 18 | snippet ifdef 19 | #ifdef ${1:FOO} 20 | ${2:#define } 21 | #endif 22 | # if 23 | snippet #if 24 | #if ${1:FOO} 25 | ${0:${VISUAL}} 26 | #endif 27 | # header include guard 28 | snippet once 29 | #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} 30 | 31 | #define $1 32 | 33 | ${0} 34 | 35 | #endif /* end of include guard: $1 */ 36 | ## 37 | ## Control Statements 38 | # if 39 | snippet if 40 | if(${1:true}) 41 | { 42 | ${0:${VISUAL}} 43 | } 44 | snippet ife 45 | if(${1:true}) 46 | { 47 | ${2:${VISUAL}} 48 | } 49 | else 50 | { 51 | ${0} 52 | } 53 | # else 54 | snippet el 55 | else 56 | { 57 | ${0:${VISUAL}} 58 | } 59 | # else if 60 | snippet elif 61 | else if(${1:true}) 62 | { 63 | ${0:${VISUAL}} 64 | } 65 | # ifi 66 | snippet ifi 67 | if(${1:true}) ${0}; 68 | # ternary 69 | snippet t Ternary: `condition ? true : false` 70 | $1 ? $2 : $0 71 | # switch 72 | snippet switch 73 | switch(${1:/* variable */}) 74 | { 75 | case ${2:/* variable case */}: 76 | ${3} 77 | ${4:break;}${5} 78 | default: 79 | ${6} 80 | } 81 | # switch without default 82 | snippet switchndef 83 | switch(${1:/* variable */}) 84 | { 85 | case ${2:/* variable case */}: 86 | ${3} 87 | ${4:break;}${5} 88 | } 89 | # case 90 | snippet case 91 | case ${1:/* variable case */}: 92 | ${2} 93 | ${3:break;} 94 | snippet ret 95 | return ${0}; 96 | ## 97 | ## Loops 98 | #foreach 99 | snippet fore 100 | foreach(${1:mixed} ${2:ele} in ${3:arr}) 101 | { 102 | ${4} 103 | } 104 | # for 105 | snippet for 106 | for(int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) 107 | { 108 | ${4} 109 | } 110 | # for (custom) 111 | snippet forr 112 | for(int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) 113 | { 114 | ${5} 115 | } 116 | # while 117 | snippet wh 118 | while($1) 119 | { 120 | ${0:${VISUAL}} 121 | } 122 | # do... while 123 | snippet do 124 | do{ 125 | ${0:${VISUAL}} 126 | }while ($1); 127 | ## 128 | ## Functions 129 | # function definition 130 | snippet fnc 131 | ${1:void} ${2:function_name}(${3}) 132 | { 133 | ${4} 134 | } 135 | # function definition with zero parameters 136 | snippet defun0 137 | ${1:void} ${2:function_name}() 138 | { 139 | ${3} 140 | } 141 | # function definition with one parameter 142 | snippet defun1 143 | ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}) 144 | { 145 | ${5} 146 | } 147 | # function definition with two parameters 148 | snippet defun2 149 | ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}) 150 | { 151 | ${7} 152 | } 153 | # function definition with three parameters 154 | snippet defun3 155 | ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter}) 156 | { 157 | ${9} 158 | } 159 | # function declaration 160 | snippet fund 161 | ${1:void} ${2:function_name}(${3}); 162 | ## 163 | ## Input/Output 164 | # printf 165 | snippet pr 166 | printf("${1:%s}\n"${2}); 167 | # fprintf (again, this isn't as nice as TextMate's version, but it works) 168 | snippet fpr 169 | fprintf(${1:stderr}, "${2:%s}\n"${3}); 170 | snippet prd 171 | printf("${1:} = %d\n", $1); 172 | snippet prf 173 | printf("${1:} = %f\n", $1); 174 | snippet prx 175 | printf("${1:} = %${2}\n", $1); 176 | ## 177 | # TODO section 178 | snippet todo 179 | /*! TODO: ${1:Todo description here} */ 180 | 181 | ## Miscellaneous 182 | # This is kind of convenient 183 | snippet . 184 | [${1}] 185 | 186 | 187 | ## 188 | ## MHXY 189 | snippet head 190 | // code for ${1} by `$USER` create at `strftime("%Y-%m-%d %H:%M:%S")` 191 | -------------------------------------------------------------------------------- /snippets/ls.snippets: -------------------------------------------------------------------------------- 1 | # Closure loop 2 | snippet forinlet 3 | for ${1:name} in ${2:array} 4 | let $1 5 | ${3} 6 | # Array comprehension 7 | snippet fora 8 | for ${1:name} in ${2:array} 9 | ${3} 10 | # Object comprehension 11 | snippet foro 12 | for ${1:key}, ${2:value} of ${3:object} 13 | ${4} 14 | # Range comprehension (inclusive) 15 | snippet forr 16 | for ${1:name} from ${2:start} to ${3:finish} 17 | ${4} 18 | snippet forrb 19 | for ${1:name} from ${2:start} to ${3:finish} by ${4:step} 20 | ${5} 21 | # Range comprehension (exclusive) 22 | snippet forrex 23 | for ${1:name} from ${2:start} til ${3:finish} 24 | ${4} 25 | snippet forrexb 26 | for ${1:name} from ${2:start} til ${3:finish} by ${4:step} 27 | ${5} 28 | # Function 29 | snippet fun 30 | (${1:args}) -> 31 | ${2} 32 | # Function (bound) 33 | snippet bfun 34 | (${1:args}) ~> 35 | ${2} 36 | # Class 37 | snippet cla class .. 38 | class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} 39 | ${2} 40 | snippet cla class .. constructor: .. 41 | class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} 42 | (${2:args}) -> 43 | ${3} 44 | 45 | ${4} 46 | snippet cla class .. extends .. 47 | class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} 48 | ${3} 49 | snippet cla class .. extends .. constructor: .. 50 | class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass} 51 | (${3:args}) -> 52 | ${4} 53 | 54 | ${5} 55 | # If 56 | snippet if 57 | if $1 58 | ${2} 59 | # If __ Else 60 | snippet ife 61 | if $1 62 | ${2} 63 | else 64 | ${3} 65 | # Else if 66 | snippet elif 67 | else if $1 68 | ${2} 69 | # Ternary If 70 | snippet ifte 71 | if $1 then $2 else $0 72 | # Unless 73 | snippet unl 74 | $1 unless $0 75 | # Switch 76 | snippet swi 77 | switch ${1:object} 78 | case ${2:value} 79 | ${3} 80 | default void 81 | snippet mat 82 | match ${1:object} 83 | | ${2:value} => ${3} 84 | | otherwise => void 85 | 86 | # Log 87 | snippet log 88 | console.log ${1} 89 | # stringify 90 | snippet str 91 | JSON.stringify ${1}, void, 2 92 | 93 | # Try __ Catch 94 | snippet try 95 | try 96 | ${1:${VISUAL}} 97 | catch ${2:error} 98 | ${3} 99 | # Require 100 | snippet req 101 | ${2:$1} = require '${1}'${3} 102 | # Require! 103 | snippet req! 104 | require! ${1} 105 | 106 | # Export 107 | snippet exp 108 | ${1:root} = exports ? this 109 | -------------------------------------------------------------------------------- /snippets/lua.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env lua 3 | $1 4 | snippet local 5 | local ${1:x} = ${0:1} 6 | snippet fun 7 | function ${1:fname}(${2:...}) 8 | $0 9 | end 10 | snippet for 11 | for ${1:i}=${2:1},${3:10} do 12 | ${0:print(i)} 13 | end 14 | snippet forp 15 | for ${1:i},${2:v} in pairs(${3:table_name}) do 16 | $0 17 | end 18 | snippet fori 19 | for ${1:i},${2:v} in ipairs(${3:table_name}) do 20 | $0 21 | end 22 | snippet if 23 | if $1 then 24 | $2 25 | end 26 | snippet ife 27 | if $1 then 28 | ${2:-- if condition} 29 | else 30 | ${0:-- else} 31 | end 32 | snippet elif 33 | elseif $1 then 34 | $0 35 | snippet repeat 36 | repeat 37 | $1 38 | until $0 39 | snippet while 40 | while $1 do 41 | $0 42 | end 43 | snippet wh 44 | while ${1:true} do 45 | ${0} 46 | end 47 | snippet wht 48 | while true do 49 | ${0} 50 | end 51 | snippet print 52 | print("${1:string}") 53 | snippet pr 54 | print($0) 55 | snippet prs 56 | print("$0") 57 | snippet prf 58 | print(string.format("${1:%s}"$0)) 59 | snippet wr 60 | io.write($0) 61 | snippet wrs 62 | io.write("$0") 63 | snippet wrf 64 | io.write(string.format("${1:%s}"$0)) 65 | snippet fwr 66 | io.${1:stderr}:write($0) 67 | snippet fwrs 68 | io.${1:stderr}:write("$0") 69 | snippet fwrf 70 | io.${1:stderr}:write(string.format("${2:%s}"$0)) 71 | snippet req 72 | require('${1:mod}') 73 | -------------------------------------------------------------------------------- /snippets/make.snippets: -------------------------------------------------------------------------------- 1 | # base 2 | snippet base 3 | .PHONY: clean, mrproper 4 | CC = gcc 5 | CFLAGS = -g -Wall 6 | 7 | all: $1 8 | 9 | %.o: %.c 10 | $(CC) $(CFLAGS) -c -o $@ $< 11 | 12 | ${1:out}: $1.o 13 | $(CC) $(CFLAGS) -o $@ $+ 14 | 15 | clean: 16 | rm -f *.o core.* 17 | 18 | mrproper: clean 19 | rm -f $1 20 | # add 21 | snippet add 22 | ${1:out}: $1.o 23 | $(CC) $(CFLAGS) -o $@ $+ 24 | # print 25 | snippet print 26 | print-%: ; @echo $*=$($*) 27 | # ifeq 28 | snippet if 29 | ifeq (${1:cond0}, ${2:cond1}) 30 | ${0:${VISUAL}} 31 | endif 32 | # ifeq ... else ... endif 33 | snippet ife 34 | ifeq (${1:cond0}, ${2:cond1}) 35 | ${3:${VISUAL}} 36 | else 37 | ${0} 38 | endif 39 | # else ... 40 | snippet el 41 | else 42 | ${0:${VISUAL}} 43 | # .DEFAULT_GOAL := target 44 | snippet default 45 | .DEFAULT_GOAL := ${1} 46 | # help target for self-documented Makefile 47 | snippet help 48 | help: ## Prints help for targets with comments 49 | @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}' 50 | ${0} 51 | -------------------------------------------------------------------------------- /snippets/mako.snippets: -------------------------------------------------------------------------------- 1 | snippet def 2 | <%def name="${1:name}"> 3 | ${0:} 4 | 5 | snippet call 6 | <%call expr="${1:name}"> 7 | ${0:} 8 | 9 | snippet doc 10 | <%doc> 11 | ${0:} 12 | 13 | snippet text 14 | <%text> 15 | ${0:} 16 | 17 | snippet for 18 | % for ${1:i} in ${2:iter}: 19 | ${0:} 20 | % endfor 21 | snippet if if 22 | % if $1: 23 | ${0:} 24 | % endif 25 | snippet ife if/else 26 | % if $1: 27 | ${2:} 28 | % else: 29 | ${0:} 30 | % endif 31 | snippet try 32 | % try: 33 | ${1:${VISUAL}} 34 | % except${2:}: 35 | ${0:pass} 36 | % endtry 37 | snippet wh 38 | % while ${1:}: 39 | ${0:} 40 | % endwhile 41 | snippet $ 42 | ${ ${0:} } 43 | snippet <% 44 | <% ${0:} %> 45 | snippet 47 | snippet inherit 48 | <%inherit file="${0:filename}" /> 49 | snippet include 50 | <%include file="${0:filename}" /> 51 | snippet namespace 52 | <%namespace file="${0:name}" /> 53 | snippet page 54 | <%page args="${0:}" /> 55 | -------------------------------------------------------------------------------- /snippets/markdown.snippets: -------------------------------------------------------------------------------- 1 | # Markdown 2 | 3 | # Includes octopress (http://octopress.org/) snippets 4 | 5 | # The suffix `c` stands for "Clipboard". 6 | 7 | snippet [ 8 | [${1:text}](${2:address}) 9 | snippet [* 10 | [${1:link}](${2:`@*`}) 11 | snippet [c 12 | [${1:link}](${2:`@+`}) 13 | snippet [" 14 | [${1:text}](https://${2:address} "${3:title}") 15 | snippet ["* 16 | [${1:link}](${2:`@*`} "${3:title}") 17 | snippet ["c 18 | [${1:link}](${2:`@+`} "${3:title}") 19 | snippet [: 20 | [${1:id}]: https://${2:url} 21 | 22 | snippet [:* 23 | [${1:id}]: ${2:`@*`} 24 | 25 | snippet [:c 26 | [${1:id}]: ${2:`@+`} 27 | 28 | snippet [:" 29 | [${1:id}]: https://${2:url} "${3:title}" 30 | 31 | snippet [:"* 32 | [${1:id}]: ${2:`@*`} "${3:title}" 33 | 34 | snippet [:"c 35 | [${1:id}]: ${2:`@+`} "${3:title}" 36 | 37 | snippet ![ 38 | ![${1:alttext}](${2:/images/image.jpg}) 39 | snippet ![* 40 | ![${1:alt}](${2:`@*`}) 41 | snippet ![c 42 | ![${1:alt}](${2:`@+`}) 43 | snippet ![" 44 | ![${1:alttext}](${2:/images/image.jpg} "${3:title}") 45 | snippet !["* 46 | ![${1:alt}](${2:`@*`} "${3:title}") 47 | snippet !["c 48 | ![${1:alt}](${2:`@+`} "${3:title}") 49 | snippet ![: 50 | ![${1:id}]: ${2:url} 51 | 52 | snippet ![:* 53 | ![${1:id}]: ${2:`@*`} 54 | 55 | snippet ![:" 56 | ![${1:id}]: ${2:url} "${3:title}" 57 | 58 | snippet ![:"* 59 | ![${1:id}]: ${2:`@*`} "${3:title}" 60 | 61 | snippet ![:"c 62 | ![${1:id}]: ${2:`@+`} "${3:title}" 63 | 64 | snippet < 65 | 66 | snippet <* 67 | <`@*`> 68 | snippet 70 | snippet ** Bold 71 | **$0** 72 | snippet __ Bold 73 | __$0__ 74 | snippet --- Front matter 75 | --- 76 | $0 77 | --- 78 | snippet ==== 79 | `repeat('=', strlen(getline(line('.') - 3)))` 80 | 81 | ${0} 82 | snippet - 83 | - ${0} 84 | snippet ---- 85 | `repeat('-', strlen(getline(line('.') - 3)))` 86 | 87 | ${0} 88 | snippet blockquote 89 | {% blockquote %} 90 | ${0:quote} 91 | {% endblockquote %} 92 | 93 | snippet blockquote-author 94 | {% blockquote ${1:author}, ${2:title} %} 95 | ${0:quote} 96 | {% endblockquote %} 97 | 98 | snippet blockquote-link 99 | {% blockquote ${1:author} ${2:URL} ${3:link_text} %} 100 | ${0:quote} 101 | {% endblockquote %} 102 | 103 | snippet ``` 104 | \`\`\`${1} 105 | ${0:${VISUAL}} 106 | \`\`\` 107 | 108 | # Language. 109 | snippet ```l 110 | \`\`\`${1:language} 111 | ${2:code} 112 | \`\`\` 113 | 114 | snippet codeblock-short 115 | {% codeblock %} 116 | ${0:code_snippet} 117 | {% endcodeblock %} 118 | 119 | snippet codeblock-full 120 | {% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %} 121 | ${0:code_snippet} 122 | {% endcodeblock %} 123 | 124 | snippet gist-full 125 | {% gist ${1:gist_id} ${0:filename} %} 126 | 127 | snippet gist-short 128 | {% gist ${0:gist_id} %} 129 | 130 | snippet img 131 | {% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${0:alt_text} %} 132 | 133 | snippet youtube 134 | {% youtube ${0:video_id} %} 135 | 136 | snippet tb 137 | | ${0:factors} | ${1:a} | ${2:b} | 138 | | ------------- |------------- | ------- | 139 | | ${3:f1} | Y | N | 140 | | ${4:f2} | Y | N | 141 | 142 | # The quote should appear only once in the text. It is inherently part of it. 143 | # See http://octopress.org/docs/plugins/pullquote/ for more info. 144 | 145 | snippet pullquote 146 | {% pullquote %} 147 | ${1:text} {" ${2:quote} "} ${0:text} 148 | {% endpullquote %} 149 | 150 | # Definition lists 151 | snippet : Definition list 152 | $1 153 | : $0 154 | snippet :: Alternate definition list 155 | $1 156 | - $0 157 | -------------------------------------------------------------------------------- /snippets/matlab.snippets: -------------------------------------------------------------------------------- 1 | snippet if if 2 | if ${1} 3 | ${0} 4 | end 5 | 6 | snippet ife if ... else 7 | if ${1} 8 | ${2} 9 | else 10 | ${0} 11 | end 12 | 13 | snippet el else 14 | else 15 | ${0} 16 | 17 | snippet eif elsif 18 | elseif ${1} 19 | ${0} 20 | 21 | snippet wh while 22 | while ${1} 23 | ${0} 24 | end 25 | 26 | snippet for for 27 | for ${1:i} = ${2:1:n} 28 | ${0} 29 | end 30 | 31 | snippet parfor parfor 32 | parfor ${1:i} = ${2:1:n} 33 | ${0} 34 | end 35 | 36 | snippet fun function 37 | function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2}) 38 | ${0} 39 | 40 | snippet try try ... catch 41 | try 42 | ${1} 43 | catch ${2:err} 44 | ${0} 45 | end 46 | 47 | snippet switch switch 48 | switch ${1:n} 49 | case ${2:0} 50 | ${0} 51 | end 52 | 53 | snippet @ anonymous function 54 | @(${1:x}) ${0:x*x} 55 | 56 | snippet cl class 57 | classdef ${1:`vim_snippets#Filename("$1", "class_name")`} 58 | properties 59 | ${2} 60 | end 61 | methods 62 | ${0} 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /snippets/mustache.snippets: -------------------------------------------------------------------------------- 1 | snippet if # {{#value}} ... {{/value}} 2 | {{#${1:value}}} 3 | ${0:${VISUAL}} 4 | {{/$1}} 5 | snippet ifn # {{^value}} ... {{/value}} 6 | {{^${1:value}}} 7 | ${0:${VISUAL}} 8 | {{/$1}} 9 | snippet ife # {{#value}} ... {{/value}} {{^value}} ... {{/value}} 10 | {{#${1:value}}} 11 | ${2:${VISUAL}} 12 | {{/$1}} 13 | {{^$1}} 14 | ${3} 15 | {{/$1}} 16 | -------------------------------------------------------------------------------- /snippets/ocaml.snippets: -------------------------------------------------------------------------------- 1 | snippet doc 2 | (** ${0} *) 3 | snippet comment 4 | (* ${0} *) 5 | snippet let 6 | let ${1} = ${2} in 7 | ${0} 8 | snippet fn 9 | let ${1} = 10 | ${0} 11 | snippet fun 12 | type ${1} = ${0} 13 | snippet mod 14 | module ${1} = struct 15 | ${0} 16 | end 17 | snippet modty 18 | module type ${1} = sig 19 | ${0} 20 | end 21 | snippet sw 22 | match ${1} with 23 | | ${2} -> ${0} 24 | snippet | 25 | | ${1} -> ${0} 26 | snippet p 27 | |> ${0} 28 | snippet if 29 | if ${1} then 30 | ${2} 31 | else 32 | ${0} 33 | snippet fnr 34 | let rec ${1} = 35 | ${0} 36 | snippet try 37 | try 38 | ${1} 39 | with ${0} 40 | -------------------------------------------------------------------------------- /snippets/octave.snippets: -------------------------------------------------------------------------------- 1 | extends matlab 2 | 3 | -------------------------------------------------------------------------------- /snippets/openfoam.snippets: -------------------------------------------------------------------------------- 1 | # 0/* 2 | snippet fv 3 | type fixedValue; 4 | value uniform ${0}; 5 | snippet zg 6 | type zeroGradient; 7 | snippet sym 8 | type symmetryPlane; 9 | # system/controlDict 10 | snippet forces 11 | forces 12 | { 13 | type forces; 14 | functionObjectLibs ("libforces.so"); 15 | enabled true; 16 | outputControl ${1:timeStep}; 17 | outputInterval ${2:1}; 18 | patches (${3}); 19 | log ${4:true}; 20 | CofR (${0:0 0 0}); 21 | } 22 | # system/fvSolution 23 | # solvers 24 | snippet gamg 25 | ${1:p} 26 | { 27 | solver GAMG; 28 | tolerance 1e-${2:6}; 29 | relTol ${0:0.0}; 30 | smoother GaussSeidel; 31 | cacheAgglomeration true; 32 | nCellsInCoarsestLevel 10; 33 | agglomerator faceAreaPair; 34 | mergeLevels 1; 35 | } 36 | snippet pbicg 37 | ${1:U} 38 | { 39 | solver PBiCG; 40 | preconditioner DILU; 41 | tolerance 1e-${2:6}; 42 | relTol ${0:0.0}; 43 | } 44 | # PIMPLE 45 | snippet pimple 46 | PIMPLE 47 | { 48 | nOuterCorrectors ${1:outer}; 49 | nCorrectors ${2:inner}; 50 | nNonOrthogonalCorrectors ${3:nonOrtho}; 51 | pRefCell ${4:cell}; 52 | pRefValue ${0:value for $4}; 53 | } 54 | -------------------------------------------------------------------------------- /snippets/org.snippets: -------------------------------------------------------------------------------- 1 | # Org Mode Snippets Imported from (https://github.com/doomemacs/snippets/) 2 | # Imported by ybenel (github.com/m1ndo) 3 | 4 | # Begin 5 | snippet begin 6 | #+begin_${1:type} ${2:options} 7 | $0 8 | #+end_$1 9 | # Begin Center 10 | snippet 8 | # Function 9 | snippet sub 10 | sub ${1:function_name}(${2:Str $var}) { 11 | ${3} 12 | } 13 | snippet mul 14 | multi ${1:function_name}(${2:Str $var}) { 15 | ${3} 16 | } 17 | # Conditional 18 | snippet if 19 | if ${1} { 20 | ${2} 21 | } 22 | # Conditional if..else 23 | snippet ife 24 | if ${1} { 25 | ${2} 26 | } 27 | else { 28 | ${3} 29 | } 30 | snippet eif 31 | elsif ${1} { 32 | ${2} 33 | } 34 | # Conditional One-line 35 | snippet xif 36 | ${1} if $2; 37 | # Unless conditional 38 | snippet unless 39 | unless ${1} { 40 | ${2} 41 | } 42 | # Unless conditional One-line 43 | snippet xunless 44 | ${1} unless $2; 45 | # Ternary conditional 46 | snippet tc 47 | $1 ?? ${2:value-if-true} !! ${3:value-if-false}; 48 | # given - when (perl6 switch) 49 | snippet switch 50 | given ${1:$var} { 51 | when $2 { 52 | ${3:# code block ...} 53 | } 54 | ${4} 55 | default { 56 | ${5} 57 | } 58 | } 59 | # 'loop' - C's for. 60 | snippet loop 61 | loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) { 62 | ${3} 63 | } 64 | # for loop 65 | snippet for 66 | for ${1:@array} -> ${2:$variable} { 67 | ${3} 68 | } 69 | # While Loop 70 | snippet wh 71 | while ${1} { 72 | ${2} 73 | } 74 | # Repeat while and repean until 75 | snippet rp 76 | repeat { 77 | ${1} 78 | } ${2:while|until} ${3}; 79 | # classes .. 80 | snippet cl 81 | ${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{ 82 | ${4} 83 | } 84 | snippet has 85 | has ${1:Type} ${2:$!identifier}; 86 | snippet mth 87 | method ${1:method_name}(${2:$attr}) { 88 | ${3} 89 | } 90 | snippet pmth 91 | method ${1:!}${2:method_name}(${3:$attr}) { 92 | ${4} 93 | } 94 | snippet smth 95 | submethod ${1:submethod_name}(${2:$attr}) { 96 | ${3} 97 | } 98 | # Tests 99 | snippet test 100 | use v6; 101 | use Test; 102 | ${1:use lib 'lib';} 103 | 104 | plan ${2:$num-tests}; 105 | 106 | # IO 107 | snippet slurp 108 | my ${1:$var} = "${2:filename}".IO.slurp; 109 | snippet rfile 110 | for "${1:filename}".IO.lines -> $line { 111 | ${2} 112 | } 113 | snippet open 114 | my $fh = open "${1:filename}", ${2::r|:w|:a}; 115 | ${3:# actions}; 116 | $fh.close; 117 | -------------------------------------------------------------------------------- /snippets/phoenix.snippets: -------------------------------------------------------------------------------- 1 | snippet cont 2 | defmodule ${1:AppName}Web.${2:ControllerName}Controller do 3 | use $1Web, :controller 4 | 5 | ${3} 6 | end 7 | 8 | snippet view 9 | defmodule ${1:AppName}Web.${2:ViewName}View do 10 | use $1Web, :view 11 | end 12 | 13 | snippet chan 14 | defmodule ${1:AppName}Web.${2:ChannelName}Channel do 15 | use $1Web, :channel 16 | end 17 | -------------------------------------------------------------------------------- /snippets/plsql.snippets: -------------------------------------------------------------------------------- 1 | # create package spec 2 | snippet ps 3 | create or replace package ${1:name} 4 | as 5 | ${0:-- spec} 6 | end; -- end of package spec $1 7 | # create package body 8 | snippet pb 9 | create or replace package body ${1:name} 10 | as 11 | $0 12 | end; -- end of package body $1; 13 | # package procedure spec 14 | snippet pps 15 | procedure ${1:name}(${0:args}); 16 | # package procedure body 17 | snippet ppb 18 | procedure ${1:name}(${2:args}) 19 | as 20 | begin 21 | $0 22 | end $2; 23 | # package function spec 24 | snippet pfs 25 | function ${1:name}(${2:args}) 26 | return ${0:type}; 27 | # package function body 28 | snippet pfb 29 | function ${1:name}(${2:args}) 30 | return ${3:type} 31 | as 32 | l_res $3; 33 | begin 34 | $0; 35 | return l_res; 36 | end $1; 37 | # snow errors 38 | snippet err 39 | show errors; 40 | # proc/func in parameter 41 | snippet p 42 | ${1:name} ${2:in} ${3:type} ${0: := null} 43 | # package type: record 44 | snippet tr 45 | type tr_${1:name} is record (${0:/* columns */}); 46 | # package type: nested table 47 | snippet tt 48 | type tt_${1:name} is table of tr_${0:name}; 49 | # package type: indexed table 50 | snippet tti 51 | type tt_${1:name} is table of tr_${0:name} index by binary_integer; 52 | # proc/func comment 53 | snippet doc 54 | /* 55 | * ${0: comment ...} 56 | */ 57 | # plsql block 58 | snippet beg 59 | begin 60 | ${0} 61 | end; 62 | # plsql block with declare part 63 | snippet dec 64 | declare 65 | ${1} 66 | begin 67 | ${0} 68 | end; 69 | # return pipe row 70 | snippet rpipe 71 | for ${1:i} in 1 .. ${0:l_res}.count loop 72 | pipe row( $2($1) ); 73 | end loop; 74 | return; 75 | # bulk collect 76 | snippet bc 77 | bulk collect into ${0} 78 | # local variable 79 | snippet l 80 | l_${1} ${0:number}; 81 | # output 82 | snippet log 83 | dbms_output.put_line('${0}'); 84 | # for loop 85 | snippet for 86 | for ${1:i} in ${2:1}..${3:42} loop 87 | ${0} 88 | end loop; 89 | # for loop with select 90 | snippet fors 91 | for ${1:rec} in (${2: select}) loop 92 | ${0} 93 | end loop; 94 | # for loop with collection 95 | snippet forc 96 | for ${1:i} in ${2:l_var}.first .. $2.last loop 97 | ${0: -- dbms_output.put_line($2($1)); } 98 | end loop; 99 | # if 100 | snippet if 101 | if ${1} then 102 | ${0} 103 | end if; 104 | snippet ife 105 | if ${1} then 106 | ${2} 107 | else 108 | ${0} 109 | end if; 110 | -------------------------------------------------------------------------------- /snippets/po.snippets: -------------------------------------------------------------------------------- 1 | snippet msg 2 | msgid "${1}" 3 | msgstr "${2}" 4 | 5 | ${0} 6 | -------------------------------------------------------------------------------- /snippets/progress.snippets: -------------------------------------------------------------------------------- 1 | # Progress/OpenEdge ABL snippets 2 | # define 3 | snippet defbuf 4 | DEFINE BUFFER b_${1:TableName} FOR $1 ${0}. 5 | snippet defvar 6 | DEFINE VARIABLE ${1:VariableName} AS ${0}. 7 | snippet nl 8 | NO-LOCK 9 | snippet ne 10 | NO-ERROR 11 | snippet nle 12 | NO-LOCK NO-ERROR 13 | snippet ini 14 | INITIAL ${0:?} 15 | snippet nu 16 | NO-UNDO 17 | snippet err 18 | ERROR 19 | snippet ff 20 | FIND FIRST ${1:BufferName} 21 | ${2:WHERE $1.${3}} ${0} 22 | snippet input 23 | DEFINE INPUT PARAMETER ${1:ParamName} AS ${0}. 24 | snippet output 25 | DEFINE OUTPUT PARAMETER ${1:ParamName} AS ${0:ParamType}. 26 | snippet proc 27 | 28 | /******************************************************************************/ 29 | 30 | PROCEDURE ${1:ProcName}: 31 | 32 | ${0} 33 | 34 | END PROCEDURE. /* $1 */ 35 | 36 | /******************************************************************************/ 37 | 38 | snippet alert 39 | MESSAGE "${1:MessageContent}" ${2:Data} VIEW-AS ALERT-BOX. 40 | snippet if 41 | IF ${1:Condition} 42 | THEN ${2:Action} 43 | ${3:ELSE ${4:OtherWise}} 44 | snippet do 45 | DO${1: Clauses}: 46 | ${0} 47 | END. 48 | # datatypes 49 | snippet int 50 | INTEGER 51 | snippet char 52 | CHARACTER 53 | snippet log 54 | LOGICAL 55 | snippet dec 56 | DECIMAL 57 | snippet sep 58 | /* ------------------------------------------------------------------------- */ 59 | -------------------------------------------------------------------------------- /snippets/ps1.snippets: -------------------------------------------------------------------------------- 1 | # Snippets for 2 | # Authored by Trevor Sullivan 3 | 4 | # PowerShell Class 5 | snippet class 6 | class { 7 | [string] ${1:FirstName} 8 | } 9 | 10 | # PowerShell Advanced Function 11 | snippet function 12 | function ${1:name} { 13 | [CmdletBinding()] 14 | param ( 15 | [Parameter(Mandatory = $true)] 16 | [string] ${2:Param} 17 | ) 18 | 19 | begin { 20 | } 21 | 22 | process { 23 | } 24 | 25 | end { 26 | } 27 | } 28 | 29 | # PowerShell Splatting 30 | snippet splatting 31 | $Params = @{ 32 | ${1:Param1} = '${2:Value1}' 33 | ${3:Param2} = '${4:Value2}' 34 | } 35 | ${5:CommandName} @Params 36 | 37 | # PowerShell Enumeration 38 | snippet enum 39 | enum ${1:name} { 40 | ${2:item1} 41 | ${3:item2} 42 | } 43 | 44 | # PowerShell if..then 45 | snippet if 46 | if ($1) { 47 | $0 48 | } 49 | 50 | # PowerShell if..else 51 | snippet ife 52 | if ( $1 ) { 53 | ${2} 54 | } 55 | else { 56 | ${3} 57 | } 58 | 59 | # PowerShell While Loop 60 | snippet while 61 | while ($1) { 62 | $0 63 | } 64 | 65 | # PowerShell Filter..Sort 66 | snippet filtersort 67 | ${1:command} | Where-Object -FilterScript { $PSItem.${2:property} -${3:operator} '${4:expression}' } | Sort-Object -Property ${5:sortproperty} 68 | 69 | # PowerShell foreach 70 | snippet foreach 71 | foreach ( $${1:iterator} in $${2:collection} ) { 72 | $0 73 | } 74 | 75 | # PowerShell export-csv 76 | snippet epcsv 77 | Export-CSV -NoTypeInformation -Path ${1:path} 78 | 79 | # Powershell Comment Based Help 80 | snippet help 81 | <# 82 | .SYNOPSIS 83 | ${1:Short Description} 84 | .DESCRIPTION 85 | ${2:Full Description} 86 | .PARAMETER ${3:Param1} 87 | ${4: $3 usage} 88 | .EXAMPLE 89 | ${5:Example} 90 | .NOTES 91 | ${6:notes} 92 | .LINK 93 | ${7:online help} 94 | #> 95 | 96 | # Powershell switch statement 97 | snippet switch 98 | switch ( ${1:test} ){ 99 | ${2:condition1} { ${3:action} } 100 | ${4:condition2} { ${5:action} } 101 | default { ${6:action} } 102 | -------------------------------------------------------------------------------- /snippets/purescript.snippets: -------------------------------------------------------------------------------- 1 | snippet mod 2 | module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` 3 | ( 4 | ) where 5 | 6 | import Prelude 7 | 8 | ${0} 9 | snippet imp 10 | import ${0:Data.List} 11 | snippet impq 12 | import ${1:Data.List} as ${0:List} 13 | snippet fn0 14 | ${1:name} :: ${2:a} 15 | $1 = ${0:undefined} 16 | snippet fn 17 | ${1:fn} :: ${2:a} -> ${3:a} 18 | $1 ${4}= ${0} 19 | snippet fn1 20 | ${1:fn} :: ${2:a} -> ${3:a} 21 | $1 ${4}= ${0} 22 | snippet fn2 23 | ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} 24 | $1 ${5}= ${0} 25 | snippet fn3 26 | ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} 27 | $1 ${6}= ${0} 28 | snippet case 29 | case ${1} of 30 | ${2} -> ${0} 31 | snippet let 32 | let 33 | ${1} = ${2} 34 | in 35 | ${3} 36 | snippet where 37 | where 38 | ${1} = ${0} 39 | snippet testunit 40 | module Test.Main where 41 | 42 | import Prelude 43 | import Test.Unit (suite, test) 44 | import Test.Unit.Main (runTest) 45 | import Test.Unit.Assert as Assert 46 | 47 | main = runTest do 48 | suite "${1}" do 49 | test "${2:the tests run}" do 50 | Assert.equal 51 | "Hello, world!" 52 | "Hello, sailor!" 53 | snippet if 54 | if ${1} then 55 | ${2:${VISUAL}} 56 | else 57 | ${0} 58 | snippet doc 59 | {-| ${0} 60 | -} 61 | snippet ty 62 | type ${1:Type} = 63 | ${0} 64 | snippet da 65 | data ${1:Type} = 66 | ${0:$1} 67 | snippet nty 68 | newtype ${1:Type} = 69 | ${2:$1} ${0:Int} 70 | snippet fi 71 | foreign import ${1} :: ${2} 72 | -------------------------------------------------------------------------------- /snippets/r.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env Rscript 3 | 4 | # includes 5 | snippet lib 6 | library(${0:package}) 7 | snippet req 8 | require(${0:package}) 9 | snippet source 10 | source('${0:file}') 11 | 12 | # conditionals 13 | snippet if 14 | if ($1) { 15 | ${0} 16 | } 17 | snippet el 18 | else { 19 | ${0} 20 | } 21 | snippet ei 22 | else if ($1) { 23 | ${0} 24 | } 25 | 26 | # loops 27 | snippet wh 28 | while(${1:true}) { 29 | ${0} 30 | } 31 | snippet wht 32 | while(true) { 33 | ${0} 34 | } 35 | snippet for 36 | for (${1:item} in ${2:list}) { 37 | ${3} 38 | } 39 | snippet foreach 40 | foreach (${1:item} = ${2:list}) { 41 | ${3} 42 | } 43 | 44 | # functions 45 | snippet fun 46 | ${1:name} <- function (${2:variables}) { 47 | ${0} 48 | } 49 | snippet ret 50 | return(${0}) 51 | 52 | # dataframes, lists, etc 53 | snippet df 54 | ${1:name}[${2:rows}, ${0:cols}] 55 | snippet c 56 | c(${0:items}) 57 | snippet li 58 | list(${0:items}) 59 | snippet mat 60 | matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols}) 61 | 62 | # apply functions 63 | snippet apply 64 | apply(${1:array}, ${2:margin}, ${0:function}) 65 | snippet lapply 66 | lapply(${1:list}, ${0:function}) 67 | snippet sapply 68 | lapply(${1:list}, ${0:function}) 69 | snippet vapply 70 | vapply(${1:list}, ${2:function}, ${0:type}) 71 | snippet mapply 72 | mapply(${1:function}, ${0:...}) 73 | snippet tapply 74 | tapply(${1:vector}, ${2:index}, ${0:function}) 75 | snippet rapply 76 | rapply(${1:list}, ${0:function}) 77 | 78 | # plyr functions 79 | snippet dd 80 | ddply(${1:frame}, ${2:variables}, ${0:function}) 81 | snippet dl 82 | dlply(${1:frame}, ${2:variables}, ${0:function}) 83 | snippet da 84 | daply(${1:frame}, ${2:variables}, ${0:function}) 85 | snippet d_ 86 | d_ply(${1:frame}, ${2:variables}, ${0:function}) 87 | 88 | snippet ad 89 | adply(${1:array}, ${2:margin}, ${0:function}) 90 | snippet al 91 | alply(${1:array}, ${2:margin}, ${0:function}) 92 | snippet aa 93 | aaply(${1:array}, ${2:margin}, ${0:function}) 94 | snippet a_ 95 | a_ply(${1:array}, ${2:margin}, ${0:function}) 96 | 97 | snippet ld 98 | ldply(${1:list}, ${0:function}) 99 | snippet ll 100 | llply(${1:list}, ${0:function}) 101 | snippet la 102 | laply(${1:list}, ${0:function}) 103 | snippet l_ 104 | l_ply(${1:list}, ${0:function}) 105 | 106 | snippet md 107 | mdply(${1:matrix}, ${0:function}) 108 | snippet ml 109 | mlply(${1:matrix}, ${0:function}) 110 | snippet ma 111 | maply(${1:matrix}, ${0:function}) 112 | snippet m_ 113 | m_ply(${1:matrix}, ${0:function}) 114 | 115 | # plot functions 116 | snippet pl 117 | plot(${1:x}, ${0:y}) 118 | snippet ggp 119 | ggplot(${1:data}, aes(${0:aesthetics})) 120 | snippet img 121 | ${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}') 122 | ${0:plot} 123 | dev.off() 124 | 125 | # statistical test functions 126 | snippet fis 127 | fisher.test(${1:x}, ${0:y}) 128 | snippet chi 129 | chisq.test(${1:x}, ${0:y}) 130 | snippet tt 131 | t.test(${1:x}, ${0:y}) 132 | snippet wil 133 | wilcox.test(${1:x}, ${0:y}) 134 | snippet cor 135 | cor.test(${1:x}, ${0:y}) 136 | snippet fte 137 | var.test(${1:x}, ${0:y}) 138 | snippet kvt 139 | kv.test(${1:x}, ${0:y}) 140 | -------------------------------------------------------------------------------- /snippets/racket.snippets: -------------------------------------------------------------------------------- 1 | # Languages 2 | snippet #r 3 | #lang racket 4 | snippet #tr 5 | #lang typed/racket 6 | snippet #rg 7 | #lang racket/gui 8 | snippet #sb 9 | #lang scribble/base 10 | snippet #d 11 | #lang datalog 12 | snippet #wi 13 | #lang web-server/insta 14 | 15 | # Defines 16 | snippet def 17 | (define ${1} ${0}) 18 | snippet defun 19 | (define (${1}) 20 | ${0}) 21 | snippet defv "define-values" 22 | (define-values (${1}) (${0})) 23 | snippet defm "define/match" 24 | (define/match (${1}) 25 | [(${2}) ${3}] 26 | ${0}) 27 | snippet defs "define-syntax" 28 | (define-syntax (${1}) 29 | ${0}) 30 | 31 | # Conditionals 32 | snippet if 33 | (if ${1} ${2} ${0}) 34 | snippet ifn 35 | (if (not ${1}) ${2} ${0}) 36 | snippet ifl 37 | (if ${1} 38 | (let (${2}) 39 | ${3}) 40 | ${0}) 41 | snippet ifnl 42 | (if (not ${1}) 43 | (let (${2}) 44 | ${3}) 45 | ${0}) 46 | snippet ifb 47 | (if ${1} 48 | (begin 49 | ${2}) 50 | ${0}) 51 | snippet ifnb 52 | (if (not ${1}) 53 | (begin 54 | ${2}) 55 | ${0}) 56 | snippet when 57 | (when ${1} 58 | ${0}) 59 | snippet unless 60 | (unless ${1} ${2} ${0}) 61 | snippet cond 62 | (cond 63 | [(${1}) ${0}]) 64 | snippet conde 65 | (cond 66 | [(${1}) ${2}] 67 | [else ${0}]) 68 | snippet case 69 | (case ${1} 70 | [(${2}) ${0}]) 71 | snippet match 72 | (match ${1} 73 | [(${2}) ${0}]) 74 | 75 | # For iterations 76 | snippet for 77 | (for ([${1}]) 78 | ${0}) 79 | snippet forl "for/list" 80 | (for/list ([${1}]) 81 | ${0}) 82 | snippet forf "for/fold" 83 | (for/fold 84 | ([${1}]) 85 | ([${2}]) 86 | ${0}) 87 | snippet forfr "for/foldr" 88 | (for/foldr 89 | ([${1}]) 90 | ([${2}]) 91 | ${0}) 92 | snippet fora "for/and" 93 | (for/and ([${1}]) 94 | ${0}) 95 | snippet foro "for/or" 96 | (for/or ([${1}]) 97 | ${0}) 98 | snippet fors "for/sum" 99 | (for/sum ([${1}]) 100 | ${0}) 101 | snippet forp "for/product" 102 | (for/product ([${1}]) 103 | ${0}) 104 | snippet forfi "for/first" 105 | (for/first ([${1}]) 106 | ${0}) 107 | snippet forla "for/last" 108 | (for/last ([${1}]) 109 | ${0}) 110 | 111 | snippet lambda 112 | (lambda (${1}) ${0}) 113 | snippet apply 114 | (apply ${1} ${0}) 115 | snippet map 116 | (map ${1} ${0}) 117 | snippet filter 118 | (filter ${1} ${0}) 119 | 120 | snippet req 121 | (require ${0}) 122 | snippet prov 123 | (provide ${0}) 124 | 125 | snippet let 126 | (let ([${1}]) ${0}) 127 | snippet letcc 128 | (let/cc here (set! ${1} here) ${0}) 129 | snippet begin 130 | (begin 131 | ${0}) 132 | -------------------------------------------------------------------------------- /snippets/reason.snippets: -------------------------------------------------------------------------------- 1 | snippet doc 2 | /* 3 | ${0} 4 | */ 5 | snippet let 6 | let ${1} = ${0}; 7 | snippet fn 8 | let ${1} = (${2}) => { 9 | ${0} 10 | }; 11 | snippet fun 12 | fun ${1} => ${0} 13 | snippet ty 14 | type ${1} = ${0}; 15 | snippet mod 16 | module ${1} = { 17 | ${0} 18 | }; 19 | snippet modty 20 | module type ${1} = { 21 | ${0} 22 | }; 23 | snippet sw 24 | switch (${1}) { 25 | | ${2} => ${0} 26 | } 27 | snippet | 28 | | ${1} => ${0} 29 | snippet p 30 | |> ${0} 31 | snippet if 32 | if (${1}) { 33 | ${2} 34 | } else { 35 | ${0} 36 | } 37 | -------------------------------------------------------------------------------- /snippets/rmd.snippets: -------------------------------------------------------------------------------- 1 | # 2 | # Snipmate Snippets for Pandoc Markdown 3 | # 4 | # Many snippets have starred versions, i.e., versions 5 | # that end with an asterisk (`*`). These snippets use 6 | # vim's `"*` register---i.e., the contents of the 7 | # system clipboard---to insert text. 8 | 9 | extends markdown 10 | 11 | # Insert Title Block 12 | snippet %% 13 | % ${1:`Filename('', 'title')`} 14 | % ${2:`g:snips_author`} 15 | % ${3:`strftime("%d %B %Y")`} 16 | 17 | ${4} 18 | snippet %%* 19 | % ${1:`Filename('', @*)`} 20 | % ${2:`g:snips_author`} 21 | % ${3:`strftime("%d %b %Y")`} 22 | 23 | ${4} 24 | 25 | # library() 26 | snippet req 27 | require(${1:}, quietly = TRUE) 28 | # If Condition 29 | snippet if 30 | if ( $1 ) 31 | { 32 | ${2:} 33 | } 34 | snippet el 35 | else 36 | { 37 | ${1:} 38 | } 39 | 40 | # Function 41 | snippet fun 42 | ${1:funname} <- # ${2:} 43 | function 44 | ( 45 | ${3:} 46 | ) 47 | { 48 | ${4:} 49 | } 50 | # repeat 51 | snippet re 52 | repeat{ 53 | ${2:} 54 | if($1) break 55 | } 56 | 57 | # matrix 58 | snippet ma 59 | matrix(NA, nrow = ${1:}, ncol = ${2:}) 60 | 61 | # data frame 62 | snippet df 63 | data.frame(${1:}, header = TRUE) 64 | 65 | snippet cmdarg 66 | args <- commandArgs(TRUE) 67 | if (length(args) == 0) 68 | stop("Please give ${1:}!") 69 | if (!all(file.exists(args))) 70 | stop("Couln't find input files!") 71 | 72 | snippet getopt 73 | require('getopt', quietly = TRUE) 74 | opt_spec <- matrix(c( 75 | 'help', 'h', 0, "logical", "Getting help", 76 | 'file', 'f', 1, "character","File to process" 77 | ), ncol = 5, byrow = TRUE) 78 | opt <- getopt(spec = opt_spec) 79 | if ( !is.null(opt$help) || is.null(commandArgs()) ) { 80 | cat(getopt(spec = opt_spec, usage = TRUE, command = "yourCmd")) 81 | q(status=0) 82 | } 83 | # some inital value 84 | if ( is.null(opt$???) ) { opt$??? <- ??? } 85 | 86 | snippet optparse 87 | require("optparse", quietly = TRUE) 88 | option_list <- 89 | list(make_option(c("-n", "--add_numbers"), action="store_true", default=FALSE, 90 | help="Print line number at the beginning of each line [default]") 91 | ) 92 | parser <- OptionParser(usage = "%prog [options] file", option_list=option_list) 93 | arguments <- parse_args(parser, positional_arguments = TRUE) 94 | opt <- arguments$options 95 | 96 | if(length(arguments$args) != 1) { 97 | cat("Incorrect number of required positional arguments\n\n") 98 | print_help(parser) 99 | stop() 100 | } else { 101 | file <- arguments$args 102 | } 103 | 104 | if( file.access(file) == -1) { 105 | stop(sprintf("Specified file ( %s ) does not exist", file)) 106 | } else { 107 | file_text <- readLines(file) 108 | } 109 | 110 | snippet #! 111 | #!/usr/bin/env Rscript 112 | 113 | snippet debug 114 | # Development & Debugging, don't forget to uncomment afterwards! 115 | #-------------------------------------------------------------------------------- 116 | #setwd("~/Projekte/${1:}") 117 | #opt <- list(${2:} 118 | # ) 119 | #-------------------------------------------------------------------------------- 120 | 121 | 122 | # Took from pandoc-plugin <<<< 123 | # Underline with `=`s or `-`s 124 | snippet #=== 125 | #`repeat('=', strlen(getline(line(".") - 1)))` 126 | ${1} 127 | snippet #--- 128 | #`repeat('-', strlen(getline(line(".") - 1)))` 129 | ${1} 130 | 131 | # >>>> 132 | 133 | snippet r 134 | \`\`\`{r ${1:chung_tag}, echo = FALSE ${2:options}} 135 | ${3:} 136 | \`\`\` 137 | snippet ri 138 | \`{r ${1:}}\` 139 | 140 | snippet copt 141 | \`\`\` {r setup, echo = FALSE} 142 | opts_chunk$set(fig.path='../figures/${1:}', cache.path='../cache/-' 143 | , fig.align='center', fig.show='hold', par=TRUE) 144 | #opts_knit$set(upload.fun = imgur_upload) # upload images 145 | \`\`\` 146 | 147 | 148 | # End of File =================================================================== 149 | # vim: set noexpandtab: 150 | -------------------------------------------------------------------------------- /snippets/rst.snippets: -------------------------------------------------------------------------------- 1 | # rst 2 | 3 | snippet : 4 | :${1:field name}: $0 5 | snippet * 6 | *${1:Emphasis}* ${0} 7 | snippet ** 8 | **${1:Strong emphasis}** ${0} 9 | snippet _ 10 | \`${1:hyperlink-name}\`_ 11 | .. _\`$1\`: ${0:link-block} 12 | snippet = 13 | ${1:Title} 14 | =====${2:=} 15 | ${0} 16 | snippet - 17 | ${1:Title} 18 | -----${2:-} 19 | ${0} 20 | #some directive 21 | snippet img: 22 | .. |${1:alias}| image:: ${0:img} 23 | snippet fig: 24 | .. figure:: ${1:img} 25 | :alt: ${2:alter text} 26 | 27 | $0 28 | snippet con: 29 | .. contents:: ${1:Table of Contents} 30 | 31 | ${0:content} 32 | snippet cod: 33 | .. code:: ${1:type} 34 | 35 | ${0:write some code} 36 | snippet tip: 37 | .. tip:: 38 | ${0:my tips} 39 | snippet not: 40 | .. note:: 41 | ${0:my notes} 42 | snippet war: 43 | .. warning:: 44 | ${0:attention!} 45 | snippet imp: 46 | .. important:: 47 | ${0:this is importatnt} 48 | snippet att: 49 | .. attention:: 50 | ${0:hey!} 51 | snippet dan: 52 | .. danger:: 53 | ${0:ah!} 54 | snippet err: 55 | .. error:: 56 | ${0:Error occur} 57 | snippet cau: 58 | .. caution:: 59 | ${0:Watch out!} 60 | #Sphinx only 61 | snippet sid: 62 | .. sidebar:: ${1:Title} 63 | 64 | ${0} 65 | snippet tod: 66 | .. todo:: 67 | ${0} 68 | snippet lis: 69 | .. list-table:: ${1:Title} 70 | :header-rows: 1 71 | :stub-columns: 0 72 | 73 | * - ${0:R1C1} 74 | - R1C2 75 | * - R2C1 76 | - R2C2 77 | snippet csv: 78 | .. csv-table:: ${1:Title} 79 | :header-rows: 1 80 | :stub-columns: 0 81 | 82 | ${0:R1C1}, R1C2 83 | R2C1, R2C2 84 | snippet toc: 85 | .. toctree:: 86 | :maxdepth: 2 87 | 88 | ${0} 89 | snippet dow: 90 | :download:\`${1:text} <${0:path}>\` 91 | snippet ref: 92 | :ref:\`${1:text} <${0:path}>\` 93 | snippet doc: 94 | :doc:\`${1:text} <${0:path}>\` 95 | # CJK optimize, CJK has no space between charaters 96 | snippet *c 97 | \ *${1:Emphasis}*\ ${0} 98 | snippet **c 99 | \ **${1:Strong emphasis}**\ ${0} 100 | 101 | # vim:set list noet sts=0 sw=4 ts=4: 102 | -------------------------------------------------------------------------------- /snippets/scheme.snippets: -------------------------------------------------------------------------------- 1 | snippet + 2 | (+ ${1} 3 | ${0}) 4 | 5 | snippet - 6 | (- ${1} 7 | ${0}) 8 | 9 | snippet / 10 | (/ ${1} 11 | ${0}) 12 | 13 | snippet * 14 | (* ${1} 15 | ${0}) 16 | 17 | # Definition 18 | snippet def 19 | (define (${1:name}) 20 | ${0:definition}) 21 | 22 | # Definition with lambda 23 | snippet defl 24 | (define ${1:name} 25 | (lambda (x)(${0:definition}))) 26 | 27 | # Condition 28 | snippet cond 29 | (cond ((${1:predicate}) (${2:action})) 30 | ((${3:predicate}) (${0:action}))) 31 | 32 | # If statement 33 | snippet if 34 | (if (${1:predicate}) 35 | (${2:true-action}) 36 | (${0:false-action})) 37 | -------------------------------------------------------------------------------- /snippets/scss.snippets: -------------------------------------------------------------------------------- 1 | extends css 2 | 3 | snippet $ 4 | $${1:variable}: ${0:value}; 5 | snippet imp 6 | @import '${0}'; 7 | snippet mix 8 | @mixin ${1:name}(${2}) { 9 | ${0} 10 | } 11 | snippet inc 12 | @include ${1:mixin}(${2}); 13 | snippet ext 14 | @extend ${0}; 15 | snippet fun 16 | @function ${1:name}(${2:args}) { 17 | ${0} 18 | } 19 | snippet if 20 | @if $1 { 21 | ${0} 22 | } 23 | snippet ife 24 | @if $1 { 25 | ${2} 26 | } @else { 27 | ${0} 28 | } 29 | snippet eif 30 | @else if $1 { 31 | ${0} 32 | } 33 | snippet for 34 | @for ${1:$i} from ${2:1} through ${3:3} { 35 | ${0} 36 | } 37 | snippet each 38 | @each ${1:$item} in ${2:items} { 39 | ${0} 40 | } 41 | snippet while 42 | @while ${1:$i} ${2:>} ${3:0} { 43 | ${0} 44 | } 45 | -------------------------------------------------------------------------------- /snippets/sh.snippets: -------------------------------------------------------------------------------- 1 | # Shebang 2 | snippet #! 3 | #!/bin/sh 4 | 5 | snippet s#! 6 | #!/bin/sh 7 | set -eu 8 | 9 | snippet safe 10 | set -eu 11 | 12 | snippet bash 13 | #!/usr/bin/env bash 14 | 15 | snippet sbash 16 | #!/usr/bin/env bash 17 | set -euo pipefail 18 | IFS=$'\n\t' 19 | 20 | snippet if 21 | if [ $1 ]; then 22 | ${0:${VISUAL}} 23 | fi 24 | snippet elif 25 | elif [ $1 ]; then 26 | ${0:${VISUAL}} 27 | snippet for 28 | for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do 29 | ${0:${VISUAL}} 30 | done 31 | snippet fori 32 | for ${1:needle} in ${2:haystack} ; do 33 | ${0:${VISUAL}} 34 | done 35 | snippet wh 36 | while [ $1 ]; do 37 | ${0:${VISUAL}} 38 | done 39 | snippet wht 40 | while true; do 41 | ${0:${VISUAL}} 42 | done 43 | snippet until 44 | until [ $1 ]; do 45 | ${0:${VISUAL}} 46 | done 47 | snippet case 48 | case ${1:word} in 49 | ${2:pattern}) 50 | ${0};; 51 | esac 52 | snippet go 53 | while getopts '${1:o}' ${2:opts} 54 | do 55 | case $$2 in 56 | ${3:o0}) 57 | ${0:#staments};; 58 | esac 59 | done 60 | # Set SCRIPT_DIR variable to directory script is located. 61 | snippet sdir 62 | SCRIPT_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )" 63 | # getopt 64 | snippet getopt 65 | __ScriptVersion="${1:version}" 66 | 67 | #=== FUNCTION ================================================================ 68 | # NAME: usage 69 | # DESCRIPTION: Display usage information. 70 | #=============================================================================== 71 | function usage () 72 | { 73 | echo "Usage : \$${0:0} [options] [--] 74 | 75 | Options: 76 | -h|help Display this message 77 | -v|version Display script version" 78 | 79 | } # ---------- end of function usage ---------- 80 | 81 | #----------------------------------------------------------------------- 82 | # Handle command line arguments 83 | #----------------------------------------------------------------------- 84 | 85 | while getopts ":hv" opt 86 | do 87 | case \$opt in 88 | 89 | h|help ) usage; exit 0 ;; 90 | 91 | v|version ) echo "\$${0:0} -- Version \$__ScriptVersion"; exit 0 ;; 92 | 93 | * ) echo -e "\\n Option does not exist : \$OPTARG\\n" 94 | usage; exit 1 ;; 95 | 96 | esac # --- end of case --- 97 | done 98 | shift \$(($OPTIND-1)) 99 | snippet root 100 | if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi 101 | 102 | snippet fun-sh 103 | ${1:function_name}() { 104 | $0 105 | } 106 | 107 | snippet fun 108 | function ${1:function_name}() { 109 | $0 110 | } 111 | -------------------------------------------------------------------------------- /snippets/simplemvcf.snippets: -------------------------------------------------------------------------------- 1 | snippet sm_controller 2 | db->select('SELECT * FROM '.$table.' WHERE ${3:where}', $data); 49 | } 50 | 51 | public function getRows($where) 52 | { 53 | return $this->db->select('SELECT * FROM '.$table.'); 54 | } 55 | 56 | public function insert($data) 57 | { 58 | $this->db->insert($table, $data); 59 | } 60 | 61 | public function update($data, $where) 62 | { 63 | $this->db->update($table ,$data, $where); 64 | } 65 | 66 | public function delete($where) 67 | { 68 | $this->db->delete($table, $where); 69 | } 70 | } 71 | snippet sm_render 72 | View::render('${1:view}', $${2:array}); 73 | snippet sm_render_template 74 | View::renderTemplate('${1:part}', $${2:array}); 75 | 76 | # database 77 | snippet sm_db_select 78 | $this->db->select(${1:sql}, ${2:where}); 79 | 80 | snippet sm_db_insert 81 | $this->db->insert(${1:table}, ${2:data}); 82 | 83 | snippet sm_db_update 84 | $this->db->update(${1:table}, ${2:data}, ${3:where}); 85 | 86 | snippet sm_db_delete 87 | $this->db->delete(${1:table}, ${2:where}); 88 | 89 | snippet sm_db_truncate 90 | $this->db->delete(${1:table}); 91 | 92 | #session 93 | snippet sm_session_set 94 | Session::set(${1:key}, ${2:value}); 95 | 96 | snippet sm_session_get 97 | Session::get(${1:key}); 98 | 99 | snippet sm_session_pull 100 | Session::pull(${1:key}); 101 | 102 | snippet sm_session_id 103 | Session::id(); 104 | 105 | snippet sm_session_destroy 106 | Session::set(${1:key}); 107 | 108 | snippet sm_session_display 109 | Session::display(); 110 | 111 | #url 112 | snippet sm_url_redirect 113 | Url:redirect('${1:path}'); 114 | 115 | snippet sm_url_previous 116 | Url:previous(); 117 | 118 | snippet sm_url_templatepath 119 | Url:templatePath(); 120 | 121 | snippet sm_url_autolink 122 | Url:autolink('${1:string}'); 123 | -------------------------------------------------------------------------------- /snippets/slim.snippets: -------------------------------------------------------------------------------- 1 | snippet pry 2 | - binding.pry 3 | snippet renp 4 | = render partial: '${0}' 5 | # Forms 6 | # ===== 7 | snippet fieldset 8 | fieldset 9 | legend ${1} 10 | snippet css 11 | link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" 12 | snippet script 13 | script src="${1:script.js}" type="text/javascript" 14 | # Some useful Unicode entities 15 | # ============================ 16 | # Non-Breaking Space 17 | snippet nbs 18 |   19 | # ← 20 | snippet left 21 | ← 22 | # → 23 | snippet right 24 | → 25 | # ↑ 26 | snippet up 27 | ↑ 28 | # ↓ 29 | snippet down 30 | ↓ 31 | # ↩ 32 | snippet return 33 | ↩ 34 | # ⇤ 35 | snippet backtab 36 | ⇤ 37 | # ⇥ 38 | snippet tab 39 | ⇥ 40 | # ⇧ 41 | snippet shift 42 | ⇧ 43 | # ⌃ 44 | snippet ctrl 45 | ⌃ 46 | # ⌅ 47 | snippet enter 48 | ⌅ 49 | # ⌘ 50 | snippet cmd 51 | ⌘ 52 | # ⌥ 53 | snippet option 54 | ⌥ 55 | # ⌦ 56 | snippet delete 57 | ⌦ 58 | # ⌫ 59 | snippet backspace 60 | ⌫ 61 | # ⎋ 62 | snippet esc 63 | ⎋ 64 | -------------------------------------------------------------------------------- /snippets/snippets.snippets: -------------------------------------------------------------------------------- 1 | # snippets for making snippets :) 2 | snippet snip 3 | snippet ${1:trigger} "${2:description}" 4 | ${0:${VISUAL}} 5 | snippet v 6 | {VISUAL} 7 | snippet $ 8 | ${${1:1}:${0:text}} 9 | -------------------------------------------------------------------------------- /snippets/sql.snippets: -------------------------------------------------------------------------------- 1 | snippet tbl 2 | create table ${1:table} ( 3 | ${0:columns} 4 | ); 5 | snippet col 6 | ${1:name} ${2:type} ${3:default ''} ${0:not null} 7 | snippet ccol 8 | ${1:name} varchar2(${2:size}) ${3:default ''} ${0:not null} 9 | snippet ncol 10 | ${1:name} number ${3:default 0} ${0:not null} 11 | snippet dcol 12 | ${1:name} date ${3:default sysdate} ${0:not null} 13 | snippet ind 14 | create index ${0:$1_$2} on ${1:table}(${2:column}); 15 | snippet uind 16 | create unique index ${1:name} on ${2:table}(${0:column}); 17 | snippet tblcom 18 | comment on table ${1:table} is '${0:comment}'; 19 | snippet colcom 20 | comment on column ${1:table}.${2:column} is '${0:comment}'; 21 | snippet addcol 22 | alter table ${1:table} add (${2:column} ${0:type}); 23 | snippet seq 24 | create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${0:1}; 25 | snippet s* 26 | select * from ${0:table} 27 | -------------------------------------------------------------------------------- /snippets/supercollider.snippets: -------------------------------------------------------------------------------- 1 | snippet b 2 | ( 3 | ${0} 4 | ) 5 | snippet if 6 | if (${1}) { 7 | ${0} 8 | } 9 | snippet ife 10 | if (${1}) { 11 | ${2} 12 | } { 13 | ${0} 14 | } 15 | snippet for 16 | for (${1:1}, ${2:10}) { |i| 17 | ${0} 18 | } 19 | snippet sdef 20 | SynthDef(\\${1:synthName}, {${2} 21 | ${0} 22 | }).add; 23 | -------------------------------------------------------------------------------- /snippets/svelte.snippets: -------------------------------------------------------------------------------- 1 | extends html, javascript, css 2 | -------------------------------------------------------------------------------- /snippets/tcl.snippets: -------------------------------------------------------------------------------- 1 | # #!/usr/bin/env tclsh 2 | snippet #! 3 | #!/usr/bin/env tclsh 4 | 5 | # Process 6 | snippet pro 7 | proc ${1:function_name} {${2:args}} { 8 | ${0} 9 | } 10 | #xif 11 | snippet xif 12 | ${1:expr}? ${2:true} : ${0:false} 13 | # Conditional 14 | snippet if 15 | if {${1}} { 16 | ${0} 17 | } 18 | # Conditional if..else 19 | snippet ife 20 | if {${1}} { 21 | ${2} 22 | } else { 23 | ${0:# else...} 24 | } 25 | snippet eif 26 | elseif {${1}} { 27 | ${0} 28 | } 29 | # Conditional if..elsif..else 30 | snippet ifee 31 | if {${1}} { 32 | ${2} 33 | } elseif {${3}} { 34 | ${4:# elsif...} 35 | } else { 36 | ${0:# else...} 37 | } 38 | # If catch then 39 | snippet ifc 40 | if { [catch {${1:#do something...}} ${2:err}] } { 41 | ${0:# handle failure...} 42 | } 43 | # Catch 44 | snippet catch 45 | catch {${1}} ${2:err} ${0:options} 46 | # While Loop 47 | snippet wh 48 | while {${1}} { 49 | ${0} 50 | } 51 | # For Loop 52 | snippet for 53 | for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} { 54 | ${0} 55 | } 56 | # Foreach Loop 57 | snippet fore 58 | foreach ${1:x} {${2:#list}} { 59 | ${0} 60 | } 61 | # after ms script... 62 | snippet af 63 | after ${1:ms} ${0:#do something} 64 | # after cancel id 65 | snippet afc 66 | after cancel ${0:id or script} 67 | # after idle 68 | snippet afi 69 | after idle ${0:script} 70 | # after info id 71 | snippet afin 72 | after info ${0:id} 73 | # Expr 74 | snippet exp 75 | expr {${0:#expression here}} 76 | # Switch 77 | snippet sw 78 | switch ${1:var} { 79 | ${3:pattern 1} { 80 | ${0:#do something} 81 | } 82 | default { 83 | ${2:#do something} 84 | } 85 | } 86 | # Case 87 | snippet ca 88 | ${1:pattern} { 89 | ${2:#do something} 90 | } 91 | # Namespace eval 92 | snippet ns 93 | namespace eval ${1:path} {${0:#script...}} 94 | # Namespace current 95 | snippet nsc 96 | namespace current 97 | -------------------------------------------------------------------------------- /snippets/textile.snippets: -------------------------------------------------------------------------------- 1 | # Jekyll post header 2 | snippet header 3 | --- 4 | title: ${1:title} 5 | layout: post 6 | date: ${2:date} ${0:hour:minute:second} -05:00 7 | --- 8 | 9 | # Image 10 | snippet img 11 | !${1:url}(${2:title}):${0:link}! 12 | 13 | # Table 14 | snippet | 15 | |${1}| 16 | 17 | # Link 18 | snippet link 19 | "${1:link text}":${0:url} 20 | 21 | # Acronym 22 | snippet ( 23 | (${1:Expand acronym}) 24 | 25 | # Footnote 26 | snippet fn 27 | [${1:ref number}] ${0} 28 | 29 | fn$1. ${2:footnote} 30 | 31 | -------------------------------------------------------------------------------- /snippets/typescript.snippets: -------------------------------------------------------------------------------- 1 | extends javascript 2 | 3 | snippet tconst "ts const" 4 | const ${1}: ${2:any} = ${3}; 5 | ${0} 6 | snippet tlet "ts let" 7 | let ${1}: ${2:any} = ${3}; 8 | ${0} 9 | snippet tvar "ts var" 10 | var ${1}: ${2:any} = ${3}; 11 | ${0} 12 | snippet + "ts create field" 13 | ${1}: ${0:any} 14 | snippet #+ "ts create private field using #" 15 | #${1}: ${0:any} 16 | snippet tpfi "ts create public field" 17 | public ${1}: ${0:any} 18 | snippet tprfi "ts create private field" 19 | private ${1}: ${0:any} 20 | snippet tprofi "ts create protected field" 21 | protected ${1}: ${0:any} 22 | snippet int "interface" 23 | interface ${1} { 24 | ${2}: ${3:any}; 25 | ${0} 26 | } 27 | snippet intx "interface extends" 28 | interface ${1} extends ${2} { 29 | ${3}: ${4:any}; 30 | ${0} 31 | } 32 | snippet tfun "ts function" 33 | function ${1}(${2}): ${3:any} { 34 | ${0} 35 | } 36 | snippet tpmet "ts public method" 37 | public ${1}(${2}): ${3:any} { 38 | ${0} 39 | } 40 | snippet tpsmet "ts public static method" 41 | public static ${1}(${2}): ${3:any} { 42 | ${0} 43 | } 44 | snippet tprmet "ts private method" 45 | private ${1}(${2}): ${3:any} { 46 | ${0} 47 | } 48 | snippet tpromet "ts protected method" 49 | protected ${1}(${2}): ${3:any} { 50 | ${0} 51 | } 52 | snippet tcla "ts class" 53 | class ${1} { 54 | ${2} 55 | constructor(public ${3}: ${4: any}) { 56 | ${5} 57 | } 58 | ${0} 59 | } 60 | snippet tclax "ts class extends" 61 | class ${1} extends ${2} { 62 | ${3} 63 | constructor(public ${4}: ${5: any}) { 64 | ${6} 65 | } 66 | ${0} 67 | } 68 | -------------------------------------------------------------------------------- /snippets/typescriptreact.snippets: -------------------------------------------------------------------------------- 1 | extends typescript 2 | -------------------------------------------------------------------------------- /snippets/verilog.snippets: -------------------------------------------------------------------------------- 1 | # if statement 2 | snippet if 3 | if (${1}) begin 4 | ${0} 5 | end 6 | # If/else statements 7 | snippet ife 8 | if (${1}) begin 9 | ${2} 10 | end 11 | else begin 12 | ${3} 13 | end 14 | # Else if statement 15 | snippet eif 16 | else if (${1}) begin 17 | ${0} 18 | end 19 | #Else statement 20 | snippet el 21 | else begin 22 | ${0} 23 | end 24 | # While statement 25 | snippet wh 26 | while (${1}) begin 27 | ${0} 28 | end 29 | # Repeat Loop 30 | snippet rep 31 | repeat (${1}) begin 32 | ${0} 33 | end 34 | # Case statement 35 | snippet case 36 | case (${1:/* variable */}) 37 | ${2:/* value */}: begin 38 | ${3} 39 | end 40 | default: begin 41 | ${4} 42 | end 43 | endcase 44 | # CaseZ statement 45 | snippet casez 46 | casez (${1:/* variable */}) 47 | ${2:/* value */}: begin 48 | ${3} 49 | end 50 | default: begin 51 | ${4} 52 | end 53 | endcase 54 | # Always block 55 | snippet al 56 | always @(${1:/* sensitive list */}) begin 57 | ${0} 58 | end 59 | # Module block 60 | snippet mod 61 | module ${1:`vim_snippets#Filename('$1', 'name')`} (${2}); 62 | ${0} 63 | endmodule 64 | # For 65 | snippet for 66 | for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) begin 67 | ${4} 68 | end 69 | # Forever 70 | snippet forev 71 | forever begin 72 | ${0} 73 | end 74 | # Function 75 | snippet fun 76 | function ${1:void} ${2:name}(${3}); 77 | ${0} 78 | endfunction: $2 79 | # Task 80 | snippet task 81 | task ${1:name}(${2}); 82 | ${0} 83 | endtask: $1 84 | # Initial 85 | snippet ini 86 | initial begin 87 | ${0} 88 | end 89 | # typedef struct packed 90 | snippet tdsp 91 | typedef struct packed { 92 | int ${2:data}; 93 | } ${1:`vim_snippets#Filename('$1_t', 'name')`}; 94 | # typedef eum 95 | snippet tde 96 | typedef enum ${2:logic[15:0]} 97 | { 98 | ${3:REG = 16'h0000} 99 | } ${1:my_dest_t}; 100 | -------------------------------------------------------------------------------- /snippets/vhdl.snippets: -------------------------------------------------------------------------------- 1 | # 2 | ## Libraries 3 | 4 | snippet lib 5 | library ${1} 6 | use $1.${2} 7 | 8 | # Standard Libraries 9 | snippet libs 10 | library IEEE; 11 | use IEEE.std_logic_1164.ALL; 12 | use IEEE.numeric_std.ALL; 13 | 14 | # Xilinx Library 15 | snippet libx 16 | library UNISIM; 17 | use UNISIM.VCOMPONENTS.ALL; 18 | 19 | ## Entity Declaration 20 | snippet ent 21 | entity ${1:`vim_snippets#Filename()`} is 22 | generic ( 23 | ${2} 24 | ); 25 | port ( 26 | ${3} 27 | ); 28 | end entity $1; 29 | 30 | ## Architecture 31 | snippet arc 32 | architecture ${1:behav} of ${2:`vim_snippets#Filename()`} is 33 | 34 | ${3} 35 | 36 | begin 37 | 38 | 39 | end $1; 40 | 41 | ## Declarations 42 | # std_logic 43 | snippet st 44 | signal ${1} : std_logic; 45 | # std_logic_vector 46 | snippet sv 47 | signal ${1} : std_logic_vector (${2} downto 0); 48 | # std_logic in 49 | snippet ist 50 | ${1} : in std_logic; 51 | # std_logic_vector in 52 | snippet isv 53 | ${1} : in std_logic_vector (${2} downto 0); 54 | # std_logic out 55 | snippet ost 56 | ${1} : out std_logic; 57 | # std_logic_vector out 58 | snippet osv 59 | ${1} : out std_logic_vector (${2} downto 0); 60 | # unsigned 61 | snippet un 62 | signal ${1} : unsigned (${2} downto 0); 63 | ## Process Statements 64 | # process 65 | snippet pr 66 | process (${1}) 67 | begin 68 | ${2} 69 | end process; 70 | # process with clock 71 | snippet prc 72 | process (${1:clk}) 73 | begin 74 | if rising_edge ($1) then 75 | ${2} 76 | end if; 77 | end process; 78 | # process with clock and reset 79 | snippet prcr 80 | process (${1:clk}, ${2:nrst}) 81 | begin 82 | if ($2 = '${3:0}') then 83 | ${4} 84 | elsif rising_edge($1) then 85 | ${5} 86 | end if; 87 | end process; 88 | # process all 89 | snippet pra 90 | process (${1:all}) 91 | begin 92 | ${2} 93 | end process; 94 | ## Control Statements 95 | # if 96 | snippet if 97 | if ${1} then 98 | ${2} 99 | end if; 100 | # if 101 | snippet ife 102 | if ${1} then 103 | ${2} 104 | else 105 | ${3} 106 | end if; 107 | # else 108 | snippet el 109 | else 110 | ${1} 111 | # if 112 | snippet eif 113 | elsif ${1} then 114 | ${2} 115 | # case 116 | snippet ca 117 | case ${1} is 118 | ${2} 119 | end case; 120 | # when 121 | snippet wh 122 | when ${1} => 123 | ${2} 124 | # for 125 | snippet for 126 | for ${1:i} in ${2} ${3:to} ${4} loop 127 | ${5} 128 | end loop; 129 | # while 130 | snippet wh 131 | while ${1} loop 132 | ${2} 133 | end loop; 134 | ## Misc 135 | # others 136 | snippet oth 137 | (others => '${1:0}'); 138 | -------------------------------------------------------------------------------- /snippets/vim.snippets: -------------------------------------------------------------------------------- 1 | snippet header standard Vim script file header 2 | " File: ${1:`expand('%:t')`} 3 | " Author: ${2:`g:snips_author`} 4 | " Description: ${3} 5 | ${0:" Last Modified: `strftime("%B %d, %Y")`} 6 | snippet guard script reload guard 7 | if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} 8 | finish 9 | endif 10 | let $1 = 1${0} 11 | snippet f function 12 | fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) 13 | ${0} 14 | endf 15 | snippet t try ... catch statement 16 | try 17 | ${1:${VISUAL}} 18 | catch ${2} 19 | ${0} 20 | endtry 21 | snippet for for ... in loop 22 | for ${1} in ${2} 23 | ${0:${VISUAL}} 24 | endfor 25 | snippet forkv for [key, value] in loop 26 | for [${1},${2}] in items(${3}) 27 | ${0} 28 | unlet $1 $2 29 | endfor 30 | snippet wh while loop 31 | while ${1} 32 | ${0:${VISUAL}} 33 | endw 34 | snippet if if statement 35 | if ${1} 36 | ${0:${VISUAL}} 37 | endif 38 | snippet ife if ... else statement 39 | if ${1} 40 | ${2:${VISUAL}} 41 | else 42 | ${0} 43 | endif 44 | snippet au augroup ... autocmd block 45 | augroup ${1:AU_NAME} 46 | autocmd! 47 | autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} 48 | augroup END 49 | snippet auv augroupvisual ... autocmd block with visual placeholder 50 | augroup ${1:AU_NAME} 51 | autocmd! 52 | ${0:${VISUAL}} 53 | augroup END 54 | snippet bun Vundle.vim Plugin definition 55 | Plugin '${0}' 56 | snippet plug vim-plug Plugin definition 57 | Plug '${0}' 58 | snippet plugdo vim-plug Plugin definition with { 'do': '' } 59 | Plug '${1}', { 'do': '${0}' } 60 | snippet plugon vim-plug Plugin definition with { 'on': '' } 61 | Plug '${1}', { 'on': '${0}' } 62 | snippet plugfor vim-plug Plugin definition with { 'for': '' } 63 | Plug '${1}', { 'for': '${0}' } 64 | snippet plugbr vim-plug Plugin definition with { 'branch': '' } 65 | Plug '${1}', { 'branch': '${0}' } 66 | snippet plugtag vim-plug Plugin definition with { 'tag': '' } 67 | Plug '${1}', { 'tag': '${0}' } 68 | snippet let 69 | let ${1:variable} = ${0: value} 70 | snippet se 71 | set ${1:setting}; 72 | snippet set 73 | set ${1:setting} = ${0:value} 74 | snippet nn 75 | nnoremap ${1} ${2} 76 | snippet no 77 | noremap ${1} ${2} 78 | snippet vm 79 | vmap ${1} ${2} 80 | snippet im 81 | imap ${1} ${2} 82 | snippet exe 83 | execute ${1} 84 | snippet filename 85 | `Filename()` 86 | -------------------------------------------------------------------------------- /snippets/xml.snippets: -------------------------------------------------------------------------------- 1 | # xml declaration 2 | snippet xml 3 | 4 | # tag 5 | snippet t 6 | <${1:}> 7 | ${2} 8 | 9 | # inline tag 10 | snippet ti 11 | <${1:}>${2} 12 | 13 | -------------------------------------------------------------------------------- /snippets/xslt.snippets: -------------------------------------------------------------------------------- 1 | snippet apply-templates with-param 2 | 3 | ${3}${4} 4 | 5 | 6 | snippet apply-templates sort-by 7 | 8 | ${5} 9 | 10 | 11 | snippet apply-templates plain 12 | 13 | 14 | snippet attribute blank 15 | ${2} 16 | 17 | snippet attribute value-of 18 | 19 | 20 | 21 | 22 | snippet call-template 23 | 24 | 25 | snippet call-template with-param 26 | 27 | ${3}${4} 28 | 29 | 30 | snippet choose 31 | 32 | 33 | ${2} 34 | 35 | 36 | 37 | snippet copy-of 38 | 39 | 40 | snippet for-each 41 | ${2} 42 | 43 | 44 | snippet if 45 | ${2} 46 | 47 | 48 | snippet import 49 | 50 | 51 | snippet include 52 | 53 | 54 | snippet otherwise 55 | ${0} 56 | 57 | 58 | snippet param 59 | ${2} 60 | 61 | 62 | snippet stylesheet 63 | ${0} 65 | 66 | 67 | snippet template 68 | ${0} 69 | 70 | 71 | snippet template named 72 | ${0} 73 | 74 | 75 | snippet text 76 | ${0} 77 | 78 | snippet value-of 79 | 80 | 81 | snippet variable blank 82 | ${0} 83 | 84 | 85 | snippet variable select 86 | 87 | 88 | snippet when 89 | ${0} 90 | 91 | 92 | snippet with-param 93 | ${0} 94 | 95 | snippet with-param select 96 | 97 | 98 | -------------------------------------------------------------------------------- /snippets/zsh.snippets: -------------------------------------------------------------------------------- 1 | # #!/bin/zsh 2 | extends bash 3 | 4 | snippet #! 5 | #!/usr/bin/env zsh 6 | 7 | snippet if 8 | if $1; then 9 | ${0:${VISUAL}} 10 | fi 11 | snippet ife 12 | if $1; then 13 | ${2:${VISUAL}} 14 | else 15 | ${0:# statements} 16 | fi 17 | snippet eif 18 | elif $1; then 19 | ${0:${VISUAL}} 20 | snippet for 21 | for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do 22 | ${0:${VISUAL}} 23 | done 24 | snippet fori 25 | for ${1:needle} in ${2:haystack}; do 26 | ${0:${VISUAL}} 27 | done 28 | snippet fore 29 | for ${1:item} in ${2:list}; do 30 | ${0:${VISUAL}} 31 | done 32 | snippet wh 33 | while $1; do 34 | ${0:${VISUAL}} 35 | done 36 | snippet until 37 | until $1; do 38 | ${0:${VISUAL}} 39 | done 40 | snippet repeat 41 | repeat ${1:integer}; do 42 | ${0:${VISUAL}} 43 | done 44 | snippet case 45 | case ${1:word} in 46 | ${2:pattern}) 47 | ${0};; 48 | esac 49 | snippet select 50 | select ${1:answer} in ${2:choices}; do 51 | ${0:${VISUAL}} 52 | done 53 | snippet ( 54 | ( ${0:#statements} ) 55 | snippet { 56 | { ${0:#statements} } 57 | snippet [ 58 | [[ ${0:test} ]] 59 | snippet always 60 | { ${1:try} } always { ${0:always} } 61 | snippet fun 62 | ${1:function_name}() { 63 | ${0:# function_body} 64 | } 65 | snippet ffun 66 | function ${1:function_name}() { 67 | ${0:# function_body} 68 | } 69 | -------------------------------------------------------------------------------- /tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | check=0 4 | 5 | function test_space_indented { 6 | local spaced 7 | spaced=$(grep -REn '^ ' --include '*.snippets' snippets) 8 | 9 | if [[ $? -ne 1 ]]; then 10 | echo "These snippet lines are indented with spaces:" 11 | echo "$spaced" 12 | echo 13 | (( check++ )) 14 | fi 15 | } 16 | 17 | function test_snipmate_format { 18 | local ultisnips_in_snipmate 19 | ultisnips_in_snipmate=$(grep -REn 'endsnippet' --include '*.snippets' snippets) 20 | if [[ $? -ne 1 ]]; then 21 | echo "These snippet definitions are probably in UltiSnips format but stored in the snipmate directory" 22 | echo "$ultisnips_in_snipmate" 23 | echo 24 | (( check++ )) 25 | fi 26 | } 27 | 28 | test_space_indented 29 | test_snipmate_format 30 | 31 | if [ $check -eq 0 ]; then 32 | echo "Tests passed!" 33 | exit 0 34 | else 35 | echo "$check test(s) failed out of 2!" 36 | exit 1 37 | fi 38 | --------------------------------------------------------------------------------