From 6915c69d94d5c9fb73db4f9a30be8c240c23591b Mon Sep 17 00:00:00 2001 From: Claudio Maradonna Date: Thu, 9 Apr 2015 01:47:46 +0200 Subject: [PATCH 1/5] Update snippet for laravel Framework --- UltiSnips/php_laravel.snippets | 81 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/UltiSnips/php_laravel.snippets b/UltiSnips/php_laravel.snippets index 30f3f36..8b33962 100644 --- a/UltiSnips/php_laravel.snippets +++ b/UltiSnips/php_laravel.snippets @@ -1,15 +1,14 @@ #resource controller snippet l_rsc "Laravel resource controller" b /*! - * \class ${1:`!v expand('%:t:r')`} + * \class $1 * - * \author ${2:`!v g:snips_author`} + * \author ${3:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -class $1 extends ${3: BaseController} { +class ${1:`!v expand('%:t:r')`} extends ${2: BaseController} { function __construct() { - ${4} } public function index() { @@ -38,18 +37,18 @@ endsnippet #service service provider snippet l_ssp "Laravel service provider for service" b /*! - * \namespace ${1:Services} - * \class ${2:`!v expand('%:t:r')`} + * \namespace $1 + * \class $2 * * \author ${3:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $1; +namespace ${1:Services}; use Illuminate\Support\ServiceProvider; -class $2 extends ServiceProvider { +class ${2:`!v expand('%:t:r')`} extends ServiceProvider { public function register() { $this->app->bind('${4}Service', function ($app) { @@ -64,20 +63,20 @@ endsnippet #repository service provider snippet l_rsp "Laravel service provider for repository" b /*! - * \namespace ${2:Repositories\\${1:}} - * \class ${3:`!v expand('%:t:r')`} + * \namespace $2 + * \class $3 * * \author ${4:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $2; +namespace ${2:Repositories\\${1:}}; use Entities\\$1; use $2\\$1Repository; use Illuminate\Support\ServiceProvider; -class $3 extends ServiceProvider { +class ${3:`!v expand('%:t:r')`} extends ServiceProvider { /*! * \var defer * \brief Defer service @@ -102,16 +101,16 @@ endsnippet #model snippet l_md "Laravel simple model" b /*! - * \namespace ${1:Entities} - * \class ${2:`!v expand('%:t:r')`} + * \namespace $1 + * \class $2 * * \author ${3:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $1; +namespace ${1:Entities}; -class $2 extends \Eloquent { +class ${2:`!v expand('%:t:r')`} extends \Eloquent { protected $table = '${4:`!p snip.rv = t[2].lower()`}'; public $timestamps = ${5:false}; @@ -125,19 +124,19 @@ endsnippet #abstract repository snippet l_ar "Laravel abstract Repository" b /*! - * \namespace ${1:Repositories} - * \class ${2:`!v expand('%:t:r')`} - * \implements ${3:BaseRepositoryInterface} + * \namespace $1 + * \class $2 + * \implements $3 * * \author ${4:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $1; +namespace ${1:Repositories}; use Illuminate\Database\Eloquent\Model; -abstract class $2 implements $3 { +abstract class ${2:`!v expand('%:t:r')`} implements ${3:BaseRepositoryInterface} { protected $model; /*! @@ -191,17 +190,17 @@ endsnippet #repository snippet l_r "Laravel Repository" b /*! - * \namespace ${1:Repositories\\${2}} - * \class ${3:`!v expand('%:t:r')`} - * \implements ${4:$3RepositoryInterface} + * \namespace $1 + * \class $3 + * \implements $4 * * \author ${5:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $1; +namespace ${1:Repositories\\${2}}; -class $3 extends \\${6} implements $4 { +class ${3:`!v expand('%:t:r')`} extends \\${6} implements ${4:$3RepositoryInterface} { ${7} } endsnippet @@ -209,25 +208,25 @@ endsnippet #service snippet l_s "Laravel Service" b /*! - * \namespace ${1:Services} - * \class ${2:`!v expand('%:t:r')`} + * \namespace $1 + * \class $2 * - * \author ${3:`!v g:snips_author`} + * \author ${6:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $1; +namespace Services\\${1}; -use ${4:Repositories\\${5:Interface}}; +use ${3:Repositories\\${4:Interface}}; -class $2 { - protected $${6:repo}; +class ${2:`!v expand('%:t:r')`} { + protected $${5:repo}; /*! * \fn __construct */ - public function __construct($5 $repo) { - $this->$6 = $repo; + public function __construct($4 $repo) { + $this->$5 = $repo; } } endsnippet @@ -235,23 +234,23 @@ endsnippet #facade snippet l_f "Laravel Facade" b /*! - * \namespace ${1:Services} - * \class ${2:`!v expand('%:t:r')`} + * \namespace $1 + * \class $2 * - * \author ${3:`!v g:snips_author`} + * \author ${5:`!v g:snips_author`} * \date `!v strftime('%d-%m-%y')` */ -namespace $1; +namespace ${1:Services}; use \Illuminate\Support\Facades\Facade; -class $2 extends Facade { +class ${2:`!v expand('%:t:r')`} extends Facade { /*! * \fn getFacadeAccessor * * \return string */ - protected static function getFacadeAccessor() { return '${5:${4}Service}'; } + protected static function getFacadeAccessor() { return '${4:${3}Service}'; } } endsnippet From 61ec4998443f23051b332962f8017161b47becb6 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Fri, 10 Apr 2015 19:00:19 +0100 Subject: [PATCH 2/5] Make: Add debug print snippet --- snippets/make.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/make.snippets b/snippets/make.snippets index 121e623..87464c1 100644 --- a/snippets/make.snippets +++ b/snippets/make.snippets @@ -1,3 +1,5 @@ +snippet print + print-%: ; @echo $*=$($*) snippet ifeq ifeq (${1:cond0},${2:cond1}) ${0} From 5850ea9b21c7ed5a69b9e0d994518052d140a282 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 13 Apr 2015 15:55:44 +0200 Subject: [PATCH 3/5] python: docstring: do not add a newline after '"""' Ref: https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings --- snippets/python.snippets | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index f30add3..ea5f2c9 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -148,8 +148,7 @@ snippet pudb snippet pprint import pprint; pprint.pprint(${1}) snippet " - """ - ${0:doc} + """${0:doc} """ # assertions snippet a= @@ -200,8 +199,7 @@ snippet lc snippet li logger.info(${0:msg}) snippet epydoc - """ - ${1:Description} + """${1:Description} @param ${2:param}: ${3: Description} @type $2: ${4: Type} From ba7ab97da5bf3d7385abdb399e153a425777c678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Mon, 13 Apr 2015 23:56:04 +0200 Subject: [PATCH 4/5] java: prinlna to print array --- snippets/java.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/java.snippets b/snippets/java.snippets index 8971b3d..e40bbf5 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -226,6 +226,8 @@ snippet printf System.out.printf("${1:Message}", ${0:args}); snippet println System.out.println(${0}); +snippet printlna + System.out.println(Arrays.toString(${0})); ## ## Render Methods snippet ren From d789b0abef59b16699c46b2db5eee77f4cc39d55 Mon Sep 17 00:00:00 2001 From: Gabriel Chavez Date: Tue, 14 Apr 2015 11:17:25 +0300 Subject: [PATCH 5/5] Change for, if, else, and struct to K&R style. --- UltiSnips/c.snippets | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index 618bfe3..c621a36 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -46,15 +46,13 @@ int main(int argc, char *argv[]) endsnippet snippet for "for loop (for)" -for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) -{ +for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { ${VISUAL}${0} } endsnippet snippet fori "for int loop (fori)" -for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) -{ +for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { ${VISUAL}${0} } endsnippet @@ -100,8 +98,7 @@ fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|% endsnippet snippet if "if .. (if)" -if (${1:/* condition */}) -{ +if (${1:/* condition */}) { ${VISUAL}${0} } endsnippet @@ -119,12 +116,9 @@ else if (${1:/* condition */}) { endsnippet snippet ife "if .. else (ife)" -if (${1:/* condition */}) -{ +if (${1:/* condition */}) { ${2} -} -else -{ +} else { ${3:/* else */} } endsnippet @@ -134,8 +128,7 @@ printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2 endsnippet snippet st "struct" -struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} -{ +struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} { ${0:/* data */} }; endsnippet