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
2016-05-14 12:57:54 +01:00
parent 5f6aa8fe09
commit f343b66088
105 changed files with 2100 additions and 4902 deletions

View File

@ -36,6 +36,8 @@ endsnippet
#service service provider
snippet l_ssp "Laravel service provider for service" b
<?php
/*!
* \namespace $1
* \class $2
@ -62,6 +64,8 @@ endsnippet
#repository service provider
snippet l_rsp "Laravel service provider for repository" b
<?php
/*!
* \namespace $2
* \class $3
@ -100,6 +104,8 @@ endsnippet
#model
snippet l_md "Laravel simple model" b
<?php
/*!
* \namespace $1
* \class $2
@ -123,6 +129,8 @@ endsnippet
#abstract repository
snippet l_ar "Laravel abstract Repository" b
<?php
/*!
* \namespace $1
* \class $2
@ -189,6 +197,8 @@ endsnippet
#repository
snippet l_r "Laravel Repository" b
<?php
/*!
* \namespace $1
* \class $3
@ -207,6 +217,8 @@ endsnippet
#service
snippet l_s "Laravel Service" b
<?php
/*!
* \namespace $1
* \class $2
@ -233,6 +245,8 @@ endsnippet
#facade
snippet l_f "Laravel Facade" b
<?php
/*!
* \namespace $1
* \class $2

View File

@ -0,0 +1,38 @@
# Snippets for phpspec
priority -50
snippet spec "phpspec class" b
<?php
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
/**
* @author `!v g:snips_author`
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends ObjectBehavior
{
public function it${1:_does_something}()
{
$0
}
}
endsnippet
snippet it "phpspec function it..." b
public function it${1:_does_something}()
{
$0
}
endsnippet

View File

@ -3,15 +3,17 @@
priority -50
snippet test "phpunit test class" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
/**
* @author `whoami`
* @author `!v g:snips_author`
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()

View File

@ -4,15 +4,17 @@
priority -50
snippet classn "Basic class with namespace snippet" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
/**
* ${1:@author `whoami`}
* ${1:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -26,9 +28,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet contr "Symfony2 controller" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -40,7 +44,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* ${1:@author `whoami`}
* ${1:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -49,6 +53,18 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
}
endsnippet
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
}
endsnippet
snippet act "Symfony2 action" b
/**
* @Route("${3}", name="${4}")
@ -72,13 +88,15 @@ public function ${1}Action(${2})
${6}
return [];
}`!p
abspath = os.path.abspath(path)`
relpath = os.path.relpath(path)`
endsnippet
snippet comm "Symfony2 command" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -90,7 +108,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* ${3:@author `whoami`}
* ${3:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -113,9 +131,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet subs "Symfony2 subscriber" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -123,7 +143,7 @@ if m:
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* ${1:@author `whoami`}
* ${1:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -144,9 +164,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet transf "Symfony2 form data transformer" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -155,7 +177,7 @@ use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
/**
* ${3:@author `whoami`}
* ${3:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -178,9 +200,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet ent "Symfony2 doctrine entity" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -188,7 +212,7 @@ if m:
use Doctrine\ORM\Mapping as ORM;
/**
* ${3:@author `whoami`}
* ${3:@author `!v g:snips_author`}
*
* @ORM\Entity()
* @ORM\Table(name="`!p
@ -215,9 +239,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet form "Symfony2 form type" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -227,7 +253,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* ${2:@author `whoami`}
* ${2:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -259,9 +285,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet
snippet ev "Symfony2 event" b
<?php
namespace `!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
@ -269,7 +297,7 @@ if m:
use Symfony\Component\EventDispatcher\Event;
/**
* ${2:@author `whoami`}
* ${2:@author `!v g:snips_author`}
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()

View File

@ -11,6 +11,12 @@ snippet def "def"
define('${1:VARIABLE_NAME}', ${2:'definition'});${3}
endsnippet
snippet wh "while"
while (${1}) {
${0:${VISUAL}}
}
endsnippet
snippet do "do"
do {
${2:// code... }
@ -39,9 +45,9 @@ interface ${1:someClass}
} // END interface $1"
endsnippet
snippet else "else"
snippet el "else"
else {
${1:// code...}
${0:${VISUAL}}
}
endsnippet
@ -62,14 +68,14 @@ $_GET['${1}']${2}
endsnippet
snippet if "if"
if (${1:/* condition */}) {
${2:// code...}
if (${1}) {
${0:${VISUAL}}
}
endsnippet
snippet elif "elseif"
elseif (${1:/* condition */}) {
${2:// code...}
snippet eif "elseif"
elseif (${1}) {
${0:${VISUAL}}
}
endsnippet
@ -268,8 +274,8 @@ endsnippet
snippet ns "namespace declaration" b
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
@ -279,8 +285,8 @@ snippet class "Class declaration template" b
<?php
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
@ -298,8 +304,8 @@ snippet interface "Interface declaration template" b
<?php
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
@ -314,6 +320,24 @@ interface $1
}
endsnippet
snippet trait "Trait declaration template" b
<?php
namespace ${1:`!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
/**
* Trait ${1:`!p snip.rv=snip.basename`}
* @author ${2:`!v g:snips_author`}
*/
trait $1
{
}
endsnippet
snippet construct "__construct()" b
/**
@ -333,19 +357,6 @@ snippet pc "Dumb debug helper in cli"
var_export($1);$0
endsnippet
# Symfony 2 based snippets
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
}
endsnippet
snippet inheritdoc "@inheritdoc docblock"
/**
* {@inheritdoc}

View File

@ -245,6 +245,9 @@ def write_function_docstring(t, snip):
snip.rv += '\n' + snip.mkline('', indent='')
snip += triple_quotes(snip)
def get_dir_and_file_name(snip):
return os.getcwd().split(os.sep)[-1] + '.' + snip.basename
endglobal
########################################
@ -687,4 +690,18 @@ ${1:${VISUAL:doc}}
`!p snip.rv = triple_quotes(snip)`
endsnippet
snippet pmdoc "pocoo style module doc string" b
# -*- coding: utf-8 -*-
"""
`!p snip.rv = get_dir_and_file_name(snip)`
`!p snip.rv = '~' * len(get_dir_and_file_name(snip))`
${1:DESCRIPTION}
:copyright: (c) `date +%Y` by ${2:YOUR_NAME}.
:license: ${3:LICENSE_NAME}, see LICENSE for more details.
"""
$0
endsnippet
# vim:ft=snippets:

View File

@ -20,10 +20,28 @@ endsnippet
snippet if "twig if" b
{% if ${1} %}
${2}
${0:${VISUAL}}
{% endif %}
endsnippet
snippet ife "twig if ... else" b
{% if ${1} %}
${2}
{% else %}
${0}
{% endif %}
endsnippet
snippet el "twig else"
{% else %}
${0:${VISUAL}}
endsnippet
snippet eif "twig elseif"
{% elseif ${1} %}
${0:${VISUAL}}
endsnippet
snippet for "twig for" b
{% for ${1} in ${2} %}
${3}