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

Updated all the plugins. Removed powerline. Added vim-airline (replacement for powerline). Added vim-fugitive.

This commit is contained in:
amix
2013-11-16 19:45:48 +00:00
parent 351979d3e0
commit 86f4456be1
239 changed files with 14942 additions and 8068 deletions

View File

@ -0,0 +1,168 @@
# Credit: @iurifg
snippet do
do
${1}
end
endsnippet
snippet if "if .. do .. end"
if ${1:condition} do
${2:expression}
end
endsnippet
snippet if "if .. do: .."
if ${1:condition}, do: ${2:expression}
endsnippet
snippet ife "if .. do .. else .. end"
if ${1:condition} do
${2:expression}
else
${3:expression}
end
endsnippet
snippet ife "if .. do: .. else:"
if ${1:condition}, do: ${2}, else: ${3}
endsnippet
snippet unless "unless .. do .. end"
unless ${1} do
${2}
end
endsnippet
snippet unless "unless .. do: .."
unless ${1:condition}, do: ${2}
endsnippet
snippet unlesse "unless .. do .. else .. end"
unless ${1:condition} do
${2}
else
${3}
end
endsnippet
snippet unlesse "unless .. do: .. else:"
unless ${1:condition}, do: ${2}, else: ${3}
endsnippet
snippet cond
"cond do"
${1} ->
${2}
end
endsnippet
snippet case
case ${1} do
${2} ->
${3}
end
endsnippet
snippet def
def ${1:name} do
${2}
end
endsnippet
snippet defin "def function(n), do: n"
def ${1:name}, do: ${2}
endsnippet
snippet defg
def ${1:name} when ${2:guard-condition} do
${3}
end
endsnippet
snippet defim
defimpl ${1:protocol_name}, for: ${2:data_type} do
${3}
end
endsnippet
snippet defma
defmacro ${1:name} do
${2}
end
endsnippet
snippet defmo
defmodule ${1:module_name} do
${2}
end
endsnippet
snippet defp
defp ${1:name} do
${2}
end
endsnippet
snippet defpr
defprotocol ${1:name}, [${2:function}]
endsnippet
snippet defr
defrecord ${1:record_name}, ${2:fields}
endsnippet
snippet doc
@doc """
${1}
"""
endsnippet
snippet fn
fn(${1:args}) -> ${2} end
endsnippet
snippet fun
function do
${1}
end
endsnippet
snippet mdoc
@moduledoc """
${1}
"""
endsnippet
snippet rec
receive do
${1} ->
${2}
end
endsnippet
snippet req
require ${1:module_name}
endsnippet
snippet imp
import ${1:module_name}
endsnippet
snippet ali "alias old-module to shorthand"
alias ${1:module_name}
endsnippet
snippet test
test "${1:test_name}" do
${2}
end
endsnippet
snippet try "try .. rescue .. end"
try do
${1}
rescue
${2} -> ${3}
end
endsnippet

View File

@ -281,16 +281,16 @@ snippet html5 "HTML5 Template"
<!DOCTYPE html>
<html>
<head>
<title>${1}</title>
<meta charset="utf-8" />
<title>${1}</title>
<meta charset="utf-8">
</head>
<body>
<header>
${2}
</header>
<footer>
${4}
</footer>
<header>
${2}
</header>
<footer>
${4}
</footer>
</body>
</html>
endsnippet

View File

