From f11ec0bf184d8e54ae47f41205c64f3750ff2732 Mon Sep 17 00:00:00 2001 From: Jan Mollowitz Date: Tue, 1 Jul 2014 21:47:05 +0200 Subject: [PATCH] Added basic class with namespace snippet. --- UltiSnips/php_symfony2.snippets | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/UltiSnips/php_symfony2.snippets b/UltiSnips/php_symfony2.snippets index 3d43316..55423e7 100644 --- a/UltiSnips/php_symfony2.snippets +++ b/UltiSnips/php_symfony2.snippets @@ -3,6 +3,28 @@ priority -50 +snippet classn "Basic class with namespace snippet" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +/** + * ${1:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +`$2 +{ + public function __construct(${3:$options}) + { + ${4:// code} + }$0 +} +endsnippet + snippet contr "Symfony2 controller" b namespace `!p abspath = os.path.abspath(path)