mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -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:
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
260
sources_non_forked/vim-snippets/UltiSnips/php_laravel.snippets
Normal file
260
sources_non_forked/vim-snippets/UltiSnips/php_laravel.snippets
Normal 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
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user