@ -0,0 +1,88 @@
###################################################################
# Ember snippets #
###################################################################
# Application
snippet eapp "App.Name = Ember.Application.create({});"
${1:App.Name} = Ember.Application.create({});
endsnippet
# Models
snippet emod "App.ModelName = Ember.Model.extend({...});"
${1:model_name} = Ember.Model.extend({
${0://Properties here...}
});
endsnippet
# View
snippet eview "App.ViewName = Ember.Model.extend({...});"
${1:view_name} = Ember.View.extend({
${0://Properties here...}
});
endsnippet
# Controller
snippet econtroller "App.ControllerName = Ember.Model.extend({...});"
${1:controller_name} = Ember.ObjectController.extend({
${0://Properties here...}
});
endsnippet
# Route
snippet eroute "App.RouteName = Ember.Route.extend({...});"
${1:route_name} = Ember.Route.extend({
${0://Properties here...}
});
endsnippet
snippet eview "App.ViewName = Ember.Model.create({...});"
${1:view_name} = Ember.View.create({
${0://Properties here...}
});
endsnippet
# Object
snippet eobj "App.ObjectName = Ember.Object.extend({...});"
${1:object_name} = Ember.Object.create({
${0://Properties here...}
});
endsnippet
# Mixin
snippet emix "App.MixinName = Ember.Model.extend({...});"
${1:view_name} = Ember.Mixin.create({
${0://Properties here...}
});
endsnippet
# Ember getter and setter
snippet eget "this.get('property');"
${1:this}.get('${2:property}');
endsnippet
snippet eset "this.set('property', value);"
${1:this}.set('${2:property}', ${3:value});
endsnippet
# Computer properties
snippet cpro "property_name: function() {...}.property(),"
${1:property_name}: function() {
${0://body...}
}.property('${3:argumenet}'),
endsnippet
snippet cpro ": function() {...}.property('property'),"
${1:property_name}: function() {
${0://body...}
}.property(),
endsnippet
# Observes
snippet proo "property_name: function() {...}.property()"
${1:property_name}: function() {
${0://body...}
}.observes('${3:property}'),
endsnippet
# vim:ft=snippets:

View File

@ -59,7 +59,7 @@ if ${1} then
${2}
endsnippet
snippet while "while"
snippet wh "while"
while ${1} do
${2}
done

View File

@ -117,7 +117,7 @@ unless ($1) {
endsnippet
snippet while "while"
snippet wh "while"
while ($1) {
${2:# body...}
}

View File

@ -18,7 +18,7 @@ if m:
endsnippet
snippet nc "php namespace and class" b
snippet nc "php namespace and class or interface" b
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
@ -29,7 +29,18 @@ if m:
/**
* ${3:@author `whoami`}${4}
*/
class ${2:`!p
`!p
m = re.search(r'Abstract', path)
if m:
snip.rv = 'abstract '
``!p
if re.search(r'Interface', path):
snip.rv = 'interface'
elif re.search(r'Trait', path):
snip.rv = 'trait'
else:
snip.rv = 'class'
` ${2:`!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
`}
{
@ -51,14 +62,15 @@ ${1:public} function __construct($2)
endsnippet
snippet sg "Setter and Getter" b
/**
* @var ${3:`!p snip.rv = t[2].capitalize()`}${4}
* @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`}
*
* ${4}
*/
${1:protected} $$2;
${1:protected} $${2};
public function set`!p snip.rv = t[2].capitalize()`(`!p
if re.match(r'[A-Z].*', t[3]):
public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p
if re.match(r'^(\\|[A-Z]).*', t[3]):
snip.rv = t[3] + ' '
else:
snip.rv = ''
@ -69,7 +81,7 @@ else:
return $this;
}
public function get`!p snip.rv = t[2].capitalize()`()
public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`()
{
return $this->$2;
}
@ -80,3 +92,17 @@ if (${1}) {
${2}
}
endsnippet
snippet ife "php ife" !b
if (${1}) {
${2}
} else {
}
endsnippet
snippet /** "php comment block" b
/**
* @${1}
*/
endsnippet

View File

@ -0,0 +1,30 @@
# sugguestion? report bugs?
# please go to https://github.com/chrisyue/vim-snippets/issues
snippet test "phpunit test class" b
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
/**
* @author `whoami`
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends \PHPUnit_Framework_TestCase
{
public function test${1}()
{
${2}
}
}
endsnippet
snippet exp "phpunit expects" i
expects($this->${1:once}())
->method('${2}')
->with($this->equalTo(${3})${4})
->will($this->returnValue(${5}));
endsnippet

View File

@ -1,3 +1,6 @@
# sugguestion? report bugs?
# go to https://github.com/chrisyue/vim-snippets/issues
snippet contr "symfony2 controller" b
namespace `!p
abspath = os.path.abspath(path)
@ -13,7 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* ${1:@author `whoami`}${2}
* ${1:@author `whoami`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -23,6 +26,18 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet act "symfony2 action" b
/**
* @Route("${3}", name="${4}")
* @Method({${5:"POST"}})
*/
public function ${1}Action(${2})
{
${6}
return $this->redirect($this->generateUrl('home', [], false));
}
endsnippet
snippet actt "symfony2 action and template" b
/**
* @Route("${3}", name="${4}")
* @Method({${5:"GET"}})
@ -32,7 +47,8 @@ public function ${1}Action(${2})
{
${6}
return [];
}
}`!p
abspath = os.path.abspath(path)`
endsnippet
snippet comm "symfony2 command" b
@ -50,7 +66,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* ${3:@author `whoami`}${4}
* ${3:@author `whoami`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -73,3 +89,149 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
}
}
endsnippet
snippet subs "symfony2 subscriber" b
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* ${1:@author `whoami`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` implements EventSubscriberInterface
{
public function __construct()
{
}
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents()
{
return [];
}
}
endsnippet
snippet transf "symfony2 form data transformer" b
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
/**
* ${3:@author `whoami`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` implements DataTransformerInterface
{
/**
* {@inheritDoc}
*/
public function transform(${1})
{
}
/**
* {@inheritDoc}
*/
public function reverseTransform(${2})
{
}
}
endsnippet
snippet ent "symfony2 doctrine entity" b
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Doctrine\ORM\Mapping as ORM;
/**
* ${3:@author `whoami`}
*
* @ORM\Entity()
* @ORM\Table(name="`!p
tmp = re.match(r'.*(?=\.)', fn).group()
tmp = re.sub(r'\B([A-Z])', r'_\1', tmp)
snip.rv = tmp.lower()
`")
*/
`!p
m = re.search(r'Abstract', path)
if m:
snip.rv = 'abstract '
`class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
`
{
/**
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
* @ORM\Id
*/
private $id;
}
endsnippet
snippet form "symfony2 form type" b
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* ${2:@author `whoami`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
/**
* {@inheritDoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults();
}
/**
* {@inheritDoc}
*/
public function getName()
{
return '${1}';
}
}
endsnippet

View File

@ -432,8 +432,8 @@ end
endsnippet
snippet dov "do |<key>| ... end" i
do |${0:v}|
$1
do |${1:v}|
$2
end
endsnippet
@ -455,7 +455,7 @@ endsnippet
snippet while "while <expression> ... end"
snippet wh "while <expression> ... end"
while ${1:expression}
${0}
end

View File

@ -79,7 +79,7 @@ until ${2:[[ ${1:condition} ]]}; do
done
endsnippet
snippet while "while ... (done)"
snippet wh "while ... (done)"
while ${2:[[ ${1:condition} ]]}; do
${0:#statements}
done

View File

@ -40,7 +40,7 @@ switch ${1:-exact} -- ${2:\$var} {
endsnippet
snippet while "while... (while)" b
snippet wh "while... (while)" b
while {${1}} {
${2}
}