1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2015-01-18 12:58:28 +00:00
parent c3ba0f3c06
commit e7a01094b6
274 changed files with 4547 additions and 3075 deletions

View File

@ -205,15 +205,17 @@ to maintain snippets for a language, please get in touch.
Notes: People are interested in snippets - and their interest may wane again.
This list is kept up-to-date on a best effort basis.
* Python - [honza](http://github.com/honza)
* Javascript - [honza](http://github.com/honza)
* HTML Django - [honza](http://github.com/honza)
* Markdown - [honza](http://github.com/honza)
* Ruby - [taq](http://github.com/taq)
* PHP - [chrisyue](http://github.com/chrisyue)
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
* Falcon - [steveno](https://github.com/steveno)
* Clojure - [lpil](https://github.com/lpil)
* Elixir - [iurifq](https://github.com/iurifq)
* Falcon - [steveno](https://github.com/steveno)
* HTML Django - [honza](http://github.com/honza)
* Javascript - [honza](http://github.com/honza)
* Markdown - [honza](http://github.com/honza)
* PHP - [chrisyue](http://github.com/chrisyue)
* Python - [honza](http://github.com/honza)
* Ruby - [taq](http://github.com/taq)
* Rust - [lpil](https://github.com/lpil)
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
License
-------

View File

@ -11,10 +11,6 @@ def ada_case(word):
out = out + word[i]
return out
def get_year():
import time
return time.strftime("%Y")
endglobal
snippet wi "with"
@ -281,44 +277,4 @@ snippet newline "Ada.Text_IO.New_Line"
Ada.Text_IO.New_Line(${1:1});$0
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:

View File

@ -78,10 +78,12 @@ endglobal
snippet box "A nice box with the current comment symbol" b
`!p
box = make_box(len(t[1]))
snip.rv = box[0] + '\n' + box[1]
snip.rv = box[0]
snip += box[1]
`${1:content}`!p
box = make_box(len(t[1]))
snip.rv = box[2] + '\n' + box[3]`
snip.rv = box[2]
snip += box[3]`
$0
endsnippet
@ -89,10 +91,12 @@ snippet bbox "A nice box over the full width" b
`!p
width = int(vim.eval("&textwidth")) or 71
box = make_box(len(t[1]), width)
snip.rv = box[0] + '\n' + box[1]
snip.rv = box[0]
snip += box[1]
`${1:content}`!p
box = make_box(len(t[1]), width)
snip.rv = box[2] + '\n' + box[3]`
snip.rv = box[2]
snip += box[3]`
$0
endsnippet

View File

@ -44,66 +44,13 @@ snippet fi "<%= Fixtures.identify(:symbol) %>"
endsnippet
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
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
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"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet 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)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, :disable_with => '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet f. "f_fields_for (nff)"
@ -279,10 +226,6 @@ snippet else "else (ERB)"
$0
endsnippet
snippet if "if (ERB)"
<% if ${1:condition} %>$0
endsnippet
snippet lf "link_to_function"
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet

View File

@ -191,7 +191,7 @@ snip.rv = (snip.basename or 'unnamed') + '_submit'
endsnippet
snippet h1 "XHTML <h1>" w
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
<h1>$0</h1>
endsnippet
snippet head "XHTML <head>"
@ -287,22 +287,4 @@ snippet movie "Embed QT movie (movie)" b
`!p x(snip)`>
</object>
endsnippet
snippet html5 "HTML5 Template"
<!DOCTYPE html>
<html>
<head>
<title>${1}</title>
<meta charset="utf-8" />
</head>
<body>
<header>
${2}
</header>
<footer>
${4}
</footer>
</body>
</html>
endsnippet
# vim:ft=snippets:

View File

@ -52,27 +52,18 @@ function ${1:function_name}(${2:argument}) {
}
endsnippet
snippet vf "Function assigned to var"
${1:var }${2:function_name} = function $2(${3}) {
${VISUAL}$0
};
endsnippet
snippet iife "Immediately-Invoked Function Expression (iife)"
(function (${1:argument}) {
${VISUAL}$0
}(${2:$1}));
endsnippet
snippet ife "if ___ else"
if (${1:condition}) {
${2://code}
}
else {
${3://code}
}
endsnippet
snippet if "if"
if (${1:condition}) {
${VISUAL}$0
}
endsnippet
snippet timeout "setTimeout function"
setTimeout(function() {
${VISUAL}$0

View File

@ -19,49 +19,59 @@ config(function($1) {
endsnippet
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
}]);
endsnippet
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
}]);
endsnippet
snippet adir "angular directive" i
directive('${1:name}', ['${2:param_annotation}', function(${3:param}) {
$0
directive('${1}', [${2}function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
return {
restrict: '${3:EA}',
link: function(scope, element, attrs) {
${0}
}
};
}]);
endsnippet
snippet adirs "angular directive with scope" i
directive('${1:name}', ['$scope', function($scope) {
$0
directive('${1}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
return {
restrict: '${3:EA}',
link: function(scope, element, attrs) {
${0}
}
};
}]);
endsnippet
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
}]);
endsnippet
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
}]);
endsnippet
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
}]);
endsnippet
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
}]);
endsnippet

View File

@ -0,0 +1,260 @@
#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 {
public function index() {
${3}
}
public function create() {
${4}
}
public function store($id) {
${5}
}
public function show($id) {
${6}
}
public function edit($id) {
${7}
}
public function update($id) {
${8}
}
public function destroy($id) {
${9}
}
}
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:BaseRepositoryInterface}
*
* \author ${5:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace $1;
class $3 extends \\$1 implements $4 {
${6}
}
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

View File

@ -30,3 +30,9 @@ expects($this->${1:once}())
->with($this->equalTo(${3})${4})
->will($this->returnValue(${5}));
endsnippet
snippet testcmt "phpunit comment with group" b
/**
* @group ${1}
*/
endsnippet

View File

@ -5,267 +5,135 @@ snippet "^#!" "#!/usr/bin/env ruby" r
$0
endsnippet
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
# encoding: UTF-8
$0
endsnippet
snippet If "<command> if <expression>"
${1:command} if ${0:expression}
endsnippet
snippet Unless "<command> unless <expression>"
${1:command} unless ${0:expression}
endsnippet
snippet if "if <condition> ... end"
if ${1:condition}
${2:# TODO}
end
endsnippet
snippet ife "if <condition> ... else ... end"
if ${1:condition}
${2:# TODO}
else
${3:# TODO}
end
endsnippet
snippet ifee "if <condition> ... elseif <condition> ... else ... end"
if ${1:condition}
${2:# TODO}
elsif ${3:condition}
${4:# TODO}
else
${0:# TODO}
end
endsnippet
snippet unless "unless <condition> ... end"
unless ${1:condition}
${0:# TODO}
end
endsnippet
snippet unlesse "unless <condition> ... else ... end"
unless ${1:condition}
${2:# TODO}
else
${0:# TODO}
end
endsnippet
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
unless ${1:condition}
${2:# TODO}
elsif ${3:condition}
${4:# TODO}
else
${0:# TODO}
end
endsnippet
snippet "\b(de)?f" "def <name>..." r
def ${1:function_name}${2: ${3:*args}}
${0:# TODO}
def ${1:function_name}${2:(${3:*args})}
$0
end
endsnippet
snippet defi "def initialize ..."
def initialize${1: ${2:*args}}
${0:# TODO}
def initialize${1:(${2:*args})}
$0
end
endsnippet
snippet defr "def <name> ... rescue ..."
def ${1:function_name}${2: ${3:*args}}
${4:# TODO}
def ${1:function_name}${2:(${3:*args})}
$4
rescue
${0:# TODO}
$0
end
endsnippet
snippet For "(<from>..<to>).each { |<i>| <block> }"
(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} }
(${1:from}..${2:to}).each { |${3:i}| $0 }
endsnippet
snippet for "(<from>..<to>).each do |<i>| <block> end"
(${1:from}..${2:to}).each do |${3:i}|
${0:# TODO}
end
endsnippet
snippet "(\S+)\.Merge!" ".merge!(<other_hash>) { |<key>,<oldval>,<newval>| <block> }" r
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) { |${2:key},${3:oldval},${4:newval}| ${5:block} }
endsnippet
snippet "(\S+)\.merge!" ".merge!(<other_hash>) do |<key>,<oldval>,<newval>| <block> end" r
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) do |${2:key},${3:oldval},${4:newval}|
${0:block}
end
endsnippet
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} }
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| $0 }
endsnippet
snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} }
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| $0 }
endsnippet
snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} }
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| $0 }
endsnippet
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Select" ".select { |<item>| <block>}" r
`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} }
endsnippet
snippet "(\S+)\.select" ".select do |<item>| <block> end" r
`!p snip.rv=match.group(1)`.select do |${1:item}|
${0:block}
end
endsnippet
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} }
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| $0 }
endsnippet
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} }
`!p snip.rv=match.group(1)`.each_key { |${1:key}| $0 }
endsnippet
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
`!p snip.rv=match.group(1)`.each_key do |${1:key}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} }
`!p snip.rv=match.group(1)`.each_value { |${1:value}| $0 }
endsnippet
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
`!p snip.rv=match.group(1)`.each_value do |${1:value}|
${0:# TODO}
$0
end
endsnippet
snippet Each "<elements>.each { |<element>| <block> }"
${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} }
snippet "(\S+)\.ea" "<elements>.each do |<element>| <block> end" r
`!p snip.rv=match.group(1)`.each { |${1:e}| $0 }
endsnippet
snippet each "<elements>.each do |<element>| <block> end"
${1:elements}.each do |${2:${1/s$//}}|
${0:# TODO}
snippet "(\S+)\.ead" "<elements>.each do |<element>| <block> end" r
`!p snip.rv=match.group(1)`.each do |${1:e}|
$0
end
endsnippet
snippet "each_?s(lice)?" "<array>.each_slice(n) do |slice| <block> end" r
${1:elements}.each_slice(${2:2}) do |${3:slice}|
${0:# TODO}
$0
end
endsnippet
snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} }
${1:elements}.each_slice(${2:2}) { |${3:slice}| $0 }
endsnippet
snippet "(\S+)\.Map" ".map { |<element>| <block> }" r
`!p snip.rv=match.group(1)`.map { |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -275,11 +143,9 @@ try:
snip.rv = wmatch.group(1).lower()
except:
snip.rv = 'element'
`}| ${2:# TODO} }
`}| $0 }
endsnippet
snippet "(\S+)\.map" ".map do |<element>| <block> end" r
`!p snip.rv=match.group(1)`.map do |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -290,12 +156,10 @@ try:
except:
snip.rv = 'element'
`}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { |<element>| <block> }" r
`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -305,11 +169,9 @@ try:
snip.rv = wmatch.group(1).lower()
except:
snip.rv = 'element'
`}| ${2:# TODO} }
`}| $0 }
endsnippet
snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do |<element>| <block> end" r
`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -320,12 +182,10 @@ try:
except:
snip.rv = 'element'
`}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Each" ".each { |<element>| <block> }" r
`!p snip.rv=match.group(1)`.each { |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -335,11 +195,9 @@ try:
snip.rv = wmatch.group(1).lower()
except:
snip.rv = 'element'
`}| ${2:# TODO} }
`}| $0 }
endsnippet
snippet "(\S+)\.each" ".each do |<element>| <block> end" r
`!p snip.rv=match.group(1)`.each do |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -350,13 +208,10 @@ try:
except:
snip.rv = 'element'
`}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -366,11 +221,9 @@ try:
snip.rv = wmatch.group(1).lower()
except:
snip.rv = 'element'
`},${2:i}| ${3:# TODO} }$0
`},${2:i}| $0 }
endsnippet
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p
element_name = match.group(1).lstrip('$@')
@ -381,128 +234,94 @@ try:
except:
snip.rv = 'element'
`},${2:i}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} }
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 }
endsnippet
snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r
`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}|
${0:# TODO}
$0
end
endsnippet
snippet "(\S+)\.sub" ".sub(<expression>) { <block> }" r
`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} }
endsnippet
snippet "(\S+)\.gsub" ".gsub(<expression>) { <block> }" r
`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} }
endsnippet
snippet "(\S+)\.index" ".index { |item| <block> }" r
`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} }
endsnippet
snippet "(\S+)\.Index" ".index do |item| ... end" r
`!p snip.rv=match.group(1)`.index do |${1:item}|
${0:block}
end
endsnippet
snippet do "do |<key>| ... end" i
do |${1:args}|
$0
end
endsnippet
snippet Do "do ... end" i
do
$0
end
endsnippet
snippet until "until <expression> ... end"
until ${1:expression}
${0:# TODO}
$0
end
endsnippet
snippet Until "begin ... end until <expression>"
begin
${0:# TODO}
$0
end until ${1:expression}
endsnippet
snippet while "while <expression> ... end"
while ${1:expression}
${0:# TODO}
$0
end
endsnippet
snippet While "begin ... end while <expression>"
begin
${0:# TODO}
$0
end while ${1:expression}
endsnippet
snippet "\b(r|attr)" "attr_reader :<attr_names>" r
attr_reader :${0:attr_names}
endsnippet
snippet "\b(w|attr)" "attr_writer :<attr_names>" r
attr_writer :${0:attr_names}
endsnippet
snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r
attr_accessor :${0:attr_names}
endsnippet
snippet begin "begin ... rescue ... end"
begin
${1:# TODO}
$1
rescue
${0:# TODO}
$0
end
endsnippet
snippet begin "begin ... rescue ... else ... ensure ... end"
begin
${1:# Raise exception}
@ -517,8 +336,6 @@ ensure
end
endsnippet
snippet rescue
rescue Exception => e
puts e.message
@ -526,8 +343,6 @@ rescue Exception => e
${0:# Rescue}
endsnippet
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
case ${1:variable}
when ${2:expression}
@ -535,32 +350,24 @@ $0
end
endsnippet
snippet alias "alias :<new_name> :<old_name>"
alias :${1:new_name} :${2:old_name}
endsnippet
snippet class "class <class_name> def initialize ... end end"
class ${1:class_name}
def initialize ${2:*args}
def initialize(${2:*args})
$0
end
end
endsnippet
snippet module "module"
module ${1:module_name}
$0
end
endsnippet
snippet ###
=begin
$0

View File

@ -10,43 +10,6 @@ fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
}
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
print!("${1}"${2/..*/, /}${2});
endsnippet
@ -67,130 +30,22 @@ macro_rules! ${1:name} (
)
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
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
${VISUAL}${0}
}
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
for ${1:i} in ${2:range(0u, 10)} {
for ${1:i} in ${2:${3:0us}..${4:10}} {
${VISUAL}${0}
}
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"
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
endsnippet
snippet fixme "FIXME comment"
// FIXME: ${1}
endsnippet
snippet st "Struct" b
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
${VISUAL}${0}
@ -211,42 +66,4 @@ impl $1 {
}
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:

View File

@ -14,6 +14,17 @@ $0${2/((?<=.)c|l|r)|./(?1: & )/g}
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
endsnippet
snippet table "Table environment" b
\begin{table}[${1:htpb}]
\centering
\caption{${2:caption}}
\label{tab:${3:label}}
\begin{${4:t}${4/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${5:c}}
$0${5/((?<=.)c|l|r)|./(?1: & )/g}
\end{$4${4/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
\end{table}
endsnippet
snippet fig "Figure environment" b
\begin{figure}[${2:htpb}]
\centering

View File

@ -15,7 +15,7 @@ snippet lorem
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
snippet GPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -33,7 +33,7 @@ snippet GPL2
${0}
snippet LGPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@ -51,7 +51,7 @@ snippet LGPL2
${0}
snippet GPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -69,7 +69,7 @@ snippet GPL3
${0}
snippet LGPL3
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@ -87,7 +87,7 @@ snippet LGPL3
${0}
snippet AGPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@ -102,10 +102,19 @@ snippet AGPL3
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/>.
${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}
snippet BSD2
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -135,7 +144,7 @@ snippet BSD2
${0}
snippet BSD3
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -163,7 +172,7 @@ snippet BSD3
${0}
snippet BSD4
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -194,7 +203,7 @@ snippet BSD4
${0}
snippet MIT
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
@ -217,7 +226,7 @@ snippet MIT
${0}
snippet APACHE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Copyright `strftime("%Y")` ${2:`g:snips_author`}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -233,21 +242,20 @@ snippet APACHE
${0}
snippet BEERWARE
${2:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${3:copyright holder}
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:`g:snips_author`}
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
${1:`g:snips_author`} 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
this stuff is worth it, you can buy me a beer or coffee in return
${0}
snippet WTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright `strftime("%Y")` ${0:copyright holder}
Copyright `strftime("%Y")` ${0:`g:snips_author`}
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
@ -257,3 +265,11 @@ snippet WTFPL
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
${0}
snippet MPL2
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
file, You can obtain one at http://mozilla.org/MPL/2.0/.
${0}

View File

@ -75,10 +75,6 @@ snippet do
do {
${0}
} while (${1:cond})
snippet wh
while ${1:cond}{
${0}
}
snippet for enumerate names
for (${1:var} in ${2:object}){
${0}

View File

@ -215,41 +215,3 @@ snippet getl Ada.Text_IO.Get_Line
snippet newline Ada.Text_IO.New_Line
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}

View 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

View File

@ -1,76 +1,73 @@
snippet comm
(comment
${0}
)
${0})
snippet condp
(condp ${1:pred} ${2:expr}
${0})
${0})
snippet def
(def ${0})
snippet defm
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
${0})
${0})
snippet defmm
(defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn})
snippet defma
(defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn})
snippet defn
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
${0})
${0})
snippet defp
(defprotocol ${1:name}
${0})
${0})
snippet defr
(defrecord ${1:name} [${2:fields}]
${3:protocol}
${0})
${3:protocol}
${0})
snippet deft
(deftest ${1:name}
(is (= ${2:assertion})))
${0})
(is (= ${0:assertion})))
snippet is
(is (= ${1} ${0}))
snippet defty
(deftype ${1:Name} [${2:fields}]
${3:Protocol}
${0})
${3:Protocol}
${0})
snippet doseq
(doseq [${1:elem} ${2:coll}]
${0})
${0})
snippet fn
(fn [${1:arg-list}] ${0})
snippet if
(if ${1:test-expr}
${2:then-expr}
${0:else-expr})
${2:then-expr}
${0:else-expr})
snippet if-let
(if-let [${1:result} ${2:test-expr}]
(${3:then-expr} $1)
(${0:else-expr}))
snippet imp
(:import [${1:package}])
& {:keys [${1:keys}] :or {${0:defaults}}}
& {:keys [${1:keys}] :or {${0:defaults}}}
snippet let
(let [${1:name} ${2:expr}]
${0})
snippet letfn
(letfn [(${1:name) [${2:args}]
${0})])
(letfn [(${1:name}) [${2:args}]
${0})])
snippet map
(map ${1:func} ${0:coll})
snippet mapl
(map #(${1:lambda}) ${0:coll})
snippet met
(${1:name} [${2:this} ${3:args}]
${0})
${0})
snippet ns
(ns ${1:name}
${0})
(ns ${0:name})
snippet dotimes
(dotimes [_ 10]
(time
(dotimes [_ ${1:times}]
${0})))
(time
(dotimes [_ ${1:times}]
${0})))
snippet pmethod
(${1:name} [${2:this} ${0:args}])
snippet refer

View File

@ -0,0 +1,218 @@
# Based on nebjak/snipmate.vim/snippets/php.snippets
# Controller
snippet ci_controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName} extends CI_Controller
{
function __construct()
{
parent::__construct();
${2:// code...}
}
function ${3:index}()
{
${4:// code...}
}
}
# Model
snippet ci_model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
function __construct()
{
parent::__construct();
${2:// code...}
}
}
snippet ci_model_crudl
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
private $table = '${2:table_name}';
function __construct()
{
parent::__construct();
${3:// code...}
}
// public create(data) {{{
/**
* create
*
* @param mixed $data
* @access public
* @return boolean
*/
public function create($data)
{
if($this->db->insert($table, $data))
return true;
else
return false;
}
// }}}
// public read(id) {{{
/**
* read
*
* @param int $id
* @access public
* @return boolean
*/
public function read($id)
{
return $this->db->get_where($table, array('id', $id))->result();
}
// }}}
// public update(id,data) {{{
/**
* update
*
* @param int $id
* @param mixed $data
* @access public
* @return boolean
*/
public function update($id, $data)
{
if($this->db->update($table, $data, array('id' => $id)))
return true;
else
return false;
}
// }}}
// public delete(id) {{{
/**
* delete
*
* @param mixed $id (int o array of int)
* @access public
* @return boolean
*/
public function delete($id)
{
if(is_array($id))
{
$this->db->trans_start();
foreach($id as $elem)
$this->db->delete($table, array('id' => $elem));
$this->db->trans_complete();
}
else
{
if($this->db->delete($table, array('id' => $id)))
return true;
else
return false;
}
}
// }}}
// public listRows(limit=null,offset=0) {{{
/**
* listRows
*
* @param int $limit
* @param int $offset
* @access public
* @return boolean
*/
public function listRows($limit = null, $offset = 0)
{
if(!is_null($limit))
$this->db->limit($limit, $offset);
return $this->db->get($table)->result();
}
// }}}
}
# Load view
snippet ci_load-view
$this->load->view("${1:view_name}", $${2:data});${3}
# DB Class snippets
snippet ci_db-insert
$this->db->insert("${1:table}", $${2:data});${3}
snippet ci_db-select
$this->db->select("${1:id, ...}");${2}
snippet ci_db-from
$this->db->from("${1:table}");${2}
snippet ci_db-join
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
snippet ci_db-where
$this->db->where("${1:key}", "${2:value}");${3}
snippet ci_db-or_where
$this->db->or_where("${1:key}", "${2:value}");${3}
snippet ci_db-get
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
snippet ci_db-delete
$this->db->delete("${1:table}", "${2:where}");${3}
snippet ci_db-update
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
# Input Class snippets
snippet ci_input-post
$this->input->post("${1:index}");${2}
snippet ci_input-get
$this->input->get("${1:index}");${2}
snippet ci_input-cookie
$this->input->cookie("${1:index}");${2}
snippet ci_input-server
$this->input->server("${1:index}");${2}
snippet ci_input-user_agent
$this->input->user_agent();${1}
snippet ci_input-is_ajax_request
$this->input->is_ajax_request();${1}
snippet ci_input-is_cli_request
$this->input->is_cli_request();${1}
# Form Validation Class and Form Helper snippets
snippet ci_form_validation-set_rules
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
snippet ci_form_open
form_open("${1:action}");${2}
snippet ci_form_open_multipart
form_open_multipart("${1:action}");${2}
snippet ci_form_hidden
form_hidden("${1:name}", "${2:value}");${3}
snippet ci_form_input
form_input("${1:name}", "${2:value}");${3}
snippet ci_form_password
form_password("${1:name}", "${2:value}");${3}
snippet ci_form_upload
form_upload("${1:name}", "${2:value}");${3}
snippet ci_form_textarea
form_textarea("${1:name}", "${2:value}");${3}
snippet ci_form_dropdown
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
snippet ci_form_checkbox
form_checkbox("${1:name}", "${2:value}");${3}
snippet ci_form_radio
form_radio("${1:name}", "${2:value}");${3}
snippet ci_form_submit
form_submit("${1:name}", "${2:value}");${3}
snippet ci_form_reset
form_reset("${1:name}", "${2:value}");${3}
snippet ci_form_button
form_button("${1:name}", "${2:value}");${3}
snippet ci_form_label
form_label("${1:label text}", "${2:id}");${3}
snippet ci_form_close
form_close();${1}
snippet ci_validation_errors
validation_errors();${1}
# Session Class snippets
snippet ci_session_userdata
$this->session->userdata("${1:item}");${2}
snippet ci_session_set_userdata
$this->session->set_userdata($${1:array});${2}
snippet ci_session_flashdata
$this->session->flashdata("${1:item}");${2}
snippet ci_session_set_flashdata
$this->session->set_flashdata("${1:item}", "${2:value}");${3}

View File

@ -0,0 +1,93 @@
snippet impl
implicit none
$0
snippet prog
program ${1:main}
$0
end program $1
snippet mod
module ${1:modulename}
$0
end module $1
snippet proc
procedure ${1:name}
${0}
end procedure $1
snippet iface
interface ${1:name}
${0}
end interface $1
snippet doc
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
! File: ${2:`vim_snippets#Filename('$1')`}
! Author: `g:snips_author`
! Email: `g:snips_email`
! Github: `g:snips_github`
! Description: $1
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
$0
# Variables definitions
# Boolean
snippet bool
logical :: $0
# Integer
snippet int
integer :: $0
snippet real
real :: $0
# Double Precision
snippet double
double precision :: $0
# Char
snippet str
character(len=${1:*}) :: ${0:}
# Types
snippet type
type(${1:name})
$0
end type
snippet const
${1:type}, parameter :: $2 = $0
snippet arr
${1:type}, allocatable, dimension(${2::}) :: $0
snippet intent
${1:type}, intent(inout) :: $0
# Array
snippet /
(/ $1 /) ${2:,&} $0
snippet if
if (${1:condition}) then
$2
end if
snippet case
select case (${1:expr})
case ($2)
case default
$3
end select $0
snippet do
do ${1:i} = ${2:start},${3:end}, ${4:incr}
$4
end do
snippet dow
do while (${1:condition})
$2
end do
snippet sub
subroutine ${1:name}($2)
$0
end subroutine $1
snippet func
function ${1:name}($2) result($3)
$0
end function $1
snippet pr
write(*,*) $0
snippet read
read( unit = ${1:fp}, file = ${2:filename}${3:, iostat = IERR }) $0
snippet write
write( unit = ${1:fp}, file = ${2:filename}${3:, iostat = IERR }) $0
snippet open
open (unit = ${1:fp}, file = ${2:filename}, status = unknown${3:, iostat = IERR }) $0
snippet close
close ( unit = ${1:fp} ) $0

View File

@ -148,8 +148,8 @@ snippet fun
${0}
# function on receiver
snippet fum
func (self ${1:type}) ${2:funcName}(${3}) ${4:error} {
${5}
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
${6}
}
${0}
# log printf
@ -173,6 +173,9 @@ snippet main
# new
snippet nw
new(${0:type})
# package
snippet pa
package ${1:main}
# panic
snippet pn
panic("${0:msg}")

View File

@ -2,6 +2,8 @@ snippet lang
{-# LANGUAGE ${0:OverloadedStrings} #-}
snippet haddock
{-# OPTIONS_HADDOCK ${0:hide} #-}
snippet inline
{-# INLINE ${0:name} #-}
snippet info
-- |
-- Module : ${1:Module.Namespace}

View File

@ -462,8 +462,8 @@ snippet html5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2:link}
</head>
@ -475,8 +475,8 @@ snippet html5l
<!DOCTYPE html>
<html lang="${1:es}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${3:link}
</head>
@ -702,6 +702,10 @@ snippet output
<output>${0}</output>
snippet p
<p>${0}</p>
snippet p.
<p class="${1}">${0}</p>
snippet p#
<p id="${1}">${0}</p>
snippet param
<param name="${1}" value="${2}" />
snippet pre

View File

@ -2,26 +2,75 @@
# Includes octopress (http://octopress.org/) snippets
snippet [
[${1:text}](http://${2:address} "${0:title}")
snippet [*
[${1:link}](${2:`@*`} "${3:title}")
# The suffix `c` stands for "Clipboard".
snippet [
[${1:text}](http://${2:address})
snippet [*
[${1:link}](${2:`@*`})
snippet [c
[${1:link}](${2:`@+`})
snippet ["
[${1:text}](http://${2:address} "${3:title}")
snippet ["*
[${1:link}](${2:`@*`} "${3:title}")
snippet ["c
[${1:link}](${2:`@+`} "${3:title}")
snippet [:
[${1:id}]: http://${2:url} "${0:title}"
[${1:id}]: http://${2:url}
snippet [:*
[${1:id}]: ${2:`@*`} "${0:title}"
[${1:id}]: ${2:`@*`}
snippet [:c
[${1:id}]: ${2:`@+`}
snippet [:"
[${1:id}]: http://${2:url} "${3:title}"
snippet [:"*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet [:"c
[${1:id}]: ${2:`@+`} "${3:title}"
snippet ![
![${1:alttext}](${2:/images/image.jpg} "${0:title}")
![${1:alttext}](${2:/images/image.jpg})
snippet ![*
![${1:alt}](${2:`@*`})
snippet ![c
![${1:alt}](${2:`@+`})
snippet !["
![${1:alttext}](${2:/images/image.jpg} "${3:title}")
snippet !["*
![${1:alt}](${2:`@*`} "${3:title}")
snippet !["c
![${1:alt}](${2:`@+`} "${3:title}")
snippet ![:
![${1:id}]: ${2:url} "${0:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${0:title}"
![${1:id}]: ${2:url}
snippet ![:*
![${1:id}]: ${2:`@*`}
snippet ![:"
![${1:id}]: ${2:url} "${3:title}"
snippet ![:"*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet ![:"c
![${1:id}]: ${2:`@+`} "${3:title}"
snippet <
<http://${1:url}>
snippet <*
<`@*`>
snippet <c
<`@+`>
snippet **
**${1:bold}**
snippet __
__${1:bold}__
snippet ===
`repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
@ -46,15 +95,16 @@ snippet blockquote-link
${0:quote}
{% endblockquote %}
snippet bt-codeblock-short
```
${0:code_snippet}
```
snippet ```
\`\`\`
${1:code}
\`\`\`
snippet bt-codeblock-full
``` ${1:language} ${2:title} ${3:URL} ${4:link_text}
${0:code_snippet}
```
# Language.
snippet ```l
\`\`\`${1:language}
${2:code}
\`\`\`
snippet codeblock-short
{% codeblock %}

View File

@ -129,9 +129,16 @@ snippet pdb
# ipython debugger (ipdb)
snippet ipdb
import ipdb; ipdb.set_trace()
# embed ipython itself
snippet iem
import IPython; IPython.embed()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.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)
snippet pudb
import pudb; pudb.set_trace()
@ -208,3 +215,9 @@ snippet kwg
self.${1:var_name} = kwargs.get('$1', ${2:None})
snippet lkwg
${1:var_name} = kwargs.get('$1', ${2:None})
snippet args
*args${1:,}${0}
snippet kwargs
**kwargs${1:,}${0}
snippet akw
*args, **kwargs${1:,}${0}

View File

@ -73,10 +73,32 @@ snippet ife
snippet eif
elsif ${1:condition}
${0}
snippet ifee
if ${1:condition}
$2
elsif ${3:condition}
$4
else
$0
end
snippet unless
unless ${1:condition}
${0}
end
snippet unlesse
unless ${1:condition}
$2
else
$0
end
snippet unlesee
unless ${1:condition}
$2
elsif ${3:condition}
$4
else
$0
end
snippet wh
while ${1:condition}
${0}

View File

@ -4,11 +4,7 @@
# Functions
snippet fn
fn ${1:function_name}(${2}) {
${0}
}
snippet fn-
fn ${1:function_name}(${2}) -> ${3} {
fn ${1:function_name}(${2})${3} {
${0}
}
snippet test
@ -16,6 +12,13 @@ snippet test
fn ${1:test_function_name}() {
${0}
}
snippet bench "Bench function" b
#[bench]
fn ${1:bench_function_name}(b: &mut test::Bencher) {
b.iter(|| {
${0}
})
}
snippet new
pub fn new(${2}) -> ${1:Name} {
${0}return $1 { ${3} };
@ -25,7 +28,9 @@ snippet main
${0}
}
snippet let
let ${1:name}${3} = ${2};
let ${1:name: type} = ${2};
snippet let
let mut ${1:name: type} = ${2};
snippet pln
println!("${1}");
snippet pln,
@ -52,25 +57,48 @@ snippet allow
#[allow(${1:unused_variable})]
snippet feat
#![feature(${1:macro_rules})]
snippet der "#[deriving(..)]" b
#[deriving(${1:Show})]
snippet attr "#[..]" b
#[${1:inline}]
# Common types
snippet opt
Option<${1:int}>
snippet res
Result<${1:~str}, ${2:()}>
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}
}
snippet mat
match ${1} {
${2} => ${3},
}
snippet loop "loop {}" b
loop {
${0}
}
snippet while
while ${1:condition} {
${0}
}
snippet for
for ${1:i} in ${2:range(0u, 10)} {
for ${1:i} in ${2:0u..10} {
${0}
}
snippet spawn
@ -83,12 +111,19 @@ snippet duplex
let (${1:from_child}, ${2:to_child}) = sync::duplex();
# TODO commenting
snippet todo
// [TODO]: ${1:Description}
// [TODO]: ${0:Description}
snippet fixme "FIXME comment"
// FIXME: $0
# Struct
snippet st
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
snippet stn
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
impl $1 {
pub fn new(${2}) -> $1 {
@ -97,9 +132,11 @@ snippet st
};
}
}
snippet typ
type ${1:NewName} = $0;
# Enum
snippet enum
enum ${1:enum_name} {
enum ${1:Name} {
${0},
}
# Impl
@ -122,4 +159,4 @@ snippet trait
snippet ss
static ${1}: &'static str = "${0}";
snippet stat
static ${1}: ${2:uint} = ${0};
static ${1}: ${2:usize} = ${0};

View File

@ -298,19 +298,25 @@ snippet scalatest
${0:import org.scalatest.FunSuite}
#assert
snippet assert
assert(${1:a}==${0:b})
assert(${1:a} === ${0:b})
#ensuring(p 296)
snippet ensuring
ifel ensuring(${1:a}==${0:b})
#expect
snippet expect
expect(${0:what}) {
expect(${1:what}) {
${0}
}
#intercept
snippet intercept
intercept[${0:IllegalArgumentException}] {
intercept[${1:IllegalArgumentException}] {
${0}
}
#test
snippet test
test("${0:description}") {
test("${1:description}") {
${0}
}
#suite
snippet suite
class ${0:name} extends Suite {

View File

@ -18,8 +18,14 @@ snippet if
@if ${1:condition} {
${0}
}
snippet else
@else ${1:condition} {
snippet ife
@if ${1:condition} {
${2}
} @else {
${0}
}
snippet eif
@else if ${1:condition} {
${0}
}
snippet for

File diff suppressed because it is too large Load Diff