Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
7e084b9c02
21
README.md
21
README.md
@ -86,19 +86,23 @@ add snippets/ruby-1.9.snippets (1.9 only)
|
|||||||
|
|
||||||
then configure github.com/garbas/vim-snipmate this way:
|
then configure github.com/garbas/vim-snipmate this way:
|
||||||
|
|
||||||
let g:snipMate = {}
|
|
||||||
let g:snipMate.scope_aliases = {}
|
```vim
|
||||||
let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'
|
let g:snipMate = {}
|
||||||
|
let g:snipMate.scope_aliases = {}
|
||||||
|
let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'
|
||||||
|
```
|
||||||
|
|
||||||
or github.com/MarcWeber/UltiSnips this way:
|
or github.com/MarcWeber/UltiSnips this way:
|
||||||
|
|
||||||
|
|
||||||
let g:UltiSnips = {}
|
```vim
|
||||||
|
let g:UltiSnips = {}
|
||||||
let g:UltiSnips.snipmate_ft_filter = {
|
|
||||||
\ 'default' : {'filetypes': ["FILETYPE"] },
|
|
||||||
\ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] },
|
|
||||||
|
|
||||||
|
let g:UltiSnips.snipmate_ft_filter = {
|
||||||
|
\ 'default' : {'filetypes': ["FILETYPE"] },
|
||||||
|
\ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] },
|
||||||
|
```
|
||||||
|
|
||||||
If it happens that you work on a project requiring ruby-1.8 snippets instead,
|
If it happens that you work on a project requiring ruby-1.8 snippets instead,
|
||||||
consider using vim-addon-local-vimrc and override the filetypes.
|
consider using vim-addon-local-vimrc and override the filetypes.
|
||||||
@ -129,6 +133,7 @@ vim-snippets is not like the "linux kernel".
|
|||||||
* Ruby - [taq](http://github.com/taq)
|
* Ruby - [taq](http://github.com/taq)
|
||||||
* PHP - [chrisyue](http://github.com/chrisyue)
|
* PHP - [chrisyue](http://github.com/chrisyue)
|
||||||
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
|
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
|
||||||
|
* Falcon - [steveno](https://github.com/steveno)
|
||||||
|
|
||||||
Contributing notes
|
Contributing notes
|
||||||
------------------
|
------------------
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
# From the TextMate bundle
|
# From the TextMate bundle
|
||||||
|
# with some modification
|
||||||
|
|
||||||
snippet fun "Function" b
|
snippet fun "Function" b
|
||||||
${1:name} = (${2:args}) ->
|
${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`->
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet bfun "Function (bound)" b
|
snippet bfun "Function (bound)" i
|
||||||
${1:(${2:args}) }=>
|
`!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}
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "If" b
|
snippet if "If"
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ife "If .. Else" b
|
snippet ife "If .. Else"
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${2:# body...}
|
${2:# body...}
|
||||||
else
|
else
|
||||||
@ -27,49 +27,57 @@ else if ${1:condition}
|
|||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifte "Ternary if" b
|
snippet ifte "Ternary if"
|
||||||
if ${1:condition} then ${2:value} else ${3:other}
|
if ${1:condition} then ${2:value} else ${3:other}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet unl "Unless" b
|
snippet unl "Unless"
|
||||||
${1:action} unless ${2:condition}
|
${1:action} unless ${2:condition}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fora "Array Comprehension" b
|
snippet fora "Array Comprehension"
|
||||||
for ${1:name} in ${2:array}
|
for ${1:name} in ${2:array}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet foro "Object Comprehension" b
|
snippet foro "Object Comprehension"
|
||||||
for ${1:key}, ${2:value} of ${3:Object}
|
for ${1:key}, ${2:value} of ${3:Object}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forr "Range Comprehension (inclusive)" b
|
snippet forr "Range Comprehension (inclusive)"
|
||||||
for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}}
|
for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forrex "Range Comprehension (exclusive)" b
|
snippet forrex "Range Comprehension (exclusive)"
|
||||||
for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}}
|
for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet swi "Switch" b
|
snippet swi "Switch"
|
||||||
switch ${1:object}
|
switch ${1:object}
|
||||||
when ${2:value}
|
when ${2:value}
|
||||||
${0:# body...}
|
${3:# body...}
|
||||||
|
else
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet swit "Switch when .. then"
|
||||||
|
switch ${1:object}
|
||||||
|
when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value}
|
||||||
|
else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cla "Class" b
|
snippet cla "Class" b
|
||||||
class ${1:ClassName}${2: extends ${3:Ancestor}}
|
class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor}
|
||||||
|
|
||||||
${4:constructor: (${5:args}) ->
|
${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` ->
|
||||||
${6:# body...}}
|
${5:# body...}}
|
||||||
$7
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet try "Try .. Catch" b
|
snippet try "Try .. Catch"
|
||||||
try
|
try
|
||||||
$1
|
$1
|
||||||
catch ${2:error}
|
catch ${2:error}
|
||||||
@ -80,7 +88,7 @@ snippet req "Require" b
|
|||||||
${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'})
|
${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet # "Interpolated Code"
|
snippet # "Interpolated Code" i
|
||||||
#{$1}$0
|
#{$1}$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
31
UltiSnips/html_minimal.snippets
Normal file
31
UltiSnips/html_minimal.snippets
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# more can be found in snippets/html_minimal.snippets
|
||||||
|
# these UltiSnips override snippets because nested placeholders are being used
|
||||||
|
|
||||||
|
snippet id
|
||||||
|
id="${1}"${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet idn
|
||||||
|
id="${1}" name="${2:$1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet label_and_input
|
||||||
|
<label for="${2:$1}">${1}</label>
|
||||||
|
<input type="${3:text}" name="${4:$2}"${5: id="${6:$2}"} value="${7}" />${8}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet input
|
||||||
|
<input type="${1:text}" value="${2}" name="${3}"${4: id="${5:$3}}/>${7}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet submit
|
||||||
|
<input type="submit" value="${2}" ${3}/>${7}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet textarea
|
||||||
|
<textarea name="$2"${3: id="$4"}>$5</textarea>
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet img
|
||||||
|
<img src="$1"${2: alt="$3"}/>
|
||||||
|
endsnippet
|
118
snippets/elixir.snippets
Normal file
118
snippets/elixir.snippets
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
snippet if if .. do .. end
|
||||||
|
if ${1} do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet if if .. do: ..
|
||||||
|
if ${1:condition}, do: ${2}
|
||||||
|
|
||||||
|
snippet ife if .. do .. else .. end
|
||||||
|
if ${1:condition} do
|
||||||
|
${2}
|
||||||
|
else
|
||||||
|
${3}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet ife if .. do: .. else:
|
||||||
|
if ${1:condition}, do: ${2}, else: ${3}
|
||||||
|
|
||||||
|
snippet unless unless .. do .. end
|
||||||
|
unless ${1} do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet unless unless .. do: ..
|
||||||
|
unless ${1:condition}, do: ${2}
|
||||||
|
|
||||||
|
snippet unlesse unless .. do .. else .. end
|
||||||
|
unless ${1:condition} do
|
||||||
|
${2}
|
||||||
|
else
|
||||||
|
${3}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet unlesse unless .. do: .. else:
|
||||||
|
unless ${1:condition}, do: ${2}, else: ${3}
|
||||||
|
|
||||||
|
snippet cond
|
||||||
|
cond do
|
||||||
|
${1} ->
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet case
|
||||||
|
case ${1} do
|
||||||
|
${2} ->
|
||||||
|
${3}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet def
|
||||||
|
def ${1:name} do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet defim
|
||||||
|
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||||
|
${3}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet defma
|
||||||
|
defmacro ${1:name} do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet defmo
|
||||||
|
defmodule ${1:module_name} do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet defp
|
||||||
|
defp ${1:name} do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet defpr
|
||||||
|
defprotocol ${1:name}, [${2:function}]
|
||||||
|
|
||||||
|
snippet defr
|
||||||
|
defrecord ${1:record_name}, ${2:fields}
|
||||||
|
|
||||||
|
snippet doc
|
||||||
|
@doc """
|
||||||
|
${1}
|
||||||
|
"""
|
||||||
|
|
||||||
|
snippet fn
|
||||||
|
fn(${1:args}) -> ${2} end
|
||||||
|
|
||||||
|
snippet mdoc
|
||||||
|
@moduledoc """
|
||||||
|
${1}
|
||||||
|
"""
|
||||||
|
|
||||||
|
snippet rec
|
||||||
|
receive do
|
||||||
|
${1} ->
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet req
|
||||||
|
require ${1:module_name}
|
||||||
|
|
||||||
|
snippet imp
|
||||||
|
import ${1:module_name}
|
||||||
|
|
||||||
|
snippet ali
|
||||||
|
alias ${1:module_name}
|
||||||
|
|
||||||
|
snippet test
|
||||||
|
test "${1:test_name}" do
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet try try .. rescue .. end
|
||||||
|
try do
|
||||||
|
${1}
|
||||||
|
rescue
|
||||||
|
${2} -> ${3}
|
||||||
|
end
|
@ -111,3 +111,13 @@ snippet slt
|
|||||||
<%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %>
|
<%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %>
|
||||||
snippet sslt
|
snippet sslt
|
||||||
<%= stylesheet_link_tag "${1}" %>
|
<%= stylesheet_link_tag "${1}" %>
|
||||||
|
snippet if
|
||||||
|
<% if ${1} %>
|
||||||
|
${2}
|
||||||
|
<% end %>
|
||||||
|
snippet ife
|
||||||
|
<% if ${1} %>
|
||||||
|
${2}
|
||||||
|
<% else %>
|
||||||
|
${3}
|
||||||
|
<% end %>
|
||||||
|
@ -11,10 +11,12 @@ snippet ul
|
|||||||
%li
|
%li
|
||||||
${1:item}
|
${1:item}
|
||||||
%li
|
%li
|
||||||
snippet =rp
|
snippet rp
|
||||||
= render :partial => '${1:partial}'
|
= render :partial => "${1:item}"
|
||||||
snippet =rpl
|
snippet rpc
|
||||||
= render :partial => '${1:partial}', :locals => {}
|
= render :partial => "${1:item}", :collection => ${2:@$1s}
|
||||||
snippet =rpc
|
snippet rpl
|
||||||
= render :partial => '${1:partial}', :collection => @$1
|
= render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}
|
||||||
|
snippet rpo
|
||||||
|
= render :partial => "${1:item}", :object => ${2:@$1}
|
||||||
|
|
||||||
|
@ -730,6 +730,10 @@ snippet source
|
|||||||
<source src="${1}" type="${2}" media="${3}" />
|
<source src="${1}" type="${2}" media="${3}" />
|
||||||
snippet span
|
snippet span
|
||||||
<span>${1}</span>
|
<span>${1}</span>
|
||||||
|
snippet span#
|
||||||
|
<span id="${1}">${2}</span>
|
||||||
|
snippet span.
|
||||||
|
<span class="${1}">${2}</span>
|
||||||
snippet strong
|
snippet strong
|
||||||
<strong>${1}</strong>
|
<strong>${1}</strong>
|
||||||
snippet style
|
snippet style
|
||||||
|
74
snippets/html_minimal.snippets
Normal file
74
snippets/html_minimal.snippets
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# file containing most useful mappings only
|
||||||
|
# when editing this file please be aware that there is ZenCoding and sparkup
|
||||||
|
|
||||||
|
# html 5 is recommended from now on
|
||||||
|
snippet html5
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>$2</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
$3
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
$4
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
# ==== TAGS
|
||||||
|
# you always need these:
|
||||||
|
snippet .
|
||||||
|
class="${1}"${2}
|
||||||
|
snippet n
|
||||||
|
name="${1}"${2}
|
||||||
|
snippet r
|
||||||
|
rel="${1}"${2}
|
||||||
|
snippet t
|
||||||
|
title="${1}"${2}
|
||||||
|
|
||||||
|
# not using # because id is faster to type
|
||||||
|
snippet id
|
||||||
|
id="${1}"${2}
|
||||||
|
snippet idn
|
||||||
|
id="${1}" name="${2:$1}"
|
||||||
|
|
||||||
|
snippet label_and_input
|
||||||
|
<label for="${2:$1}">${1}</label>
|
||||||
|
<input type="${3:text}" name="${4:$2}" id="${5:$2}" value="${6}" />${7}
|
||||||
|
|
||||||
|
|
||||||
|
# FORMS
|
||||||
|
# use idn . or n to add id
|
||||||
|
snippet input
|
||||||
|
<input type="${1:text}" value="${2}" ${3}/>${7}
|
||||||
|
snippet submit
|
||||||
|
<input type="submit" value="${2}" ${3}/>${7}
|
||||||
|
snippet textarea
|
||||||
|
<textarea $1>$2</textarea>
|
||||||
|
|
||||||
|
# if you need id or class use snippets above
|
||||||
|
snippet form
|
||||||
|
<form method="${1:post/get}" action="$2">
|
||||||
|
$3
|
||||||
|
</form>
|
||||||
|
|
||||||
|
# other tags
|
||||||
|
snippet br
|
||||||
|
<br/>
|
||||||
|
snippet a
|
||||||
|
<a href="#" $2>$3</a>
|
||||||
|
snippet img
|
||||||
|
<img src="$1" alt="$2"/>
|
||||||
|
# JS/CSS
|
||||||
|
snippet css_file
|
||||||
|
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />${3}
|
||||||
|
snippet css_block
|
||||||
|
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
|
||||||
|
</link>
|
||||||
|
|
||||||
|
snippet script_block
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
</script>
|
||||||
|
snippet script_file
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
</script>
|
@ -847,26 +847,26 @@ snippet tcts
|
|||||||
snippet tctss
|
snippet tctss
|
||||||
t.timestamps
|
t.timestamps
|
||||||
${1}
|
${1}
|
||||||
snippet va
|
snippet va validates_associated
|
||||||
validates_associated :${1:attribute}
|
validates_associated :${1:attribute}
|
||||||
snippet vao
|
snippet va validates .., :acceptance => true
|
||||||
validates_acceptance_of :${1:terms}
|
validates :${1:terms}, :acceptance => true
|
||||||
snippet vc
|
snippet vc
|
||||||
validates_confirmation_of :${1:attribute}
|
validates :${1:attribute}, :confirmation => true
|
||||||
snippet ve
|
snippet ve
|
||||||
validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}
|
validates :${1:attribute}, :exclusion => { :in => ${2:%w( mov avi )} }
|
||||||
snippet vf
|
snippet vf
|
||||||
validates_format_of :${1:attribute}, :with => /${2:regex}/
|
validates :${1:attribute}, :format => { :with => /${2:regex}/ }
|
||||||
snippet vi
|
snippet vi
|
||||||
validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })
|
validates :${1:attribute}, :inclusion => { :in => %w(${2: mov avi }) }
|
||||||
snippet vl
|
snippet vl
|
||||||
validates_length_of :${1:attribute}, :within => ${2:3}..${3:20}
|
validates :${1:attribute}, :length => { :in => ${2:3}..${3:20} }
|
||||||
snippet vn
|
snippet vn
|
||||||
validates_numericality_of :${1:attribute}
|
validates :${1:attribute}, :numericality => true
|
||||||
snippet vpo
|
snippet vp
|
||||||
validates_presence_of :${1:attribute}
|
validates :${1:attribute}, :presence => true
|
||||||
snippet vu
|
snippet vu
|
||||||
validates_uniqueness_of :${1:attribute}
|
validates :${1:attribute}, :uniqueness => true
|
||||||
snippet wants
|
snippet wants
|
||||||
wants.${1:js|xml|html} { ${2} }
|
wants.${1:js|xml|html} { ${2} }
|
||||||
snippet wc
|
snippet wc
|
||||||
|
Loading…
Reference in New Issue
Block a user