1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +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}

View File

@ -106,6 +106,19 @@ snippet cout
snippet cin
std::cin >> ${1};
##
## Casts
# static
snippet sca
static_cast<${1:unsigned}>(${2:expr})${3}
# dynamic
snippet dca
dynamic_cast<${1:unsigned}>(${2:expr})${3}
# reinterpret
snippet rca
reinterpret_cast<${1:unsigned}>(${2:expr})${3}
# const
snippet cca
const_cast<${1:unsigned}>(${2:expr})${3}
## Iteration
# for i
snippet fori

View File

@ -24,6 +24,10 @@ snippet incl
# behavior directive
snippet beh
-behaviour(${1:behaviour}).
snippet ifd
-ifdef(${1:TEST}).
${0}
-endif.
# if expression
snippet if
if
@ -483,21 +487,21 @@ snippet testsuite
-module(${0:`vim_snippets#Filename('', 'my')`}).
-include_lib("common_test/include/ct.hrl").
%% Test server callbacks
-export([suite/0, all/0, groups/0,
init_per_suite/1, end_per_suite/1,
init_per_group/2, end_per_group/2,
init_per_testcase/2, end_per_testcase/2]).
%% Test cases
-export([
]).
%%--------------------------------------------------------------------
%% COMMON TEST CALLBACK FUNCTIONS
%%--------------------------------------------------------------------
%%--------------------------------------------------------------------
%% Function: suite() -> Info
%%
@ -512,7 +516,7 @@ snippet testsuite
%%--------------------------------------------------------------------
suite() ->
[{timetrap,{minutes,10}}].
%%--------------------------------------------------------------------
%% Function: init_per_suite(Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -529,7 +533,7 @@ snippet testsuite
%%--------------------------------------------------------------------
init_per_suite(Config) ->
Config.
%%--------------------------------------------------------------------
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
%%
@ -540,7 +544,7 @@ snippet testsuite
%%--------------------------------------------------------------------
end_per_suite(_Config) ->
ok.
%%--------------------------------------------------------------------
%% Function: init_per_group(GroupName, Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -556,7 +560,7 @@ snippet testsuite
%%--------------------------------------------------------------------
init_per_group(_GroupName, Config) ->
Config.
%%--------------------------------------------------------------------
%% Function: end_per_group(GroupName, Config0) ->
%% void() | {save_config,Config1}
@ -570,7 +574,7 @@ snippet testsuite
%%--------------------------------------------------------------------
end_per_group(_GroupName, _Config) ->
ok.
%%--------------------------------------------------------------------
%% Function: init_per_testcase(TestCase, Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -589,7 +593,7 @@ snippet testsuite
%%--------------------------------------------------------------------
init_per_testcase(_TestCase, Config) ->
Config.
%%--------------------------------------------------------------------
%% Function: end_per_testcase(TestCase, Config0) ->
%% void() | {save_config,Config1} | {fail,Reason}
@ -605,7 +609,7 @@ snippet testsuite
%%--------------------------------------------------------------------
end_per_testcase(_TestCase, _Config) ->
ok.
%%--------------------------------------------------------------------
%% Function: groups() -> [Group]
%%
@ -629,7 +633,7 @@ snippet testsuite
%%--------------------------------------------------------------------
groups() ->
[].
%%--------------------------------------------------------------------
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
%%
@ -644,14 +648,14 @@ snippet testsuite
%% Description: Returns the list of groups and test cases that
%% are to be executed.
%%--------------------------------------------------------------------
all() ->
all() ->
[].
%%--------------------------------------------------------------------
%% TEST CASES
%%--------------------------------------------------------------------
%%--------------------------------------------------------------------
%% Function: TestCase(Config0) ->
%% ok | exit() | {skip,Reason} | {comment,Comment} |

View File

@ -25,7 +25,21 @@ snippet add
snippet print
print-%: ; @echo $*=$($*)
# ifeq
snippet ifeq
snippet if
ifeq (${1:cond0}, ${2:cond1})
${0}
endif
# ifeq ... else ... endif
snippet ife
ifeq (${1:cond0}, ${2:cond1})
${3}
else
${0}
endif
# else ...
snippet el
else
${0}
# .DEFAULT_GOAL := target
snippet default
.DEFAULT_GOAL := ${1}

View File

@ -218,6 +218,18 @@ snippet interface
{
${0}
}
# Trait
snippet trait
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
*/
trait ${1:`vim_snippets#Filename()`}
{
${0}
}
# class ...
snippet class
/**
@ -287,7 +299,7 @@ snippet el
${0}
}
snippet eif
elseif (${1:/* condition */}) {
elseif (${1}) {
${0}
}
snippet switch

View File

@ -0,0 +1,43 @@
# twig block
snippet bl
{% block ${1} %}
${2}
{% endblock $1 %}
# twig javascripts
snippet js
{% javascripts '${1}' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
# twig stylesheets
snippet css
{% stylesheets '${1}' %}
<link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}
# twig if
snippet if
{% if ${1} %}
${2}
{% endif %}
# twig if ... else
snippet ife
{% if ${1} %}
${2}
{% else %}
${0}
{% endif %}
# twig else
snippet el
{% else %}
${0}
# twig elseif
snippet eif
{% elseif ${1} %}
${0}
# twig for
snippet for
{% for ${1} in ${2} %}
${3}
{% endfor %}
# twig extends
snippet ext
{% extends ${1} %}