Merge pull request #264 from chrisyue/master

snip `nc` auto detect `Abstract` and `Interface`
This commit is contained in:
Honza Pokorny 2013-08-19 05:13:30 -07:00
commit 4a495f7b3e
2 changed files with 34 additions and 3 deletions

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,17 @@ if m:
/**
* ${3:@author `whoami`}${4}
*/
class ${2:`!p
`!p
m = re.search(r'Abstract', path)
if m:
snip.rv = 'abstract '
``!p
m = re.search(r'Interface', path)
if m:
snip.rv = 'interface'
else:
snip.rv = 'class'
` ${2:`!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
`}
{
@ -80,3 +90,9 @@ if (${1}) {
${2}
}
endsnippet
snippet /** "php comment block" b
/**
* @${1}
*/
endsnippet

View File

@ -1,3 +1,5 @@
# sugguestion? report bugs?
# go to https://github.com/chrisyue/vim-snippets/issues
snippet contr "symfony2 controller" b
namespace `!p
abspath = os.path.abspath(path)
@ -23,6 +25,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->generate('home', [], false));
}
endsnippet
snippet actt "symfony2 action and template" b
/**
* @Route("${3}", name="${4}")
* @Method({${5:"GET"}})
@ -32,7 +46,8 @@ public function ${1}Action(${2})
{
${6}
return [];
}
}`!p
abspath = os.path.abspath(path)`
endsnippet
snippet comm "symfony2 command" b