merge
This commit is contained in:
commit
083fd3ea8f
@ -205,7 +205,6 @@ to maintain snippets for a language, please get in touch.
|
|||||||
Notes: People are interested in snippets - and their interest may wane again.
|
Notes: People are interested in snippets - and their interest may wane again.
|
||||||
This list is kept up-to-date on a best effort basis.
|
This list is kept up-to-date on a best effort basis.
|
||||||
|
|
||||||
* Clojure - [lpil](https://github.com/lpil)
|
|
||||||
* Elixir - [iurifq](https://github.com/iurifq)
|
* Elixir - [iurifq](https://github.com/iurifq)
|
||||||
* Falcon - [steveno](https://github.com/steveno)
|
* Falcon - [steveno](https://github.com/steveno)
|
||||||
* HTML Django - [honza](http://github.com/honza)
|
* HTML Django - [honza](http://github.com/honza)
|
||||||
|
@ -11,10 +11,6 @@ def ada_case(word):
|
|||||||
out = out + word[i]
|
out = out + word[i]
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def get_year():
|
|
||||||
import time
|
|
||||||
return time.strftime("%Y")
|
|
||||||
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet wi "with"
|
snippet wi "with"
|
||||||
@ -281,44 +277,4 @@ snippet newline "Ada.Text_IO.New_Line"
|
|||||||
Ada.Text_IO.New_Line(${1:1});$0
|
Ada.Text_IO.New_Line(${1:1});$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet gpl "GPL license header"
|
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
|
||||||
-- it under the terms of the GNU ${1}General Public License as published by
|
|
||||||
-- the Free Software Foundation; either version ${2:3} of the License, or
|
|
||||||
-- (at your option) any later version.
|
|
||||||
--
|
|
||||||
-- This program is distributed in the hope that it will be useful,
|
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
-- GNU $1General Public License for more details.
|
|
||||||
--
|
|
||||||
-- You should have received a copy of the GNU $1General Public License
|
|
||||||
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
--
|
|
||||||
-- Copyright (C) ${3:Author}, ${4:`!p snip.rv = get_year()`}
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gplf "GPL file license header"
|
|
||||||
-- This file is part of ${1:Program-Name}.
|
|
||||||
--
|
|
||||||
-- $1 is free software: you can redistribute it and/or modify
|
|
||||||
-- it under the terms of the GNU ${2}General Public License as published by
|
|
||||||
-- the Free Software Foundation, either version ${3:3} of the License, or
|
|
||||||
-- (at your option) any later version.
|
|
||||||
--
|
|
||||||
-- $1 is distributed in the hope that it will be useful,
|
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
-- GNU $2General Public License for more details.
|
|
||||||
--
|
|
||||||
-- You should have received a copy of the GNU $2General Public License
|
|
||||||
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
--
|
|
||||||
-- Copyright (C) ${4:Author}, ${5:`!p snip.rv = get_year()`}
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
@ -29,7 +29,7 @@ def _parse_comments(s):
|
|||||||
if len(flags) == 0:
|
if len(flags) == 0:
|
||||||
rv.append((text, text, text, ""))
|
rv.append((text, text, text, ""))
|
||||||
# parse 3-part comment, but ignore those with O flag
|
# parse 3-part comment, but ignore those with O flag
|
||||||
elif flags[0] == 's' and 'O' not in flags:
|
elif 's' in flags and 'O' not in flags:
|
||||||
ctriple = []
|
ctriple = []
|
||||||
indent = ""
|
indent = ""
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def _parse_comments(s):
|
|||||||
ctriple.append(indent)
|
ctriple.append(indent)
|
||||||
|
|
||||||
rv.append(ctriple)
|
rv.append(ctriple)
|
||||||
elif flags[0] == 'b':
|
elif 'b' in flags:
|
||||||
if len(text) == 1:
|
if len(text) == 1:
|
||||||
rv.insert(0, (text,text,text, ""))
|
rv.insert(0, (text,text,text, ""))
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
@ -78,10 +78,12 @@ endglobal
|
|||||||
snippet box "A nice box with the current comment symbol" b
|
snippet box "A nice box with the current comment symbol" b
|
||||||
`!p
|
`!p
|
||||||
box = make_box(len(t[1]))
|
box = make_box(len(t[1]))
|
||||||
snip.rv = box[0] + '\n' + box[1]
|
snip.rv = box[0]
|
||||||
|
snip += box[1]
|
||||||
`${1:content}`!p
|
`${1:content}`!p
|
||||||
box = make_box(len(t[1]))
|
box = make_box(len(t[1]))
|
||||||
snip.rv = box[2] + '\n' + box[3]`
|
snip.rv = box[2]
|
||||||
|
snip += box[3]`
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -89,10 +91,12 @@ snippet bbox "A nice box over the full width" b
|
|||||||
`!p
|
`!p
|
||||||
width = int(vim.eval("&textwidth")) or 71
|
width = int(vim.eval("&textwidth")) or 71
|
||||||
box = make_box(len(t[1]), width)
|
box = make_box(len(t[1]), width)
|
||||||
snip.rv = box[0] + '\n' + box[1]
|
snip.rv = box[0]
|
||||||
|
snip += box[1]
|
||||||
`${1:content}`!p
|
`${1:content}`!p
|
||||||
box = make_box(len(t[1]), width)
|
box = make_box(len(t[1]), width)
|
||||||
snip.rv = box[2] + '\n' + box[3]`
|
snip.rv = box[2]
|
||||||
|
snip += box[3]`
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -1,168 +0,0 @@
|
|||||||
priority -50
|
|
||||||
|
|
||||||
snippet do
|
|
||||||
do
|
|
||||||
${1}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if .. do .. end"
|
|
||||||
if ${1:condition} do
|
|
||||||
${2:expression}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if .. do: .."
|
|
||||||
if ${1:condition}, do: ${2:expression}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if .. do .. else .. end"
|
|
||||||
if ${1:condition} do
|
|
||||||
${2:expression}
|
|
||||||
else
|
|
||||||
${3:expression}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if .. do: .. else:"
|
|
||||||
if ${1:condition}, do: ${2}, else: ${3}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unless "unless .. do .. end"
|
|
||||||
unless ${1} do
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unless "unless .. do: .."
|
|
||||||
unless ${1:condition}, do: ${2}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unlesse "unless .. do .. else .. end"
|
|
||||||
unless ${1:condition} do
|
|
||||||
${2}
|
|
||||||
else
|
|
||||||
${3}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unlesse "unless .. do: .. else:"
|
|
||||||
unless ${1:condition}, do: ${2}, else: ${3}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cond
|
|
||||||
"cond do"
|
|
||||||
${1} ->
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case
|
|
||||||
case ${1} do
|
|
||||||
${2} ->
|
|
||||||
${3}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet def
|
|
||||||
def ${1:name} do
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defin "def function(n), do: n"
|
|
||||||
def ${1:name}, do: ${2}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defg
|
|
||||||
def ${1:name} when ${2:guard-condition} do
|
|
||||||
${3}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defim
|
|
||||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
|
||||||
${3}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defma
|
|
||||||
defmacro ${1:name} do
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defmo
|
|
||||||
defmodule ${1:module_name} do
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defp
|
|
||||||
defp ${1:name} do
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defpr
|
|
||||||
defprotocol ${1:name}, [${2:function}]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defr
|
|
||||||
defrecord ${1:record_name}, ${2:fields}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet doc
|
|
||||||
@doc """
|
|
||||||
${1}
|
|
||||||
"""
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fn
|
|
||||||
fn(${1:args}) -> ${2} end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fun
|
|
||||||
function do
|
|
||||||
${1}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mdoc
|
|
||||||
@moduledoc """
|
|
||||||
${1}
|
|
||||||
"""
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rec
|
|
||||||
receive do
|
|
||||||
${1} ->
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet req
|
|
||||||
require ${1:module_name}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet imp
|
|
||||||
import ${1:module_name}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ali "alias old-module to shorthand"
|
|
||||||
alias ${1:module_name}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet test
|
|
||||||
test "${1:test_name}" do
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet try "try .. rescue .. end"
|
|
||||||
try do
|
|
||||||
${1}
|
|
||||||
rescue
|
|
||||||
${2} -> ${3}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
@ -5,12 +5,12 @@
|
|||||||
priority -50
|
priority -50
|
||||||
|
|
||||||
snippet pat "Case:Receive:Try Clause"
|
snippet pat "Case:Receive:Try Clause"
|
||||||
${1:pattern}${2: when ${3:guard}} ->;
|
${1:pattern}${2: when ${3:guard}} ->
|
||||||
${4:body}
|
${4:body}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet beh "Behaviour Directive"
|
snippet beh "Behaviour Directive" b
|
||||||
-behaviour (${1:behaviour}).
|
-behaviour(${1:behaviour}).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet case "Case Expression"
|
snippet case "Case Expression"
|
||||||
@ -20,12 +20,12 @@ case ${1:expression} of
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet def "Define Directive"
|
snippet def "Define Directive" b
|
||||||
-define (${1:macro}${2: (${3:param})}, ${4:body}).
|
-define(${1:macro}${2: (${3:param})}, ${4:body}).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet exp "Export Directive"
|
snippet exp "Export Directive" b
|
||||||
-export ([${1:function}/${2:arity}]).
|
-export([${1:function}/${2:arity}]).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fun "Fun Expression"
|
snippet fun "Fun Expression"
|
||||||
@ -36,7 +36,7 @@ end
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fu "Function"
|
snippet fu "Function"
|
||||||
${1:function} (${2:param})${3: when ${4:guard}} ->
|
${1:function}(${2:param})${3: when ${4:guard}} ->
|
||||||
${5:body}
|
${5:body}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -47,24 +47,24 @@ if
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifdef "Ifdef Directive"
|
snippet ifdef "Ifdef Directive" b
|
||||||
-ifdef (${1:macro}).
|
-ifdef(${1:macro}).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifndef "Ifndef Directive"
|
snippet ifndef "Ifndef Directive" b
|
||||||
-ifndef (${1:macro}).
|
-ifndef(${1:macro}).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet imp "Import Directive"
|
snippet imp "Import Directive" b
|
||||||
-import (${1:module}, [${2:function}/${3:arity}]).
|
-import(${1:module}, [${2:function}/${3:arity}]).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet inc "Include Directive"
|
snippet inc "Include Directive" b
|
||||||
-include ("${1:file}").
|
-include("${1:file}").
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet mod "Module Directive"
|
snippet mod "Module Directive" b
|
||||||
-module (${1:`!p snip.rv = snip.basename or "module"`}).
|
-module(${1:`!p snip.rv = snip.basename or "module"`}).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet rcv "Receive Expression"
|
snippet rcv "Receive Expression"
|
||||||
@ -77,8 +77,8 @@ ${6:after
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet rec "Record Directive"
|
snippet rec "Record Directive" b
|
||||||
-record (${1:record}, {${2:field}${3: = ${4:value}}}).
|
-record(${1:record}, {${2:field}${3: = ${4:value}}}).
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet try "Try Expression"
|
snippet try "Try Expression"
|
||||||
@ -93,8 +93,16 @@ ${13:after
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet undef "Undef Directive"
|
snippet undef "Undef Directive" b
|
||||||
-undef (${1:macro}).
|
-undef(${1:macro}).
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet || "List Comprehension"
|
||||||
|
[${1:X} || ${2:X} <- ${3:List}${4:, gen}]
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet gen "Generator Expression"
|
||||||
|
${1:X} <- ${2:List}${3:, gen}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
@ -44,66 +44,13 @@ snippet fi "<%= Fixtures.identify(:symbol) %>"
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ft "form_tag"
|
snippet ft "form_tag"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => '${5:update}'}${6:, {:${8:class} => '${9:form}'\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
$0
|
$0
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet end "end (ERB)"
|
|
||||||
<% end -%>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for loop (ERB)"
|
|
||||||
<% if !${1:list}.blank? %>
|
|
||||||
<% for ${2:item} in ${1} %>
|
|
||||||
$3
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
$4
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffcb "form_for check_box"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffff "form_for file_field 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffhf "form_for hidden_field 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffl "form_for label 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffpf "form_for password_field 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffrb "form_for radio_box 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffs "form_for submit 2"
|
snippet ffs "form_for submit 2"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, :disable_with => '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffta "form_for text_area 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fftf "form_for text_field 2"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fields "fields_for"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
|
||||||
$0
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f. "f_fields_for (nff)"
|
snippet f. "f_fields_for (nff)"
|
||||||
@ -132,8 +79,8 @@ snippet f. "f.password_field"
|
|||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f. "f.radio_box"
|
snippet f. "f.radio_button"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_button :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f. "f.submit"
|
snippet f. "f.submit"
|
||||||
@ -279,10 +226,6 @@ snippet else "else (ERB)"
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "if (ERB)"
|
|
||||||
<% if ${1:condition} %>$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lf "link_to_function"
|
snippet lf "link_to_function"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -17,7 +17,7 @@ snippet label_and_input
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet input
|
snippet input
|
||||||
<input type="${1:text}" value="${2}" name="${3}"${4: id="${5:$3}}/>${7}
|
<input type="${1:text}" value="${2}" name="${3}"${4: id="${5:$3}"}/>${7}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet submit
|
snippet submit
|
||||||
|
@ -19,49 +19,59 @@ config(function($1) {
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet acont "angular controller" i
|
snippet acont "angular controller" i
|
||||||
controller('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
controller('${1:name}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
$0
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet aconts "angular controller with scope" i
|
snippet aconts "angular controller with scope" i
|
||||||
controller('${1:name}', ['$scope', function($scope) {
|
controller('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
$0
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet adir "angular directive" i
|
snippet adir "angular directive" i
|
||||||
directive('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
directive('${1}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
return {
|
||||||
|
restrict: '${3:EA}',
|
||||||
|
link: function(scope, element, attrs) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet adirs "angular directive with scope" i
|
snippet adirs "angular directive with scope" i
|
||||||
directive('${1:name}', ['$scope', function($scope) {
|
directive('${1}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
return {
|
||||||
|
restrict: '${3:EA}',
|
||||||
|
link: function(scope, element, attrs) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet afact "angular factory" i
|
snippet afact "angular factory" i
|
||||||
factory('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
factory('${1:name}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
$0
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet afacts "angular factory with scope" i
|
snippet afacts "angular factory with scope" i
|
||||||
factory('${1:name}', ['$scope', function($scope) {
|
factory('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
$0
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet aserv "angular service" i
|
snippet aserv "angular service" i
|
||||||
service('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
service('${1:name}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
$0
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet aservs "angular service" i
|
snippet aservs "angular service" i
|
||||||
service('${1:name}', ['$scope', function($scope) {
|
service('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||||
$0
|
$0
|
||||||
}]);
|
}]);
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -102,44 +102,53 @@ var_export(${1});${2}
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet getter "PHP Class Getter" b
|
snippet getter "PHP Class Getter" b
|
||||||
/*
|
/**
|
||||||
* Getter for $1
|
* Getter for $1
|
||||||
|
*
|
||||||
|
* ${2:return string}
|
||||||
*/
|
*/
|
||||||
public function get${1/\w+\s*/\u$0/}()
|
public function get${1/\w+\s*/\u$0/}()
|
||||||
{
|
{
|
||||||
return $this->$1;$2
|
return $this->$1;$3
|
||||||
}
|
}
|
||||||
$4
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet setter "PHP Class Setter" b
|
snippet setter "PHP Class Setter" b
|
||||||
/*
|
/**
|
||||||
* Setter for $1
|
* Setter for $1
|
||||||
|
*
|
||||||
|
* @param ${2:string} $$1
|
||||||
|
* @return ${3:`!p snip.rv=snip.basename`}
|
||||||
*/
|
*/
|
||||||
public function set${1/\w+\s*/\u$0/}($$1)
|
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
||||||
{
|
{
|
||||||
$this->$1 = $$1;$3
|
$this->$1 = $$1;$5
|
||||||
${4:return $this;}
|
${6:return $this;}
|
||||||
}
|
}
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet gs "PHP Class Getter Setter" b
|
snippet gs "PHP Class Getter Setter" b
|
||||||
/*
|
/**
|
||||||
* Getter for $1
|
* Getter for $1
|
||||||
|
*
|
||||||
|
* return ${2:string}
|
||||||
*/
|
*/
|
||||||
public function get${1/\w+\s*/\u$0/}()
|
public function get${1/\w+\s*/\u$0/}()
|
||||||
{
|
{
|
||||||
return $this->$1;$2
|
return $this->$1;$3
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Setter for $1
|
* Setter for $1
|
||||||
|
*
|
||||||
|
* @param $2 $$1
|
||||||
|
* @return ${4:`!p snip.rv=snip.basename`}
|
||||||
*/
|
*/
|
||||||
public function set${1/\w+\s*/\u$0/}($$1)
|
public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
||||||
{
|
{
|
||||||
$this->$1 = $$1;$3
|
$this->$1 = $$1;$6
|
||||||
${4:return $this;}
|
${7:return $this;}
|
||||||
}
|
}
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -251,36 +260,55 @@ if (${1:/* condition */}) {
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet class "Class declaration template" b
|
snippet ns "namespace declaration" b
|
||||||
/**
|
namespace ${1:`!p
|
||||||
* Class ${2:`!p snip.rv=snip.fn.split('.')[0]`}
|
abspath = os.path.abspath(path)
|
||||||
* @author ${3:`!v g:snips_author`}
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
*/
|
if m:
|
||||||
$1class $2
|
snip.rv = m.group().replace('/', '\\')
|
||||||
{
|
`};
|
||||||
public function ${4:__construct}(${5:$options})
|
|
||||||
{
|
|
||||||
${6:// code}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet interface "interface declaration template" b
|
snippet class "Class declaration template" b
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ${1:`!p
|
||||||
|
abspath = os.path.abspath(path)
|
||||||
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
|
if m:
|
||||||
|
snip.rv = m.group().replace('/', '\\')
|
||||||
|
`};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface ${1:`!p snip.rv=snip.fn.split('.')[0]`}
|
* Class ${1:`!p snip.rv=snip.basename`}
|
||||||
|
* @author ${2:`!v g:snips_author`}
|
||||||
|
*/
|
||||||
|
class $1
|
||||||
|
{
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet interface "Interface declaration template" b
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ${1:`!p
|
||||||
|
abspath = os.path.abspath(path)
|
||||||
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
|
if m:
|
||||||
|
snip.rv = m.group().replace('/', '\\')
|
||||||
|
`};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface ${1:`!p snip.rv=snip.basename`}
|
||||||
* @author ${2:`!v g:snips_author`}
|
* @author ${2:`!v g:snips_author`}
|
||||||
*/
|
*/
|
||||||
interface $1
|
interface $1
|
||||||
{
|
{
|
||||||
public function ${3:__construct}(${4:$options})
|
public function ${3:someFunction}();$4
|
||||||
{
|
|
||||||
${5:// code}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$0
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet construct "__construct()" b
|
snippet construct "__construct()" b
|
||||||
/**
|
/**
|
||||||
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
||||||
|
257
UltiSnips/php_laravel.snippets
Normal file
257
UltiSnips/php_laravel.snippets
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
#resource controller
|
||||||
|
snippet l_rsc "Laravel resource controller" b
|
||||||
|
/*!
|
||||||
|
* \class ${1:`!v expand('%:t:r')`}
|
||||||
|
*
|
||||||
|
* \author ${2:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
class $1 extends ${3: BaseController} {
|
||||||
|
function __construct() {
|
||||||
|
${4}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store($id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#service service provider
|
||||||
|
snippet l_ssp "Laravel service provider for service" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${1:Services}
|
||||||
|
* \class ${2:`!v expand('%:t:r')`}
|
||||||
|
*
|
||||||
|
* \author ${3:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $1;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class $2 extends ServiceProvider {
|
||||||
|
|
||||||
|
public function register() {
|
||||||
|
$this->app->bind('${4}Service', function ($app) {
|
||||||
|
return new ${5}(
|
||||||
|
$app->make('Repositories\\${6}Interface')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#repository service provider
|
||||||
|
snippet l_rsp "Laravel service provider for repository" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${2:Repositories\\${1:}}
|
||||||
|
* \class ${3:`!v expand('%:t:r')`}
|
||||||
|
*
|
||||||
|
* \author ${4:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $2;
|
||||||
|
|
||||||
|
use Entities\\$1;
|
||||||
|
use $2\\$1Repository;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class $3 extends ServiceProvider {
|
||||||
|
/*!
|
||||||
|
* \var defer
|
||||||
|
* \brief Defer service
|
||||||
|
*/
|
||||||
|
protected $defer = ${5:true};
|
||||||
|
|
||||||
|
public function register() {
|
||||||
|
$this->app->bind('$2\\$1Interface', function($app) {
|
||||||
|
return new $1Repository(new $1());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief If $defer == true need this fn
|
||||||
|
*/
|
||||||
|
public function provides() {
|
||||||
|
return ['$2\\$1Interface'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#model
|
||||||
|
snippet l_md "Laravel simple model" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${1:Entities}
|
||||||
|
* \class ${2:`!v expand('%:t:r')`}
|
||||||
|
*
|
||||||
|
* \author ${3:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $1;
|
||||||
|
|
||||||
|
class $2 extends \Eloquent {
|
||||||
|
protected $table = '${4:`!p snip.rv = t[2].lower()`}';
|
||||||
|
|
||||||
|
public $timestamps = ${5:false};
|
||||||
|
|
||||||
|
protected $hidden = array(${6});
|
||||||
|
|
||||||
|
protected $guarded = array(${7:'id'});
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#abstract repository
|
||||||
|
snippet l_ar "Laravel abstract Repository" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${1:Repositories}
|
||||||
|
* \class ${2:`!v expand('%:t:r')`}
|
||||||
|
* \implements ${3:BaseRepositoryInterface}
|
||||||
|
*
|
||||||
|
* \author ${4:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $1;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
abstract class $2 implements $3 {
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn __construct
|
||||||
|
*
|
||||||
|
* \brief Take the model
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function __construct(Model $model) {
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn all
|
||||||
|
*
|
||||||
|
* \return Illuminate\Database\Eloquent\Collection
|
||||||
|
*/
|
||||||
|
public function all($columns = array('*')) {
|
||||||
|
return $this->model->all()->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn create
|
||||||
|
*
|
||||||
|
* \return Illuminate\Database\Eloquent\Model
|
||||||
|
*/
|
||||||
|
public function create(array $attributes) {
|
||||||
|
return $this->model->create($attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn destroy
|
||||||
|
*
|
||||||
|
* \return int
|
||||||
|
*/
|
||||||
|
public function destroy($ids) {
|
||||||
|
return $this->model->destroy($ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn find
|
||||||
|
*
|
||||||
|
* \return mixed
|
||||||
|
*/
|
||||||
|
public function find($id, $columns = array('*')) {
|
||||||
|
return $this->model->find($id, $columns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#repository
|
||||||
|
snippet l_r "Laravel Repository" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${1:Repositories\\${2}}
|
||||||
|
* \class ${3:`!v expand('%:t:r')`}
|
||||||
|
* \implements ${4:$3RepositoryInterface}
|
||||||
|
*
|
||||||
|
* \author ${5:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $1;
|
||||||
|
|
||||||
|
class $3 extends \\${6} implements $4 {
|
||||||
|
${7}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#service
|
||||||
|
snippet l_s "Laravel Service" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${1:Services}
|
||||||
|
* \class ${2:`!v expand('%:t:r')`}
|
||||||
|
*
|
||||||
|
* \author ${3:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $1;
|
||||||
|
|
||||||
|
use ${4:Repositories\\${5:Interface}};
|
||||||
|
|
||||||
|
class $2 {
|
||||||
|
protected $${6:repo};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn __construct
|
||||||
|
*/
|
||||||
|
public function __construct($5 $repo) {
|
||||||
|
$this->$6 = $repo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#facade
|
||||||
|
snippet l_f "Laravel Facade" b
|
||||||
|
/*!
|
||||||
|
* \namespace ${1:Services}
|
||||||
|
* \class ${2:`!v expand('%:t:r')`}
|
||||||
|
*
|
||||||
|
* \author ${3:`!v g:snips_author`}
|
||||||
|
* \date `!v strftime('%d-%m-%y')`
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace $1;
|
||||||
|
|
||||||
|
use \Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
|
class $2 extends Facade {
|
||||||
|
/*!
|
||||||
|
* \fn getFacadeAccessor
|
||||||
|
*
|
||||||
|
* \return string
|
||||||
|
*/
|
||||||
|
protected static function getFacadeAccessor() { return '${5:${4}Service}'; }
|
||||||
|
}
|
||||||
|
endsnippet
|
@ -10,43 +10,6 @@ fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet test "Test function" b
|
|
||||||
#[test]
|
|
||||||
fn ${1:test_function_name}() {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet bench "Bench function" b
|
|
||||||
#[bench]
|
|
||||||
fn ${1:bench_function_name}(b: &mut test::Bencher) {
|
|
||||||
b.iter(|| {
|
|
||||||
${VISUAL}${0}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet new "A new function" b
|
|
||||||
pub fn new(${2}) -> ${1:Name} {
|
|
||||||
${VISUAL}${0}return $1 { ${3} };
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet main "The main function" b
|
|
||||||
pub fn main() {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet let "A let statement" b
|
|
||||||
let ${1:name}${3} = ${VISUAL}${2};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lmut "let mut = .." b
|
|
||||||
let mut ${1:name}${3} = ${VISUAL}${2};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pri "print!(..)" b
|
snippet pri "print!(..)" b
|
||||||
print!("${1}"${2/..*/, /}${2});
|
print!("${1}"${2/..*/, /}${2});
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -67,130 +30,22 @@ macro_rules! ${1:name} (
|
|||||||
)
|
)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ec "extern crate ..." b
|
|
||||||
extern crate ${1:sync};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ecl "...extern crate log;" b
|
|
||||||
#![feature(phase)]
|
|
||||||
#[phase(plugin, link)] extern crate log;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mod "A module" b
|
snippet mod "A module" b
|
||||||
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
||||||
${VISUAL}${0}
|
${VISUAL}${0}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet crate "Create header information" b
|
|
||||||
// Crate name
|
|
||||||
#![crate_name = "${1:crate_name}"]
|
|
||||||
|
|
||||||
// Additional metadata attributes
|
|
||||||
#![desc = "${2:Descrption.}"]
|
|
||||||
#![license = "${3:BSD}"]
|
|
||||||
#![comment = "${4:Comment.}"]
|
|
||||||
|
|
||||||
// Specify the output type
|
|
||||||
#![crate_type = "${5:lib}"]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet allow "#[allow(..)]" b
|
|
||||||
#[allow(${1:unused_variable})]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet feat "#![feature(..)]" b
|
|
||||||
#![feature(${1:macro_rules})]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet der "#[deriving(..)]" b
|
|
||||||
#[deriving(${1:Show})]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet attr "#[..]" b
|
|
||||||
#[${1:inline}]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet opt "Option<..>"
|
|
||||||
Option<${1:int}>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet res "Result<.., ..>"
|
|
||||||
Result<${1:int}, ${2:()}>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if .. (if)" b
|
|
||||||
if ${1} {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet el "else .. (el)"
|
|
||||||
else {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eli "else if .. (eli)"
|
|
||||||
else if ${1} {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if .. else (ife)"
|
|
||||||
if ${1} {
|
|
||||||
${2}
|
|
||||||
} else {
|
|
||||||
${3}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mat "match"
|
|
||||||
match ${1} {
|
|
||||||
${2} => ${3},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet loop "loop {}" b
|
|
||||||
loop {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while .. {}" b
|
|
||||||
while ${1} {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for .. in .." b
|
snippet for "for .. in .." b
|
||||||
for ${1:i} in ${2:range(0u, 10)} {
|
for ${1:i} in ${2:${3:0us}..${4:10}} {
|
||||||
${VISUAL}${0}
|
${VISUAL}${0}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet spawn "spawn(proc() { .. });" b
|
|
||||||
spawn(proc() {
|
|
||||||
${VISUAL}${0}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet chan "A channel" b
|
|
||||||
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet duplex "Duplex stream" b
|
|
||||||
let (${1:from_child}, ${2:to_child}) = sync::duplex();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet todo "A Todo comment"
|
snippet todo "A Todo comment"
|
||||||
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
|
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fixme "FIXME comment"
|
|
||||||
// FIXME: ${1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet st "Struct" b
|
snippet st "Struct" b
|
||||||
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||||
${VISUAL}${0}
|
${VISUAL}${0}
|
||||||
@ -211,42 +66,4 @@ impl $1 {
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet enum "An enum" b
|
|
||||||
enum ${1:Name} {
|
|
||||||
${VISUAL}${0},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet type "A type" b
|
|
||||||
type ${1:NewName} = ${VISUAL}${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet imp "An impl" b
|
|
||||||
impl ${1:Name} {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet drop "Drop implementation" b
|
|
||||||
impl Drop for ${1:Name} {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet trait "Trait definition" b
|
|
||||||
trait ${1:Name} {
|
|
||||||
${VISUAL}${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ss "A static string."
|
|
||||||
static ${1}: &'static str = "${VISUAL}${0}";
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stat "A static variable."
|
|
||||||
static ${1}: ${2:uint} = ${VISUAL}${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
@ -29,7 +29,6 @@ snippet GPL2
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet LGPL2
|
snippet LGPL2
|
||||||
${1:One line to give the program's name and a brief description.}
|
${1:One line to give the program's name and a brief description.}
|
||||||
@ -47,7 +46,6 @@ snippet LGPL2
|
|||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet GPL3
|
snippet GPL3
|
||||||
${1:one line to give the program's name and a brief description.}
|
${1:one line to give the program's name and a brief description.}
|
||||||
@ -65,7 +63,6 @@ snippet GPL3
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet LGPL3
|
snippet LGPL3
|
||||||
${1:One line to give the program's name and a brief description.}
|
${1:One line to give the program's name and a brief description.}
|
||||||
@ -83,7 +80,6 @@ snippet LGPL3
|
|||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet AGPL3
|
snippet AGPL3
|
||||||
${1:one line to give the program's name and a brief description.}
|
${1:one line to give the program's name and a brief description.}
|
||||||
@ -101,6 +97,14 @@ snippet AGPL3
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
${0}
|
||||||
|
snippet GMGPL linking exception
|
||||||
|
As a special exception, if other files instantiate generics from
|
||||||
|
this unit, or you link this unit with other files to produce an
|
||||||
|
executable, this unit does not by itself cause the resulting
|
||||||
|
executable to be covered by the GNU General Public License.
|
||||||
|
This exception does not however invalidate any other reasons why the
|
||||||
|
executable file might be covered by the GNU Public License.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet BSD2
|
snippet BSD2
|
||||||
@ -131,7 +135,6 @@ snippet BSD2
|
|||||||
The views and conclusions contained in the software and documentation
|
The views and conclusions contained in the software and documentation
|
||||||
are those of the authors and should not be interpreted as representing
|
are those of the authors and should not be interpreted as representing
|
||||||
official policies, either expressedor implied, of $2.
|
official policies, either expressedor implied, of $2.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet BSD3
|
snippet BSD3
|
||||||
${1:one line to give the program's name and a brief description}
|
${1:one line to give the program's name and a brief description}
|
||||||
@ -159,7 +162,6 @@ snippet BSD3
|
|||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet BSD4
|
snippet BSD4
|
||||||
${1:one line to give the program's name and a brief description}
|
${1:one line to give the program's name and a brief description}
|
||||||
@ -190,7 +192,6 @@ snippet BSD4
|
|||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet MIT
|
snippet MIT
|
||||||
${1:one line to give the program's name and a brief description}
|
${1:one line to give the program's name and a brief description}
|
||||||
@ -213,7 +214,6 @@ snippet MIT
|
|||||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet APACHE
|
snippet APACHE
|
||||||
${1:one line to give the program's name and a brief description}
|
${1:one line to give the program's name and a brief description}
|
||||||
@ -230,7 +230,6 @@ snippet APACHE
|
|||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet BEERWARE
|
snippet BEERWARE
|
||||||
${1:one line to give the program's name and a brief description}
|
${1:one line to give the program's name and a brief description}
|
||||||
@ -240,7 +239,6 @@ snippet BEERWARE
|
|||||||
$2 wrote this file. As long as you retain this notice you
|
$2 wrote this file. As long as you retain this notice you
|
||||||
can do whatever you want with this stuff. If we meet some day, and you think
|
can do whatever you want with this stuff. If we meet some day, and you think
|
||||||
this stuff is worth it, you can buy me a beer or coffee in return
|
this stuff is worth it, you can buy me a beer or coffee in return
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
snippet WTFPL
|
snippet WTFPL
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
@ -262,5 +260,4 @@ snippet MPL2
|
|||||||
This Source Code Form is subject to the terms of the Mozilla Public
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
|
@ -215,41 +215,3 @@ snippet getl Ada.Text_IO.Get_Line
|
|||||||
snippet newline Ada.Text_IO.New_Line
|
snippet newline Ada.Text_IO.New_Line
|
||||||
Ada.Text_IO.New_Line(${1:1});${0}
|
Ada.Text_IO.New_Line(${1:1});${0}
|
||||||
|
|
||||||
snippet gpl GPL license header
|
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
|
||||||
-- it under the terms of the GNU ${1}General Public License as published by
|
|
||||||
-- the Free Software Foundation; either version ${2:3} of the License, or
|
|
||||||
-- (at your option) any later version.
|
|
||||||
--
|
|
||||||
-- This program is distributed in the hope that it will be useful,
|
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
-- GNU $1General Public License for more details.
|
|
||||||
--
|
|
||||||
-- You should have received a copy of the GNU $1General Public License
|
|
||||||
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
--
|
|
||||||
-- Copyright (C) ${3:Author}, ${4:`strftime("%Y")`}
|
|
||||||
|
|
||||||
${0}
|
|
||||||
|
|
||||||
snippet gplf GPL file license header
|
|
||||||
-- This file is part of ${1:Program-Name}.
|
|
||||||
--
|
|
||||||
-- $1 is free software: you can redistribute it and/or modify
|
|
||||||
-- it under the terms of the GNU ${2}General Public License as published by
|
|
||||||
-- the Free Software Foundation, either version ${3:3} of the License, or
|
|
||||||
-- (at your option) any later version.
|
|
||||||
--
|
|
||||||
-- $1 is distributed in the hope that it will be useful,
|
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
-- GNU $2General Public License for more details.
|
|
||||||
--
|
|
||||||
-- You should have received a copy of the GNU $2General Public License
|
|
||||||
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
--
|
|
||||||
-- Copyright (C) ${4:Author}, ${5:`strftime("%Y")`}
|
|
||||||
|
|
||||||
${0}
|
|
||||||
|
|
||||||
|
102
snippets/awk.snippets
Normal file
102
snippets/awk.snippets
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
# cannot use /usr/bin/env because it does not support parameters (as -f)
|
||||||
|
snippet #! #!/usr/bin/awk -f
|
||||||
|
#!/usr/bin/awk -f
|
||||||
|
|
||||||
|
# @include is a gawk extension
|
||||||
|
snippet inc @include
|
||||||
|
@include "${1}"${0}
|
||||||
|
|
||||||
|
# @load is a gawk extension
|
||||||
|
snippet loa @load
|
||||||
|
@load "${1}"${0}
|
||||||
|
|
||||||
|
snippet beg BEGIN { ... }
|
||||||
|
BEGIN {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
# BEGINFILE is a gawk extension
|
||||||
|
snippet begf BEGINFILE { ... }
|
||||||
|
BEGINFILE {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet end END { ... }
|
||||||
|
END {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ENDFILE is a gawk extension
|
||||||
|
snippet endf ENDFILE { ... }
|
||||||
|
ENDFILE {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet pri print
|
||||||
|
print ${1:"${2}"}${0}
|
||||||
|
|
||||||
|
snippet printf printf
|
||||||
|
printf("${1:%s}\n", ${2})${0}
|
||||||
|
|
||||||
|
snippet ign IGNORECASE
|
||||||
|
IGNORECASE = ${1:1}
|
||||||
|
|
||||||
|
snippet if if {...}
|
||||||
|
if (${1}) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet ife if ... else ...
|
||||||
|
if (${1}) {
|
||||||
|
${2}
|
||||||
|
} else {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet eif else if ...
|
||||||
|
else if (${1}) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet el else {...}
|
||||||
|
else {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet wh while
|
||||||
|
while (${1}) {
|
||||||
|
${2}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet do do ... while
|
||||||
|
do {
|
||||||
|
${0}
|
||||||
|
} while (${1})
|
||||||
|
|
||||||
|
snippet for for
|
||||||
|
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet fore for each
|
||||||
|
for (${1:i} in ${2:array}) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
# the switch is a gawk extension
|
||||||
|
snippet sw switch
|
||||||
|
switch (${1}) {
|
||||||
|
case ${2}:
|
||||||
|
${3}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
${0}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
# the switch is a gawk extension
|
||||||
|
snippet case case
|
||||||
|
case ${1}:
|
||||||
|
${0}
|
||||||
|
break
|
||||||
|
|
6
snippets/eelixir.snippets
Normal file
6
snippets/eelixir.snippets
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
snippet %
|
||||||
|
<% ${0} %>
|
||||||
|
snippet =
|
||||||
|
<%= ${1} %>
|
||||||
|
snippet end
|
||||||
|
<% end %>
|
@ -6,7 +6,7 @@ snippet if if .. do .. end
|
|||||||
if ${1} do
|
if ${1} do
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet if if .. do: ..
|
snippet if: if .. do: ..
|
||||||
if ${1:condition}, do: ${0}
|
if ${1:condition}, do: ${0}
|
||||||
snippet ife if .. do .. else .. end
|
snippet ife if .. do .. else .. end
|
||||||
if ${1:condition} do
|
if ${1:condition} do
|
||||||
@ -14,13 +14,13 @@ snippet ife if .. do .. else .. end
|
|||||||
else
|
else
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet ife if .. do: .. else:
|
snippet ife: if .. do: .. else:
|
||||||
if ${1:condition}, do: ${2}, else: ${0}
|
if ${1:condition}, do: ${2}, else: ${0}
|
||||||
snippet unless unless .. do .. end
|
snippet unless unless .. do .. end
|
||||||
unless ${1} do
|
unless ${1} do
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet unless unless .. do: ..
|
snippet unless: unless .. do: ..
|
||||||
unless ${1:condition}, do: ${0}
|
unless ${1:condition}, do: ${0}
|
||||||
snippet unlesse unless .. do .. else .. end
|
snippet unlesse unless .. do .. else .. end
|
||||||
unless ${1:condition} do
|
unless ${1:condition} do
|
||||||
@ -28,17 +28,17 @@ snippet unlesse unless .. do .. else .. end
|
|||||||
else
|
else
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet unlesse unless .. do: .. else:
|
snippet unlesse: unless .. do: .. else:
|
||||||
unless ${1:condition}, do: ${2}, else: ${0}
|
unless ${1:condition}, do: ${2}, else: ${0}
|
||||||
snippet cond
|
snippet cond
|
||||||
cond do
|
cond do
|
||||||
${1} ->
|
${1} ->
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet case
|
snippet case
|
||||||
case ${1} do
|
case ${1} do
|
||||||
${2} ->
|
${2} ->
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet df
|
snippet df
|
||||||
def ${1:name}, do: ${2}
|
def ${1:name}, do: ${2}
|
||||||
@ -46,6 +46,13 @@ snippet def
|
|||||||
def ${1:name} do
|
def ${1:name} do
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
|
snippet defd
|
||||||
|
@doc """
|
||||||
|
${1:doc string}
|
||||||
|
"""
|
||||||
|
def ${2:name} do
|
||||||
|
${0}
|
||||||
|
end
|
||||||
snippet defim
|
snippet defim
|
||||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||||
${0}
|
${0}
|
||||||
@ -71,7 +78,7 @@ snippet doc
|
|||||||
${0}
|
${0}
|
||||||
"""
|
"""
|
||||||
snippet fn
|
snippet fn
|
||||||
fn(${1:args}) -> ${0} end
|
fn ${1:args} -> ${0} end
|
||||||
snippet fun
|
snippet fun
|
||||||
function do
|
function do
|
||||||
${0}
|
${0}
|
||||||
@ -95,9 +102,16 @@ snippet test
|
|||||||
test "${1:test_name}" do
|
test "${1:test_name}" do
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
|
snippet testa
|
||||||
|
test "${1:test_name}", %{${2:arg: arg}} do
|
||||||
|
${0}
|
||||||
|
end
|
||||||
snippet try try .. rescue .. end
|
snippet try try .. rescue .. end
|
||||||
try do
|
try do
|
||||||
${1}
|
${1}
|
||||||
rescue
|
rescue
|
||||||
${2} -> ${0}
|
${2} -> ${0}
|
||||||
end
|
end
|
||||||
|
snippet pry
|
||||||
|
require IEx; IEx.pry
|
||||||
|
${0}
|
||||||
|
@ -173,6 +173,9 @@ snippet main
|
|||||||
# new
|
# new
|
||||||
snippet nw
|
snippet nw
|
||||||
new(${0:type})
|
new(${0:type})
|
||||||
|
# package
|
||||||
|
snippet pa
|
||||||
|
package ${1:main}
|
||||||
# panic
|
# panic
|
||||||
snippet pn
|
snippet pn
|
||||||
panic("${0:msg}")
|
panic("${0:msg}")
|
||||||
|
@ -15,6 +15,11 @@ snippet f
|
|||||||
function(${1}) {
|
function(${1}) {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
|
# Anonymous Function assigned to variable
|
||||||
|
snippet vaf
|
||||||
|
var ${1:function_name} = function(${2}) {
|
||||||
|
${0}
|
||||||
|
};
|
||||||
# Function assigned to variable
|
# Function assigned to variable
|
||||||
snippet vf
|
snippet vf
|
||||||
var ${1:function_name} = function $1(${2}) {
|
var ${1:function_name} = function $1(${2}) {
|
||||||
@ -112,8 +117,8 @@ snippet fori
|
|||||||
# Object Method
|
# Object Method
|
||||||
snippet :f
|
snippet :f
|
||||||
${1:method_name}: function (${2:attribute}) {
|
${1:method_name}: function (${2:attribute}) {
|
||||||
${0}
|
${3}
|
||||||
}${3:,}
|
},
|
||||||
# hasOwnProperty
|
# hasOwnProperty
|
||||||
snippet has
|
snippet has
|
||||||
hasOwnProperty(${0})
|
hasOwnProperty(${0})
|
||||||
|
@ -75,6 +75,8 @@ snippet ===
|
|||||||
`repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
|
`repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
|
snippet -
|
||||||
|
- ${0}
|
||||||
snippet ---
|
snippet ---
|
||||||
`repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
|
`repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ snippet class
|
|||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet node
|
snippet node
|
||||||
node '${1:`vim_snippets#Filename('', 'fqdn')`}' {
|
node "${1:`vim_snippets#Filename('', 'fqdn')`}" {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet case
|
snippet case
|
||||||
@ -107,13 +107,21 @@ snippet if
|
|||||||
if $${1:variable} {
|
if $${1:variable} {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
|
snippet ifd
|
||||||
|
if defined(${1:Resource}["${2:name}"]) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet ifnd
|
||||||
|
if !defined(${1:Resource}["${2:name}"]) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
snippet el
|
snippet el
|
||||||
else {
|
else {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet ?
|
snippet ?
|
||||||
? {
|
? {
|
||||||
'${1}' => ${0}
|
"${1}" => ${0}
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# blocks etc and general syntax sugar
|
# blocks etc and general syntax sugar
|
||||||
@ -122,98 +130,98 @@ snippet [
|
|||||||
snippet >
|
snippet >
|
||||||
${1} => ${0}
|
${1} => ${0}
|
||||||
snippet p:
|
snippet p:
|
||||||
'puppet://puppet/${1:module name}/${0:file name}'
|
"puppet://puppet/${1:module name}/${0:file name}"
|
||||||
#
|
#
|
||||||
# Functions
|
# Functions
|
||||||
snippet alert
|
snippet alert
|
||||||
alert('${1:message}')
|
alert("${1:message}")
|
||||||
snippet crit
|
snippet crit
|
||||||
crit('${1:message}')
|
crit("${1:message}")
|
||||||
snippet debug
|
snippet debug
|
||||||
debug('${1:message}')
|
debug("${1:message}")
|
||||||
snippet defined
|
snippet defined
|
||||||
defined(${1:Resource}['${2:name}'])
|
defined(${1:Resource}["${2:name}"])
|
||||||
snippet emerg
|
snippet emerg
|
||||||
emerg('${1:message}')
|
emerg("${1:message}")
|
||||||
snippet extlookup Simple extlookup
|
snippet extlookup Simple extlookup
|
||||||
extlookup('${1:variable}')
|
extlookup("${1:variable}")
|
||||||
snippet extlookup Extlookup with defaults
|
snippet extlookup Extlookup with defaults
|
||||||
extlookup('${1:variable}', '${2:default}')
|
extlookup("${1:variable}", "${2:default}")
|
||||||
snippet extlookup Extlookup with defaults and custom data file
|
snippet extlookup Extlookup with defaults and custom data file
|
||||||
extlookup('${1:variable}', '${2:default}', '${3:data source}')
|
extlookup("${1:variable}", "${2:default}", "${3:data source}")
|
||||||
snippet fail
|
snippet fail
|
||||||
fail('${1:message}')
|
fail("${1:message}")
|
||||||
snippet info
|
snippet info
|
||||||
info('${1:message}')
|
info("${1:message}")
|
||||||
snippet inline_template
|
snippet inline_template
|
||||||
inline_template('<%= ${1} %>')
|
inline_template("<%= ${1} %>")
|
||||||
snippet notice
|
snippet notice
|
||||||
notice('${1:message}')
|
notice("${1:message}")
|
||||||
snippet realize
|
snippet realize
|
||||||
realize(${1:Resource}[${2:name}])
|
realize(${1:Resource}[${2:name}])
|
||||||
snippet regsubst
|
snippet regsubst
|
||||||
regsubst(${1:hay stack}, ${2:needle}, '${3:replacement}')
|
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")
|
||||||
snippet inc
|
snippet inc
|
||||||
include ${1:classname}
|
include ${1:classname}
|
||||||
snippet split
|
snippet split
|
||||||
split(${1:hay stack}, '${2:patten}')
|
split(${1:hay stack}, "${2:patten}")
|
||||||
snippet versioncmp
|
snippet versioncmp
|
||||||
versioncmp('${1:version}', '${2:version}')
|
versioncmp("${1:version}", "${2:version}")
|
||||||
snippet warning
|
snippet warning
|
||||||
warning('${1:message}')
|
warning("${1:message}")
|
||||||
#
|
#
|
||||||
# Types
|
# Types
|
||||||
snippet cron
|
snippet cron
|
||||||
cron { '${1:name}':
|
cron { "${1:name}":
|
||||||
command => '${2}',
|
command => "${2}",
|
||||||
user => '${3:root}',
|
user => "${3:root}",
|
||||||
${4} => ${0},
|
${4} => ${0},
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet exec
|
snippet exec
|
||||||
exec { '${1:name}':
|
exec { "${1:name}":
|
||||||
command => '${2:$1}',
|
command => "${2:$1}",
|
||||||
user => '${3:root}',
|
user => "${3:root}",
|
||||||
${4} => ${0},
|
${4} => ${0},
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet user
|
snippet user
|
||||||
user { '${1:user}':
|
user { "${1:user}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
comment => '${2:$1}',
|
comment => "${2:$1}",
|
||||||
managehome => true,
|
managehome => true,
|
||||||
home => '${0:/home/$1}',
|
home => "${0:/home/$1}",
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet group
|
snippet group
|
||||||
group { '${1:group}':
|
group { "${1:group}":
|
||||||
ensure => ${0:present},
|
ensure => ${0:present},
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet host
|
snippet host
|
||||||
host { '${1:hostname}':
|
host { "${1:hostname}":
|
||||||
ip => ${0:127.0.0.1},
|
ip => ${0:127.0.0.1},
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet mailalias
|
snippet mailalias
|
||||||
mailalias { '${1:localpart}':
|
mailalias { "${1:localpart}":
|
||||||
recipient => '${0:recipient}',
|
recipient => "${0:recipient}",
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet mount
|
snippet mount
|
||||||
mount { '${1:destination path}':
|
mount { "${1:destination path}":
|
||||||
ensure => ${2:mounted},
|
ensure => ${2:mounted},
|
||||||
device => '${0:device name or path}',
|
device => "${0:device name or path}",
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet package
|
snippet package
|
||||||
package { '${1:package name}':
|
package { "${1:package name}":
|
||||||
ensure => ${0:present},
|
ensure => ${0:present},
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet yumrepo
|
snippet yumrepo
|
||||||
yumrepo { '${1:repo name}':
|
yumrepo { "${1:repo name}":
|
||||||
Descr => '${2:$1}',
|
Descr => "${2:$1}",
|
||||||
enabled => ${0:1},
|
enabled => ${0:1},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,22 +231,39 @@ snippet define
|
|||||||
}
|
}
|
||||||
|
|
||||||
snippet service
|
snippet service
|
||||||
service { '${1:service}' :
|
service { "${1:service}" :
|
||||||
ensure => running,
|
ensure => running,
|
||||||
enable => true,
|
enable => true,
|
||||||
require => [ Package['${2:package}'], File['${3:file}'], ],
|
require => [ Package["${2:package}"], File["${3:file}"], ],
|
||||||
subscribe => [ File['${4:configfile1}'], File['${5:configfile2}'], Package['${6:package}'], ],
|
subscribe => [ File["${4:configfile1}"], File["${5:configfile2}"], Package["${6:package}"], ],
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet file
|
snippet file
|
||||||
file { '${1:filename}' :
|
file { "${1:filename}" :
|
||||||
ensure => ${2:present},
|
ensure => ${2:present},
|
||||||
owner => '${3:root}',
|
owner => "${3:root}",
|
||||||
group => '${4:root}',
|
group => "${4:root}",
|
||||||
mode => '${5:0644}',
|
mode => "${5:0644}",
|
||||||
source => 'puppet:///modules/${6:module}/${7:source}',
|
source => "puppet:///modules/${6:module}/${7:source}",
|
||||||
content => template('/etc/puppet/templates/${8:template}'),
|
content => template("${8:module}/${9:template}"),
|
||||||
alias => '${9:alias}',
|
alias => "${10:alias}",
|
||||||
require => [ Package['${10:package}'], File['${11:file}'], ],
|
require => [ Package["${11:package}"], File["${12:file}"], ],
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet archive
|
||||||
|
archive { "${1:filename}" :
|
||||||
|
ensure => ${2:present},
|
||||||
|
url => "http://${3:url}",
|
||||||
|
extension => "${4:tgz}",
|
||||||
|
target => "${5:target}",
|
||||||
|
checksum => ${6:false},
|
||||||
|
src_target => "${7:/tmp}",
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet firewall
|
||||||
|
firewall { "${1:comment}" :
|
||||||
|
proto => ${2:tcp},
|
||||||
|
action => ${3:accept},
|
||||||
|
port => ${4},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +129,19 @@ snippet pdb
|
|||||||
# ipython debugger (ipdb)
|
# ipython debugger (ipdb)
|
||||||
snippet ipdb
|
snippet ipdb
|
||||||
import ipdb; ipdb.set_trace()
|
import ipdb; ipdb.set_trace()
|
||||||
|
# embed ipython itself
|
||||||
|
snippet iem
|
||||||
|
import IPython; IPython.embed()
|
||||||
# ipython debugger (pdbbb)
|
# ipython debugger (pdbbb)
|
||||||
snippet pdbbb
|
snippet pdbbb
|
||||||
import pdbpp; pdbpp.set_trace()
|
import pdbpp; pdbpp.set_trace()
|
||||||
|
# remote python debugger (rpdb)
|
||||||
|
snippet rpdb
|
||||||
|
import rpdb; rpdb.set_trace()
|
||||||
|
# python_prompt_toolkit
|
||||||
|
snippet ppt
|
||||||
|
from prompt_toolkit.contrib.repl import embed
|
||||||
|
embed(globals(), locals(), vi_mode=${1:default=False}, history_filename=${2:default=None})
|
||||||
# python console debugger (pudb)
|
# python console debugger (pudb)
|
||||||
snippet pudb
|
snippet pudb
|
||||||
import pudb; pudb.set_trace()
|
import pudb; pudb.set_trace()
|
||||||
@ -208,3 +218,9 @@ snippet kwg
|
|||||||
self.${1:var_name} = kwargs.get('$1', ${2:None})
|
self.${1:var_name} = kwargs.get('$1', ${2:None})
|
||||||
snippet lkwg
|
snippet lkwg
|
||||||
${1:var_name} = kwargs.get('$1', ${2:None})
|
${1:var_name} = kwargs.get('$1', ${2:None})
|
||||||
|
snippet args
|
||||||
|
*args${1:,}${0}
|
||||||
|
snippet kwargs
|
||||||
|
**kwargs${1:,}${0}
|
||||||
|
snippet akw
|
||||||
|
*args, **kwargs${1:,}${0}
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
snippet fn
|
snippet fn
|
||||||
fn ${1:function_name}(${2}) {
|
fn ${1:function_name}(${2})${3} {
|
||||||
${0}
|
|
||||||
}
|
|
||||||
snippet fn-
|
|
||||||
fn ${1:function_name}(${2}) -> ${3} {
|
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet test
|
snippet test
|
||||||
@ -16,6 +12,13 @@ snippet test
|
|||||||
fn ${1:test_function_name}() {
|
fn ${1:test_function_name}() {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
|
snippet bench "Bench function" b
|
||||||
|
#[bench]
|
||||||
|
fn ${1:bench_function_name}(b: &mut test::Bencher) {
|
||||||
|
b.iter(|| {
|
||||||
|
${0}
|
||||||
|
})
|
||||||
|
}
|
||||||
snippet new
|
snippet new
|
||||||
pub fn new(${2}) -> ${1:Name} {
|
pub fn new(${2}) -> ${1:Name} {
|
||||||
${0}return $1 { ${3} };
|
${0}return $1 { ${3} };
|
||||||
@ -25,7 +28,9 @@ snippet main
|
|||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet let
|
snippet let
|
||||||
let ${1:name}${3} = ${2};
|
let ${1:name: type} = ${2};
|
||||||
|
snippet let
|
||||||
|
let mut ${1:name: type} = ${2};
|
||||||
snippet pln
|
snippet pln
|
||||||
println!("${1}");
|
println!("${1}");
|
||||||
snippet pln,
|
snippet pln,
|
||||||
@ -52,25 +57,48 @@ snippet allow
|
|||||||
#[allow(${1:unused_variable})]
|
#[allow(${1:unused_variable})]
|
||||||
snippet feat
|
snippet feat
|
||||||
#![feature(${1:macro_rules})]
|
#![feature(${1:macro_rules})]
|
||||||
|
snippet der "#[deriving(..)]" b
|
||||||
|
#[deriving(${1:Show})]
|
||||||
|
snippet attr "#[..]" b
|
||||||
|
#[${1:inline}]
|
||||||
|
|
||||||
# Common types
|
# Common types
|
||||||
snippet opt
|
snippet opt
|
||||||
Option<${1:int}>
|
Option<${1:int}>
|
||||||
snippet res
|
snippet res
|
||||||
Result<${1:~str}, ${2:()}>
|
Result<${1:~str}, ${2:()}>
|
||||||
snippet if
|
snippet if
|
||||||
if ${1:/* condition */} {
|
if ${1} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet ife
|
||||||
|
if ${1} {
|
||||||
|
${2}
|
||||||
|
} else {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet el
|
||||||
|
else {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet eli
|
||||||
|
else if ${1} {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet mat
|
snippet mat
|
||||||
match ${1} {
|
match ${1} {
|
||||||
${2} => ${3},
|
${2} => ${3},
|
||||||
}
|
}
|
||||||
|
snippet loop "loop {}" b
|
||||||
|
loop {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
snippet while
|
snippet while
|
||||||
while ${1:condition} {
|
while ${1:condition} {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet for
|
snippet for
|
||||||
for ${1:i} in ${2:range(0u, 10)} {
|
for ${1:i} in ${2:0u..10} {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet spawn
|
snippet spawn
|
||||||
@ -83,12 +111,19 @@ snippet duplex
|
|||||||
let (${1:from_child}, ${2:to_child}) = sync::duplex();
|
let (${1:from_child}, ${2:to_child}) = sync::duplex();
|
||||||
# TODO commenting
|
# TODO commenting
|
||||||
snippet todo
|
snippet todo
|
||||||
// [TODO]: ${1:Description}
|
// [TODO]: ${0:Description}
|
||||||
|
snippet fixme "FIXME comment"
|
||||||
|
// FIXME: $0
|
||||||
|
|
||||||
# Struct
|
# Struct
|
||||||
snippet st
|
snippet st
|
||||||
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
|
snippet stn
|
||||||
|
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
impl $1 {
|
impl $1 {
|
||||||
pub fn new(${2}) -> $1 {
|
pub fn new(${2}) -> $1 {
|
||||||
@ -97,9 +132,11 @@ snippet st
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
snippet typ
|
||||||
|
type ${1:NewName} = $0;
|
||||||
# Enum
|
# Enum
|
||||||
snippet enum
|
snippet enum
|
||||||
enum ${1:enum_name} {
|
enum ${1:Name} {
|
||||||
${0},
|
${0},
|
||||||
}
|
}
|
||||||
# Impl
|
# Impl
|
||||||
@ -122,4 +159,4 @@ snippet trait
|
|||||||
snippet ss
|
snippet ss
|
||||||
static ${1}: &'static str = "${0}";
|
static ${1}: &'static str = "${0}";
|
||||||
snippet stat
|
snippet stat
|
||||||
static ${1}: ${2:uint} = ${0};
|
static ${1}: ${2:usize} = ${0};
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
|
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
|
||||||
snippet #!
|
snippet #!
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
snippet bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
snippet if
|
snippet if
|
||||||
@ -51,15 +54,12 @@ snippet getopt
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
function usage ()
|
function usage ()
|
||||||
{
|
{
|
||||||
cat <<- EOT
|
echo "Usage : $${0:0} [options] [--]
|
||||||
|
|
||||||
Usage : $${0:0} [options] [--]
|
Options:
|
||||||
|
-h|help Display this message
|
||||||
|
-v|version Display script version"
|
||||||
|
|
||||||
Options:
|
|
||||||
-h|help Display this message
|
|
||||||
-v|version Display script version
|
|
||||||
|
|
||||||
EOT
|
|
||||||
} # ---------- end of function usage ----------
|
} # ---------- end of function usage ----------
|
||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
@ -74,7 +74,7 @@ snippet getopt
|
|||||||
|
|
||||||
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
|
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
|
||||||
|
|
||||||
\? ) echo -e "\n Option does not exist : $OPTARG\n"
|
* ) echo -e "\n Option does not exist : $OPTARG\n"
|
||||||
usage; exit 1 ;;
|
usage; exit 1 ;;
|
||||||
|
|
||||||
esac # --- end of case ---
|
esac # --- end of case ---
|
||||||
@ -82,11 +82,13 @@ snippet getopt
|
|||||||
shift $(($OPTIND-1))
|
shift $(($OPTIND-1))
|
||||||
snippet root
|
snippet root
|
||||||
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi
|
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi
|
||||||
snippet fun
|
|
||||||
|
snippet fun-sh
|
||||||
${1:function_name}() {
|
${1:function_name}() {
|
||||||
${0:#function_body}
|
${0:#function_body}
|
||||||
}
|
}
|
||||||
snippet ffun
|
|
||||||
|
snippet fun
|
||||||
function ${1:function_name}() {
|
function ${1:function_name}() {
|
||||||
${0:#function_body}
|
${0:#function_body}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user