add twig snippets
This commit is contained in:
parent
acf7dc3785
commit
218eb0adb9
@ -1,7 +1,7 @@
|
|||||||
# sugguestion? report bugs?
|
# sugguestion? report bugs?
|
||||||
# go to https://github.com/chrisyue/vim-snippets/issues
|
# go to https://github.com/chrisyue/vim-snippets/issues
|
||||||
|
|
||||||
snippet contr "symfony2 controller" b
|
snippet contr "Symfony2 controller" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
@ -25,19 +25,19 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet act "symfony2 action" b
|
snippet act "Symfony2 action" b
|
||||||
/**
|
/**
|
||||||
* @Route("${3}", name="${4}")
|
* @Route("${3}", name="${4}")
|
||||||
* @Method({${5:"POST"}})
|
* @Method({${5:"POST"}})
|
||||||
|
* @Template()
|
||||||
*/
|
*/
|
||||||
public function ${1}Action(${2})
|
public function ${1}Action(${2})
|
||||||
{
|
{
|
||||||
${6}
|
${6}
|
||||||
return $this->redirect($this->generateUrl('home', [], false));
|
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet actt "symfony2 action and template" b
|
snippet actt "Symfony2 action and template" b
|
||||||
/**
|
/**
|
||||||
* @Route("${3}", name="${4}")
|
* @Route("${3}", name="${4}")
|
||||||
* @Method({${5:"GET"}})
|
* @Method({${5:"GET"}})
|
||||||
@ -51,7 +51,7 @@ public function ${1}Action(${2})
|
|||||||
abspath = os.path.abspath(path)`
|
abspath = os.path.abspath(path)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet comm "symfony2 command" b
|
snippet comm "Symfony2 command" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
@ -74,14 +74,12 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
{
|
{
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this->setName('${1}')
|
||||||
->setName('${1}')
|
|
||||||
->setDescription('${2}')
|
->setDescription('${2}')
|
||||||
->setDefinition([
|
->setDefinition([
|
||||||
new InputArgument('', InputArgument::REQUIRED, ''),
|
new InputArgument('', InputArgument::REQUIRED, ''),
|
||||||
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
||||||
])
|
]);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
@ -90,7 +88,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet subs "symfony2 subscriber" b
|
snippet subs "Symfony2 subscriber" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
@ -121,7 +119,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet transf "symfony2 form data transformer" b
|
snippet transf "Symfony2 form data transformer" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
@ -155,7 +153,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ent "symfony2 doctrine entity" b
|
snippet ent "Symfony2 doctrine entity" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
@ -192,7 +190,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet form "symfony2 form type" b
|
snippet form "Symfony2 form type" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
@ -235,3 +233,27 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet ev "Symfony2 event" 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\Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${2:@author `whoami`}
|
||||||
|
*/
|
||||||
|
class `!p
|
||||||
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||||
|
` extends Event
|
||||||
|
{
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet redir "Symfony2 redirect"
|
||||||
|
$this->redirect($this->generateUrl('${1}', ${2}));
|
||||||
|
endsnippet
|
||||||
|
33
UltiSnips/twig.snippets
Normal file
33
UltiSnips/twig.snippets
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
snippet bl "twig block" b
|
||||||
|
{% block ${1} %}
|
||||||
|
${2}
|
||||||
|
{% endblock $1 %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet js "twig javascripts" b
|
||||||
|
{% javascripts '${1}' %}
|
||||||
|
<script src="{{ asset_url }}"></script>
|
||||||
|
{% endjavascripts %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet css "twig stylesheets" b
|
||||||
|
{% stylesheets '${1}' %}
|
||||||
|
<script src="{{ asset_url }}"></script>
|
||||||
|
{% endstylesheets %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet if "twig if" b
|
||||||
|
{% if ${1} %}
|
||||||
|
${2}
|
||||||
|
{% endif %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet for "twig for" b
|
||||||
|
{% for ${1} in ${2} %}
|
||||||
|
${3}
|
||||||
|
{% endfor %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ext "twig extends" b
|
||||||
|
{% extends ${1} %}
|
||||||
|
endsnippet
|
Loading…
Reference in New Issue
Block a user