mirror of
				https://github.com/amix/vimrc
				synced 2025-10-30 21:43:35 +08:00 
			
		
		
		
	Updated vimrc
This commit is contained in:
		| @ -89,7 +89,8 @@ endsnippet | ||||
|  | ||||
| snippet bbox "A nice box over the full width" b | ||||
| `!p | ||||
| width = int(vim.eval("&textwidth")) or 71 | ||||
| if not snip.c: | ||||
| 	width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71 | ||||
| box = make_box(len(t[1]), width) | ||||
| snip.rv = box[0] | ||||
| snip += box[1] | ||||
|  | ||||
| @ -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 | ||||
| @ -99,43 +97,18 @@ snippet fprintf "fprintf ..." | ||||
| fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/} | ||||
| endsnippet | ||||
|  | ||||
| snippet if "if .. (if)" | ||||
| if (${1:/* condition */}) | ||||
| { | ||||
| 	${VISUAL}${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet el "else .. (else)" | ||||
| else { | ||||
| 	${VISUAL}${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet eli "else if .. (eli)" | ||||
| else if (${1:/* condition */}) { | ||||
| 	${VISUAL}${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet ife "if .. else (ife)" | ||||
| if (${1:/* condition */}) | ||||
| { | ||||
| 	${2} | ||||
| } | ||||
| else | ||||
| { | ||||
| 	${3:/* else */} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet printf "printf .. (printf)" | ||||
| 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 | ||||
|  | ||||
| @ -1,3 +1,39 @@ | ||||
| priority -50 | ||||
|  | ||||
| extends html | ||||
|  | ||||
| snippet % "<% %>" w | ||||
| <% $0 %> | ||||
| endsnippet | ||||
|  | ||||
| snippet = "<%= %>" w | ||||
| <%= $0 %> | ||||
| endsnippet | ||||
|  | ||||
| snippet end "<% end %>" w | ||||
| <% end %> | ||||
| endsnippet | ||||
|  | ||||
| snippet for | ||||
| <%= for ${1:item} <- ${2:$1s} ${3:@conn} do %> | ||||
| 	$0 | ||||
| <% end %> | ||||
| endsnippet | ||||
|  | ||||
| snippet ft "form_tag" w | ||||
| <%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %> | ||||
| 	$0 | ||||
| </form> | ||||
| endsnippet | ||||
|  | ||||
| snippet lin "link" w | ||||
| <%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %> | ||||
| endsnippet | ||||
|  | ||||
| snippet ff "form_for" w | ||||
| <%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %> | ||||
| 		$0 | ||||
|  | ||||
| 	<%= submit "Submit" %> | ||||
| <% end %> | ||||
| endsnippet | ||||
|  | ||||
| @ -198,6 +198,18 @@ snippet h1 "XHTML <h1>" w | ||||
| <h1>$0</h1> | ||||
| endsnippet | ||||
|  | ||||
| snippet h2 "XHTML <h2>" w | ||||
| <h2>$0</h2> | ||||
| endsnippet | ||||
|  | ||||
| snippet h3 "XHTML <h3>" w | ||||
| <h3>$0</h3> | ||||
| endsnippet | ||||
|  | ||||
| snippet h4 "XHTML <h4>" w | ||||
| <h4>$0</h4> | ||||
| endsnippet | ||||
|  | ||||
| snippet head "XHTML <head>" | ||||
| <head> | ||||
| 	<meta charset="utf-8"> | ||||
|  | ||||
| @ -8,7 +8,7 @@ $${1:arrayName} = array('${2}' => ${3});${4} | ||||
| endsnippet | ||||
|  | ||||
| snippet def "def" | ||||
| define('${1}'${2});${3} | ||||
| define('${1:VARIABLE_NAME}', ${2:'definition'});${3} | ||||
| endsnippet | ||||
|  | ||||
| snippet do "do" | ||||
| @ -52,7 +52,7 @@ for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { | ||||
| endsnippet | ||||
|  | ||||
| snippet foreachk "foreachk" | ||||
| foreach ($${1:variable} as $${2:key} => $${3:value}){ | ||||
| foreach ($${1:variable} as $${2:key} => $${3:value}) { | ||||
| 	${4:// code...} | ||||
| } | ||||
| endsnippet | ||||
| @ -85,6 +85,10 @@ snippet post "post" | ||||
| $_POST['${1}']${2} | ||||
| endsnippet | ||||
|  | ||||
| snippet req "req1" | ||||
| require_once '${1:file}';${2} | ||||
| endsnippet | ||||
|  | ||||
| snippet req1 "req1" | ||||
| require_once '${1:file}';${2} | ||||
| endsnippet | ||||
| @ -123,6 +127,7 @@ snippet setter "PHP Class Setter" b | ||||
| public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) | ||||
| { | ||||
|     $this->$1 = $$1;$5 | ||||
|  | ||||
|     ${6:return $this;} | ||||
| } | ||||
| $0 | ||||
| @ -148,6 +153,7 @@ public function get${1/\w+\s*/\u$0/}() | ||||
| public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) | ||||
| { | ||||
|     $this->$1 = $$1;$6 | ||||
|  | ||||
|     ${7:return $this;} | ||||
| } | ||||
| $0 | ||||
| @ -240,14 +246,14 @@ $0 | ||||
| endsnippet | ||||
|  | ||||
| snippet fore "Foreach loop" | ||||
| foreach ($${1:variable} as $${3:value}){ | ||||
| foreach ($${1:variable} as $${3:value}) { | ||||
| 	${VISUAL}${4} | ||||
| } | ||||
| $0 | ||||
| endsnippet | ||||
|  | ||||
| snippet new "New class instance" b | ||||
| $$1 = new $1($2); | ||||
| $${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3); | ||||
| $0 | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -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() { | ||||
| @ -18,7 +17,7 @@ class $1 extends ${3: BaseController} { | ||||
|     public function create() { | ||||
|     } | ||||
|      | ||||
|     public function store($id) { | ||||
|     public function store() { | ||||
|     } | ||||
|      | ||||
|     public function show($id) { | ||||
| @ -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 | ||||
|  | ||||
| @ -278,6 +278,55 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
| snippet redir "Symfony2 redirect" | ||||
| snippet redir "Symfony2 redirect" b | ||||
| $this->redirect($this->generateUrl('${1}', ${2})); | ||||
| endsnippet | ||||
|  | ||||
| snippet usecontroller "Symfony2 use Symfony\..\Controller" b | ||||
| use Symfony\Bundle\FrameworkBundle\Controller\Controller;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usereauest "Symfony2 use Symfony\..\Request" b | ||||
| use Symfony\Component\HttpFoundation\Request;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet useroute "Symfony2 use Sensio\..\Route" b | ||||
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet useresponse "Symfony2 use Symfony\..\Response" b | ||||
| use Symfony\Component\HttpFoundation\Response;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usefile "Symfony2 use Symfony\..\File" b | ||||
| use Symfony\Component\HttpFoundation\File\UploadedFile;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet useassert "Symfony2 use Symfony\..\Constraints as Assert" b | ||||
| use Symfony\Component\Validator\Constraints as Assert;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usetemplate "Symfony2 use Sensio\..\Template" b | ||||
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usecache "Symfony2 use Sensio\..\Cache" b | ||||
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usemethod "Symfony2 use Sensio\..\Method" b | ||||
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usearray "Symfony2 use Doctrine\..\ArrayCollection" b | ||||
| use Doctrine\Common\Collections\ArrayCollection;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet useorm "Symfony2 use Doctrine\..\Mapping as ORM" b | ||||
| use Doctrine\ORM\Mapping as ORM;${1} | ||||
| endsnippet | ||||
|  | ||||
| snippet usesecure "Symfony2 use JMS\..\Secure" b | ||||
| use JMS\SecurityExtraBundle\Annotation\Secure;${1} | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -7,18 +7,18 @@ priority -50 | ||||
| #! header | ||||
| snippet #! "Shebang header for python scripts" b | ||||
| #!/usr/bin/env python | ||||
| # encoding: utf-8 | ||||
| # -*- coding: utf-8 -*- | ||||
| $0 | ||||
| endsnippet | ||||
|  | ||||
| snippet ifmain "ifmain" b | ||||
| if __name__ == '__main__': | ||||
| 	${1:main()}$0 | ||||
| 	${1:${VISUAL:main()}} | ||||
| endsnippet | ||||
|  | ||||
| snippet for "for loop" b | ||||
| for ${1:item} in ${2:iterable}: | ||||
| 	${3:pass} | ||||
| 	${3:${VISUAL:pass}} | ||||
| endsnippet | ||||
|  | ||||
| ########## | ||||
| @ -447,7 +447,7 @@ if snip.indent: | ||||
| 	snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}): | ||||
| 	`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p | ||||
| write_function_docstring(t, snip) ` | ||||
| 	${0:pass} | ||||
| 	${5:${VISUAL:pass}} | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -458,7 +458,7 @@ if snip.indent: | ||||
| 	snip.rv = 'cls' + (", " if len(t[2]) else "")`${2:arg1}): | ||||
| 	`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p | ||||
| write_function_docstring(t, snip) ` | ||||
| 	${0:pass} | ||||
| 	${5:${VISUAL:pass}} | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -467,7 +467,7 @@ snippet defs "static method with docstrings" b | ||||
| def ${1:function}(${2:arg1}): | ||||
| 	`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p | ||||
| write_function_docstring(t, snip) ` | ||||
| 	${0:pass} | ||||
| 	${5:${VISUAL:pass}} | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -520,19 +520,19 @@ endsnippet | ||||
| #################### | ||||
| snippet if "If" b | ||||
| if ${1:condition}: | ||||
| 	${2:pass} | ||||
| 	${2:${VISUAL:pass}} | ||||
| endsnippet | ||||
|  | ||||
| snippet ife "If / Else" b | ||||
| if ${1:condition}: | ||||
| 	${2:pass} | ||||
| 	${2:${VISUAL:pass}} | ||||
| else: | ||||
| 	${3:pass} | ||||
| endsnippet | ||||
|  | ||||
| snippet ifee "If / Elif / Else" b | ||||
| if ${1:condition}: | ||||
| 	${2:pass} | ||||
| 	${2:${VISUAL:pass}} | ||||
| elif ${3:condition}: | ||||
| 	${4:pass} | ||||
| else: | ||||
| @ -545,32 +545,32 @@ endsnippet | ||||
| ########################## | ||||
| snippet try "Try / Except" b | ||||
| try: | ||||
| 	${1:pass} | ||||
| 	${1:${VISUAL:pass}} | ||||
| except ${2:Exception}, ${3:e}: | ||||
| 	${4:raise $3} | ||||
| endsnippet | ||||
|  | ||||
| snippet try "Try / Except / Else" b | ||||
| snippet trye "Try / Except / Else" b | ||||
| try: | ||||
| 	${1:pass} | ||||
| 	${1:${VISUAL:pass}} | ||||
| except ${2:Exception}, ${3:e}: | ||||
| 	${4:raise $3} | ||||
| else: | ||||
| 	${5:pass} | ||||
| endsnippet | ||||
|  | ||||
| snippet try "Try / Except / Finally" b | ||||
| snippet tryf "Try / Except / Finally" b | ||||
| try: | ||||
| 	${1:pass} | ||||
| 	${1:${VISUAL:pass}} | ||||
| except ${2:Exception}, ${3:e}: | ||||
| 	${4:raise $3} | ||||
| finally: | ||||
| 	${5:pass} | ||||
| endsnippet | ||||
|  | ||||
| snippet try "Try / Except / Else / Finally" b | ||||
| snippet tryef "Try / Except / Else / Finally" b | ||||
| try: | ||||
| 	${1:pass} | ||||
| 	${1:${VISUAL:pass}} | ||||
| except${2: ${3:Exception}, ${4:e}}: | ||||
| 	${5:raise} | ||||
| else: | ||||
| @ -597,31 +597,31 @@ import pudb; pudb.set_trace() | ||||
| endsnippet | ||||
|  | ||||
| snippet ae "Assert equal" b | ||||
| self.assertEqual(${1:first},${2:second}) | ||||
| self.assertEqual(${1:${VISUAL:first}},${2:second}) | ||||
| endsnippet | ||||
|  | ||||
| snippet at "Assert True" b | ||||
| self.assertTrue(${0:exp}) | ||||
| self.assertTrue(${1:${VISUAL:expression}}) | ||||
| endsnippet | ||||
|  | ||||
| snippet af "Assert False" b | ||||
| self.assertFalse(${1:expression}) | ||||
| self.assertFalse(${1:${VISUAL:expression}}) | ||||
| endsnippet | ||||
|  | ||||
| snippet aae "Assert almost equal" b | ||||
| self.assertAlmostEqual(${1:first},${2:second}) | ||||
| self.assertAlmostEqual(${1:${VISUAL:first}},${2:second}) | ||||
| endsnippet | ||||
|  | ||||
| snippet ar "Assert raises" b | ||||
| self.assertRaises(${1:exception}, ${2:func}${3/.+/, /}${3:arguments}) | ||||
| self.assertRaises(${1:exception}, ${2:${VISUAL:func}}${3/.+/, /}${3:arguments}) | ||||
| endsnippet | ||||
|  | ||||
| snippet an "Assert is None" b | ||||
| self.assertIsNone(${0:expression}) | ||||
| self.assertIsNone(${1:${VISUAL:expression}}) | ||||
| endsnippet | ||||
|  | ||||
| snippet ann "Assert is not None" b | ||||
| self.assertIsNotNone(${0:expression}) | ||||
| self.assertIsNotNone(${1:${VISUAL:expression}}) | ||||
| endsnippet | ||||
|  | ||||
| snippet testcase "pyunit testcase" b | ||||
| @ -636,24 +636,24 @@ class Test${1:Class}(${2:unittest.TestCase}): | ||||
| 		${5:pass} | ||||
|  | ||||
| 	def test_${6:name}(self): | ||||
| 		${7:pass} | ||||
| 		${7:${VISUAL:pass}} | ||||
| endsnippet | ||||
|  | ||||
| snippet " "triple quoted string (double quotes)" b | ||||
| """ | ||||
| ${1:doc} | ||||
| ${1:${VISUAL:doc}} | ||||
| `!p triple_quotes_handle_trailing(snip, '"')` | ||||
| endsnippet | ||||
|  | ||||
| snippet ' "triple quoted string (single quotes)" b | ||||
| ''' | ||||
| ${1:doc} | ||||
| ${1:${VISUAL:doc}} | ||||
| `!p triple_quotes_handle_trailing(snip, "'")` | ||||
| endsnippet | ||||
|  | ||||
| snippet doc "doc block (triple quotes)" | ||||
| `!p snip.rv = triple_quotes(snip)` | ||||
| ${1:doc} | ||||
| ${1:${VISUAL:doc}} | ||||
| `!p snip.rv = triple_quotes(snip)` | ||||
| endsnippet | ||||
|  | ||||
|  | ||||
| @ -302,18 +302,6 @@ begin | ||||
| end while ${1:expression} | ||||
| endsnippet | ||||
|  | ||||
| snippet "\b(r|attr)" "attr_reader :<attr_names>" r | ||||
| attr_reader :${0:attr_names} | ||||
| endsnippet | ||||
|  | ||||
| snippet "\b(w|attr)" "attr_writer :<attr_names>" r | ||||
| attr_writer :${0:attr_names} | ||||
| endsnippet | ||||
|  | ||||
| snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r | ||||
| attr_accessor :${0:attr_names} | ||||
| endsnippet | ||||
|  | ||||
| snippet begin "begin ... rescue ... end" | ||||
| begin | ||||
| 	$1 | ||||
|  | ||||
| @ -59,7 +59,7 @@ mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { | ||||
| endsnippet | ||||
|  | ||||
| snippet for "for .. in .." b | ||||
| for ${1:i} in ${2:${3:0us}..${4:10}} { | ||||
| for ${1:i} in ${2} { | ||||
| 	${VISUAL}${0} | ||||
| } | ||||
| endsnippet | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 amix
					amix