mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vim plugins
This commit is contained in:
@ -5,8 +5,8 @@ Snipmate & UltiSnip Snippets
|
||||
|
||||
This repository contains snippets files for various programming languages.
|
||||
|
||||
It is community-maintained and many people have contributed snippet files and other
|
||||
improvements already.
|
||||
It is community-maintained and many people have contributed snippet files and
|
||||
other improvements already.
|
||||
|
||||
Contents
|
||||
========
|
||||
@ -82,6 +82,7 @@ to maintain snippets for a language, please get in touch.
|
||||
* Markdown - [honza](http://github.com/honza)
|
||||
* Ruby - [taq](http://github.com/taq)
|
||||
* PHP - [chrisyue](http://github.com/chrisyue)
|
||||
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
|
||||
|
||||
Contributing notes
|
||||
------------------
|
||||
|
@ -14,9 +14,9 @@ def textmate_var(var, snip):
|
||||
lookup = dict(
|
||||
TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '),
|
||||
TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'),
|
||||
TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', ' %>'),
|
||||
TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '),
|
||||
TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'),
|
||||
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = 'end'
|
||||
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>'
|
||||
)
|
||||
|
||||
snip.rv = lookup[var]
|
||||
|
@ -6,33 +6,33 @@ snippet forindo
|
||||
# Array comprehension
|
||||
snippet fora
|
||||
for ${1:name} in ${2:array}
|
||||
${3:// body...}
|
||||
${3:# body...}
|
||||
# Object comprehension
|
||||
snippet foro
|
||||
for ${1:key}, ${2:value} of ${3:object}
|
||||
${4:// body...}
|
||||
${4:# body...}
|
||||
# Range comprehension (inclusive)
|
||||
snippet forr
|
||||
for ${1:name} in [${2:start}..${3:finish}]
|
||||
${4:// body...}
|
||||
${4:# body...}
|
||||
snippet forrb
|
||||
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
|
||||
${5:// body...}
|
||||
${5:# body...}
|
||||
# Range comprehension (exclusive)
|
||||
snippet forrex
|
||||
for ${1:name} in [${2:start}...${3:finish}]
|
||||
${4:// body...}
|
||||
${4:# body...}
|
||||
snippet forrexb
|
||||
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
|
||||
${5:// body...}
|
||||
${5:# body...}
|
||||
# Function
|
||||
snippet fun
|
||||
(${1:args}) ->
|
||||
${2:// body...}
|
||||
${2:# body...}
|
||||
# Function (bound)
|
||||
snippet bfun
|
||||
(${1:args}) =>
|
||||
${2:// body...}
|
||||
${2:# body...}
|
||||
# Class
|
||||
snippet cla class ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
@ -55,17 +55,17 @@ snippet cla class .. extends .. constructor: ..
|
||||
# If
|
||||
snippet if
|
||||
if ${1:condition}
|
||||
${2:// body...}
|
||||
${2:# body...}
|
||||
# If __ Else
|
||||
snippet ife
|
||||
if ${1:condition}
|
||||
${2:// body...}
|
||||
${2:# body...}
|
||||
else
|
||||
${3:// body...}
|
||||
${3:# body...}
|
||||
# Else if
|
||||
snippet elif
|
||||
else if ${1:condition}
|
||||
${2:// body...}
|
||||
${2:# body...}
|
||||
# Ternary If
|
||||
snippet ifte
|
||||
if ${1:condition} then ${2:value} else ${3:other}
|
||||
@ -76,7 +76,7 @@ snippet unl
|
||||
snippet swi
|
||||
switch ${1:object}
|
||||
when ${2:value}
|
||||
${3:// body...}
|
||||
${3:# body...}
|
||||
|
||||
# Log
|
||||
snippet log
|
||||
|
@ -50,15 +50,15 @@ snippet cs
|
||||
snippet ct
|
||||
<%= content_tag '${1:DIV}', ${2:content}${3:,options} %>
|
||||
snippet ff
|
||||
<% form_for @${1:model} do |f| %>
|
||||
<%= form_for @${1:model} do |f| %>
|
||||
${2}
|
||||
<% end %>
|
||||
snippet ffcb
|
||||
<%= ${1:f}.check_box :${2:attribute} %>
|
||||
snippet ffe
|
||||
<% error_messages_for :${1:model} %>
|
||||
|
||||
<% form_for @${2:model} do |f| %>
|
||||
|
||||
<%= form_for @${2:model} do |f| %>
|
||||
${3}
|
||||
<% end %>
|
||||
snippet ffff
|
||||
@ -78,7 +78,7 @@ snippet ffta
|
||||
snippet fftf
|
||||
<%= ${1:f}.text_field :${2:attribute} %>
|
||||
snippet fields
|
||||
<% fields_for :${1:model}, @$1 do |${2:f}| %>
|
||||
<%= fields_for :${1:model}, @$1 do |${2:f}| %>
|
||||
${3}
|
||||
<% end %>
|
||||
snippet i18
|
||||
|
@ -9,6 +9,18 @@ snippet <?e
|
||||
# this one is for php5.4
|
||||
snippet <?=
|
||||
<?=${1}?>
|
||||
snippet ?=
|
||||
<?= ${1} ?>
|
||||
snippet ?
|
||||
<?php ${1} ?>
|
||||
snippet ?f
|
||||
<?php foreach ($${1:vars} as $${2:$var}): ?>
|
||||
${3}
|
||||
<?php endforeach ?>
|
||||
snippet ?i
|
||||
<?php if ($${1:var}): ?>
|
||||
${2}
|
||||
<?php endif ?>
|
||||
snippet ns
|
||||
namespace ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
@ -16,9 +28,9 @@ snippet use
|
||||
use ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
snippet c
|
||||
${1:abstract }class ${2:`Filename()`}
|
||||
class ${1:`Filename()`}
|
||||
{
|
||||
${3}
|
||||
${2}
|
||||
}
|
||||
snippet i
|
||||
interface ${1:`Filename()`}
|
||||
@ -34,12 +46,12 @@ snippet f
|
||||
}
|
||||
# method
|
||||
snippet m
|
||||
${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})
|
||||
${1:protected} function ${2:foo}()
|
||||
{
|
||||
${7}
|
||||
${3}
|
||||
}
|
||||
# setter method
|
||||
snippet sm
|
||||
snippet sm
|
||||
/**
|
||||
* Sets the value of ${1:foo}
|
||||
*
|
||||
@ -92,7 +104,7 @@ snippet S
|
||||
$_SERVER['${1:variable}']${2}
|
||||
snippet SS
|
||||
$_SESSION['${1:variable}']${2}
|
||||
|
||||
|
||||
# the following are old ones
|
||||
snippet inc
|
||||
include '${1:file}';${2}
|
||||
@ -193,7 +205,7 @@ snippet doc_h
|
||||
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
|
||||
* @package ${5:default}
|
||||
*/
|
||||
|
||||
|
||||
# Interface
|
||||
snippet interface
|
||||
/**
|
||||
@ -332,8 +344,8 @@ snippet vd
|
||||
snippet vdd
|
||||
var_dump(${1}); die(${2:});
|
||||
snippet http_redirect
|
||||
header ("HTTP/1.1 301 Moved Permanently");
|
||||
header ("Location: ".URL);
|
||||
header ("HTTP/1.1 301 Moved Permanently");
|
||||
header ("Location: ".URL);
|
||||
exit();
|
||||
# Getters & Setters
|
||||
snippet gs
|
||||
@ -363,7 +375,7 @@ snippet gs
|
||||
snippet ags
|
||||
/**
|
||||
* ${1:description}
|
||||
*
|
||||
*
|
||||
* @${7}
|
||||
*/
|
||||
${2:protected} $${3:foo};
|
||||
@ -382,3 +394,12 @@ snippet rett
|
||||
return true;
|
||||
snippet retf
|
||||
return false;
|
||||
snippet am
|
||||
$${1:foo} = array_map(function($${2:v}) {
|
||||
${3}
|
||||
return $$2;
|
||||
}, $$1);
|
||||
snippet aw
|
||||
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
|
||||
$$2 = ${4};
|
||||
});
|
||||
|
Reference in New Issue
Block a user