Improved HTML and PHP snippets. Patch by Jacek Wysocki

This commit is contained in:
Holger Rapp 2012-08-06 11:21:50 +02:00
parent 890291e42d
commit a1f9776037
2 changed files with 60 additions and 16 deletions

View File

@ -277,4 +277,24 @@ snippet movie "Embed QT movie (movie)" b
</object> </object>
endsnippet endsnippet
snippet html5 "HTML5 Template"
<!DOCTYPE html>
<html>
<head>
<title>${1}</title>
<meta charset="utf-8" />
</head>
<body>
<header>
${2}
</header>
<content>
${3}
</content>
<footer>
${4}
</footer>
</body>
</html>
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -111,9 +111,9 @@ snippet setter "PHP Class Setter" !b
public function set${1/\w+\s*/\u$0/}($$1) public function set${1/\w+\s*/\u$0/}($$1)
{ {
$this->$1 = $$1;$3 $this->$1 = $$1;$3
return $this; ${4:return $this;}
} }
$4 $0
endsnippet endsnippet
snippet gs "PHP Class Getter Setter" !b snippet gs "PHP Class Getter Setter" !b
@ -133,70 +133,78 @@ public function get${1/\w+\s*/\u$0/}()
public function set${1/\w+\s*/\u$0/}($$1) public function set${1/\w+\s*/\u$0/}($$1)
{ {
$this->$1 = $$1;$3 $this->$1 = $$1;$3
return $this; ${4:return $this;}
} }
$4 $0
endsnippet endsnippet
snippet pub "Public function" !b snippet pub "Public function" !b
public function ${1:name}(${2:$param}) public function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
snippet pro "Protected function" !b snippet pro "Protected function" !b
protected function ${1:name}(${2:$param}) protected function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
snippet pri "Private function" !b snippet pri "Private function" !b
private function ${1:name}(${2:$param}) private function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
snippet pubs "Public static function" !b snippet pubs "Public static function" !b
public static function ${1:name}(${2:$param}) public static function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
snippet pros "Protected static function" !b snippet pros "Protected static function" !b
protected static function ${1:name}(${2:$param}) protected static function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
snippet pris "Private static function" !b snippet pris "Private static function" !b
private static function ${1:name}(${2:$param}) private static function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
snippet fu "Function snip" !b snippet fu "Function snip" !b
function ${1:name}(${2:$param}) function ${1:name}(${2:$param})
{ {
${3:return null;} ${VISUAL}${3:return null;}
} }
$0
endsnippet endsnippet
# :vim:ft=snippets # :vim:ft=snippets
snippet fore "Foreach loop" snippet fore "Foreach loop"
foreach ($${1:variable} as $${3:value}){ foreach ($${1:variable} as $${3:value}){
${4:// code...} ${VISUAL}${4}
} }
$0
endsnippet endsnippet
snippet new "New class instance" !b snippet new "New class instance" !b
$$1 = new $1($2); $$1 = new $1($2);
$3 $0
endsnippet endsnippet
@ -206,6 +214,7 @@ if (${1:/* condition */}) {
} else { } else {
${3:// code...} ${3:// code...}
} }
$0
endsnippet endsnippet
@ -221,14 +230,29 @@ class $1
${4:// code} ${4:// code}
} }
} }
$0
endsnippet endsnippet
snippet pr "Demb debug helper in HTML" snippet pr "Dumb debug helper in HTML"
echo '<pre>' . var_export($1, 1) . '</pre>'; echo '<pre>' . var_export($1, 1) . '</pre>';$0
endsnippet endsnippet
snippet pc "Dumb debug helper in cli" snippet pc "Dumb debug helper in cli"
var_export($1); var_export($1);$0
endsnippet
# Symfony 2 based snippets
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
}
endsnippet endsnippet
# :vim:ft=snippets: # :vim:ft=snippets: