Skip to content

Instantly share code, notes, and snippets.

@thiagosf
Created May 30, 2011 19:09
Show Gist options
  • Save thiagosf/999334 to your computer and use it in GitHub Desktop.
Save thiagosf/999334 to your computer and use it in GitHub Desktop.
Snippets para Geany
# Geany's snippets configuration file
#
# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR).
# use \t or %ws% for an indentation step, it will be replaced according to the current document's indent mode.
# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue').
# use %key% for all keys defined in the [Special] section.
# use %cursor% to define where the cursor should be placed after completion. You can define multiple
# %cursor% wildcards and use the "Move cursor in snippet" to jump to the next defined cursor
# position in the completed snippet.
# You can define a section for each supported filetype to overwrite default settings, the section
# name must match exactly the internal filetype name, run 'geany --ft-names' for a full list.
#
# Additionally, you can use most of the template wildcards like {developer} or {date} in the snippets.
# See the documentation for details.
# filetype names:
# ASM, C, C++, C#, CAML, D, Fortran, FreeBasic, Haskell, Haxe, Java, Pascal, VHDL, Ferite, Javascript,
# Lua, Make, O-Matrix, Perl, PHP, Python, Ruby, Sh, Tcl, CSS, Docbook, HTML, XML, Conf, Diff, LaTeX,
# reStructuredText, SQL, None
# Default is used for all filetypes and keys can be overwritten by [filetype] sections
[Default]
if=if (%cursor%) %block_cursor%
else=else %block_cursor%
for=for (i = 0; i < %cursor%; i++) %block_cursor%
while=while (%cursor%) %block_cursor%
do=do\n{\n\t%cursor%\n} while(%cursor%)\n%cursor%
switch=switch (%cursor%) %brace_open%case %cursor%:\n\t\t%cursor%\n\t\tbreak;\n\tdefault:\n\t\t%cursor%\n%brace_close%%cursor%
try=try%block%\ncatch (%cursor%)%block_cursor%
debug=echo '<pre>';\nprint_r($%cursor%array);\necho '</pre>';
ephp=<?=$%cursor%;?>
php=<?php\n\n%cursor%\n\n?>
com=/** \n * %cursor%\n */
h1=<h1>%cursor%</h1>
h2=<h2>%cursor%</h2>
h3=<h3>%cursor%</h3>
h4=<h4>%cursor%</h4>
h5=<h5>%cursor%</h5>
h6=<h6>%cursor%</h6>
h7=<h7>%cursor%</h7>
div=<div>%cursor%</div>
a=<a href="#">%cursor%</a>
p=<p>%cursor%</p>
b=<b>%cursor%</b>
ul=<ul>\n <li>%cursor%</li>\n</ul>
br=<br />
span=<span>%cursor%</span>
foreach=foreach ($%cursor% as $%cursor%) %block_cursor%
html=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />\n <title>%cursor%</title>\n <script type="text/javascript" language="javascript"></script>\n <link href="css/styles.css" type="text/css" media="all" rel="stylesheet" />\n</head>\n<body>\n %cursor%\n</body>\n</html>
input=<input type="%cursor%" name="" id="" size="" maxlength="" />
checkbox=<input type="checkbox" name="%cursor%" id="" />
radio=<input type="radio" name="%cursor%" id="" />
textarea=<textarea name="%cursor%" id="" rows="" cols=""></textarea>
select=<select name="%cursor%" id="">\n <option value=""></option>\n</select>
button=<button type="submit" value="%cursor%"></button>
# special keys to be used in other snippets, cannot be used "standalone"
# can be used by %key%, e.g. %brace_open%
# nesting of special keys is not supported (e.g. brace_open=\n{\n%brace_close% won't work)
# key "wordchars" is very special, it defines the word delimiting characters when looking for
# a word to auto complete, leave commented to use the default wordchars
[Special]
brace_open= {\n\t
brace_close=}\n
block=\n{\n\t%cursor%\n}
block_cursor= {\n\t%cursor%\n}\n%cursor%
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
[C++]
for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close%
[Java]
for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close%
[PHP]
for=for ($i = 0; $i < %cursor%; $i++)%brace_open%\n%brace_close%
cakeform=echo $form->create('Formulario');\necho $form->input('input');\necho $form->end('Enviar');
function=function %cursor% () {\n \n}
input=echo $form->input('%cursor%');
debug=function pr ($array) {\n echo '<pre>';\n print_r($array);\n echo '</pre>';\n}\n
class=class %cursor% extends %cursor%AppController {\n %cursor%\n}
controller=class %cursor% extends %cursor%AppController {\n %cursor%\n}
model=class %cursor% extends AppModel {\n \n}
helper=class %cursor%Helper extends Helper {\n \n}
component=class %cursor%Component extends Object {\n \n}
static=public static function %cursor% () {\n \n}\n
public=public function %cursor% () {\n \n}\n
private=private function %cursor% () {\n \n}\n
protected=protected function %cursor% () {\n \n}\n
log=\n $fp = fopen('log.txt', 'a+');\n $write = null;\n foreach ($_REQUEST as $key => $value) {\n $write .= $key .' = '.$value."\\n";\n }\n $write .= "\\n ------------------------- \\n";\n fwrite($fp, $write);\n fclose($fp);
[Python]
for=for i in xrange(%cursor%):\n\t
if=if %cursor%:\n\t
elif=elif %cursor%:\n\t
else=else:\n\t
while=while %cursor%:\n\t
try=try:\n\t%cursor%\nexcept Exception, ex:\n\t
with=with %cursor%:\n\t
def=def %cursor% (%cursor%):\n\t""" Function doc """\n\t
class=class %cursor%:\n\t""" Class doc """\n\t\n\tdef __init__ (self):\n\t\t""" Class initialiser """\n\t\tpass
[Ferite]
iferr=iferr%block_cursor%fix%block%
monitor=monitor%block_cursor%handle%block%
[CSS]
radius=-moz-border-radius:%cursor%0px;-webkit-border-radius:0px;border-radius:0px;
structure=* {margin:0;padding:0;list-style:none;}\nbody {font-family: Arial,Tahoma,Verdana,sans;}
[Javascript]
ready=$(document).ready(function() {\n %cursor%$('.class').\n});
click=$('%cursor%').click(function() {\n %cursor%\n});
hover=$('%cursor%').hover(function() {\n %cursor%\n});
toggle=$('%cursor%').toggle(function() {\n %cursor%\n});
submit=$('%cursor%').submit(function() {\n %cursor%\n});
log=console.log(%cursor%);
function=function %cursor% () {\n \n}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment