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>
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:

View File

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