Merge remote-tracking branch 'honza/vim-snippets/master'

Conflicts:
	snippets/make.snippets
This commit is contained in:
Corentin Peuvrel 2015-04-16 18:53:27 +02:00
commit edfeddc7c1
5 changed files with 53 additions and 59 deletions

View File

@ -46,15 +46,13 @@ int main(int argc, char *argv[])
endsnippet endsnippet
snippet for "for loop (for)" 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} ${VISUAL}${0}
} }
endsnippet endsnippet
snippet fori "for int loop (fori)" 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} ${VISUAL}${0}
} }
endsnippet endsnippet
@ -100,8 +98,7 @@ fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%
endsnippet endsnippet
snippet if "if .. (if)" snippet if "if .. (if)"
if (${1:/* condition */}) if (${1:/* condition */}) {
{
${VISUAL}${0} ${VISUAL}${0}
} }
endsnippet endsnippet
@ -119,12 +116,9 @@ else if (${1:/* condition */}) {
endsnippet endsnippet
snippet ife "if .. else (ife)" snippet ife "if .. else (ife)"
if (${1:/* condition */}) if (${1:/* condition */}) {
{
${2} ${2}
} } else {
else
{
${3:/* else */} ${3:/* else */}
} }
endsnippet endsnippet
@ -134,8 +128,7 @@ printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2
endsnippet endsnippet
snippet st "struct" 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 */} ${0:/* data */}
}; };
endsnippet endsnippet

View File

@ -1,15 +1,14 @@
#resource controller #resource controller
snippet l_rsc "Laravel resource controller" b 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')` * \date `!v strftime('%d-%m-%y')`
*/ */
class $1 extends ${3: BaseController} { class ${1:`!v expand('%:t:r')`} extends ${2: BaseController} {
function __construct() { function __construct() {
${4}
} }
public function index() { public function index() {
@ -38,18 +37,18 @@ endsnippet
#service service provider #service service provider
snippet l_ssp "Laravel service provider for service" b snippet l_ssp "Laravel service provider for service" b
/*! /*!
* \namespace ${1:Services} * \namespace $1
* \class ${2:`!v expand('%:t:r')`} * \class $2
* *
* \author ${3:`!v g:snips_author`} * \author ${3:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \date `!v strftime('%d-%m-%y')`
*/ */
namespace $1; namespace ${1:Services};
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class $2 extends ServiceProvider { class ${2:`!v expand('%:t:r')`} extends ServiceProvider {
public function register() { public function register() {
$this->app->bind('${4}Service', function ($app) { $this->app->bind('${4}Service', function ($app) {
@ -64,20 +63,20 @@ endsnippet
#repository service provider #repository service provider
snippet l_rsp "Laravel service provider for repository" b snippet l_rsp "Laravel service provider for repository" b
/*! /*!
* \namespace ${2:Repositories\\${1:}} * \namespace $2
* \class ${3:`!v expand('%:t:r')`} * \class $3
* *
* \author ${4:`!v g:snips_author`} * \author ${4:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \date `!v strftime('%d-%m-%y')`
*/ */
namespace $2; namespace ${2:Repositories\\${1:}};
use Entities\\$1; use Entities\\$1;
use $2\\$1Repository; use $2\\$1Repository;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class $3 extends ServiceProvider { class ${3:`!v expand('%:t:r')`} extends ServiceProvider {
/*! /*!
* \var defer * \var defer
* \brief Defer service * \brief Defer service
@ -102,16 +101,16 @@ endsnippet
#model #model
snippet l_md "Laravel simple model" b snippet l_md "Laravel simple model" b
/*! /*!
* \namespace ${1:Entities} * \namespace $1
* \class ${2:`!v expand('%:t:r')`} * \class $2
* *
* \author ${3:`!v g:snips_author`} * \author ${3:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \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()`}'; protected $table = '${4:`!p snip.rv = t[2].lower()`}';
public $timestamps = ${5:false}; public $timestamps = ${5:false};
@ -125,19 +124,19 @@ endsnippet
#abstract repository #abstract repository
snippet l_ar "Laravel abstract Repository" b snippet l_ar "Laravel abstract Repository" b
/*! /*!
* \namespace ${1:Repositories} * \namespace $1
* \class ${2:`!v expand('%:t:r')`} * \class $2
* \implements ${3:BaseRepositoryInterface} * \implements $3
* *
* \author ${4:`!v g:snips_author`} * \author ${4:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \date `!v strftime('%d-%m-%y')`
*/ */
namespace $1; namespace ${1:Repositories};
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
abstract class $2 implements $3 { abstract class ${2:`!v expand('%:t:r')`} implements ${3:BaseRepositoryInterface} {
protected $model; protected $model;
/*! /*!
@ -191,17 +190,17 @@ endsnippet
#repository #repository
snippet l_r "Laravel Repository" b snippet l_r "Laravel Repository" b
/*! /*!
* \namespace ${1:Repositories\\${2}} * \namespace $1
* \class ${3:`!v expand('%:t:r')`} * \class $3
* \implements ${4:$3RepositoryInterface} * \implements $4
* *
* \author ${5:`!v g:snips_author`} * \author ${5:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \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} ${7}
} }
endsnippet endsnippet
@ -209,25 +208,25 @@ endsnippet
#service #service
snippet l_s "Laravel Service" b snippet l_s "Laravel Service" b
/*! /*!
* \namespace ${1:Services} * \namespace $1
* \class ${2:`!v expand('%:t:r')`} * \class $2
* *
* \author ${3:`!v g:snips_author`} * \author ${6:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \date `!v strftime('%d-%m-%y')`
*/ */
namespace $1; namespace Services\\${1};
use ${4:Repositories\\${5:Interface}}; use ${3:Repositories\\${4:Interface}};
class $2 { class ${2:`!v expand('%:t:r')`} {
protected $${6:repo}; protected $${5:repo};
/*! /*!
* \fn __construct * \fn __construct
*/ */
public function __construct($5 $repo) { public function __construct($4 $repo) {
$this->$6 = $repo; $this->$5 = $repo;
} }
} }
endsnippet endsnippet
@ -235,23 +234,23 @@ endsnippet
#facade #facade
snippet l_f "Laravel Facade" b snippet l_f "Laravel Facade" b
/*! /*!
* \namespace ${1:Services} * \namespace $1
* \class ${2:`!v expand('%:t:r')`} * \class $2
* *
* \author ${3:`!v g:snips_author`} * \author ${5:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')` * \date `!v strftime('%d-%m-%y')`
*/ */
namespace $1; namespace ${1:Services};
use \Illuminate\Support\Facades\Facade; use \Illuminate\Support\Facades\Facade;
class $2 extends Facade { class ${2:`!v expand('%:t:r')`} extends Facade {
/*! /*!
* \fn getFacadeAccessor * \fn getFacadeAccessor
* *
* \return string * \return string
*/ */
protected static function getFacadeAccessor() { return '${5:${4}Service}'; } protected static function getFacadeAccessor() { return '${4:${3}Service}'; }
} }
endsnippet endsnippet

View File

@ -226,6 +226,8 @@ snippet printf
System.out.printf("${1:Message}", ${0:args}); System.out.printf("${1:Message}", ${0:args});
snippet println snippet println
System.out.println(${0}); System.out.println(${0});
snippet printlna
System.out.println(Arrays.toString(${0}));
## ##
## Render Methods ## Render Methods
snippet ren snippet ren

View File

@ -21,7 +21,9 @@ snippet base
snippet add snippet add
${1:out} : $1.o ${1:out} : $1.o
$(CC) $(CFLAGS) -o $@ $+ $(CC) $(CFLAGS) -o $@ $+
# print
snippet print
print-%: ; @echo $*=$($*)
# ifeq # ifeq
snippet ifeq snippet ifeq
ifeq (${1:cond0},${2:cond1}) ifeq (${1:cond0},${2:cond1})

View File

@ -148,8 +148,7 @@ snippet pudb
snippet pprint snippet pprint
import pprint; pprint.pprint(${1}) import pprint; pprint.pprint(${1})
snippet " snippet "
""" """${0:doc}
${0:doc}
""" """
# assertions # assertions
snippet a= snippet a=
@ -200,8 +199,7 @@ snippet lc
snippet li snippet li
logger.info(${0:msg}) logger.info(${0:msg})
snippet epydoc snippet epydoc
""" """${1:Description}
${1:Description}
@param ${2:param}: ${3: Description} @param ${2:param}: ${3: Description}
@type $2: ${4: Type} @type $2: ${4: Type}