[Geany-Devel] Snippets file

n@sk0 arrtedone at xxxxx
Wed Aug 28 07:20:04 UTC 2013


Hi all, long time ago i was written snippets file, so i want to send you 
updated version + html/css/js snippets added from Tomasz Karbownicki.
Also i want to propose improvements for parsing those snippets but i 
will write for this later.

-------------- next part --------------
# 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}, {command:...},
# or {date} in the snippets.
# See the documentation for details.

# For a list of available filetype names, execute:
# geany --ft-names

# Default is used for all filetypes and keys can be overwritten by [filetype] sections
[Default]

# 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{\n\t
brace_close=}\n
block=\n{\n\t%cursor%\n}
block_cursor=\n{\n\t%cursor%\n}\n%cursor%
block_sl=\s{\n\t%cursor%\n}\s

# php related (see PHP section below)
php_start=<?php\n/**\n\s*\s at file\s{filename}\n\s*\s at author\s{developer}\n\s*\s at created\s{command:date +"%y-%m-%d %T"}\n\s*/\n%cursor%
phpcl_head=<?php\n/**\n\s*\sclass\sdescription\n\s*\s\n\s*\s at filename\s{filename}\n\s*\s at category\s\n\s*\s at package\s\n\s*\s at author\s{developer}\s<{mail}>\n\s*\s at copyright\sCopyright\s(c)\s{year}\s{company}\n\s*\s at created\s{command:date +"%d %b %Y %T"}\n\s*/\n
php_class=class\s%cursor%\n{\n%ws%public\sfunction\s__construct()\s{}\n\n%ws%public\sfunction\s__destruct()\s{}\n}

#
# wordchars=_-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
#
# Optional keybindings to insert snippets
# Note: these can be overridden by Geany's configurable keybindings
[Keybindings]
#for=<Ctrl>7

[PHP]
# by Atanas Beloborodov <arrtedone at gmail.com>
# File
php=%php_start%
phpcl=%phpcl_head%%php_class%
class=%php_class%
inter=interface\s%cursor% %block%
aclass=abstract\s%php_class%
# Class properties
pub=public\s$%cursor%;
pro=protected\s$%cursor%;
priv=private\s$%cursor%;
#  Static class properties
pubs=public\sstatic\s$%cursor%;
pros=protected\sstatic\s$%cursor%;
privs=private\sstatic\s$%cursor%;
# Abstract methods
apub=abstract\spublic\sfunction\s%cursor%();
aprot=abstract\sprotected\sfunction\s%cursor%();
apriv=abstract\sprivate\sfunction\s%cursor%();
# Functions and class methods
construct=public\sfunction\s__construct(%cursor%)%block%
destruct=public\sfunction\s__destruct(%cursor%)%block%
public=public\sfunction\s%cursor%()%block%
protected=protected\sfunction\s%cursor%()%block%
private=private\sfunction\s%cursor%()%block%
publics=public\sstatic\sfunction\s%cursor%()%block%
# Static methods
protecteds=protected\sstatic\sfunction\s_%cursor%()%block%
privates=private\sstatic\sfunction\s_%cursor%()%block%
func=function\s%cursor%()%block%
# Control structures
if=if\s(%cursor%)%block_sl%
ifelse=if\s(%cursor%)%block_sl%else%block_sl%
for=for\s($i=0;\s$i<%cursor%;\s$i++)\s%block_sl%
while=while\s(%cursor%)\s%block_sl%
switch=switch\s(%cursor%)\s{\n\tcase\s'';\n\n\tbreak;\n\n\tdefault\s:\n\n\tbreak;\n}\n
do=do%block_sl%while\s(%cursor%);
foreach=foreach\s(%cursor%)\s%block_sl%
ifalt=<?php\sif\s(%cursor%)\s:\n%cursor%\nendif;\s?>
ifelsealt=<?php\sif\s(%cursor%)\s:\n%cursor%\nelse\s:\n\nendif;\s?>
try=try%block_sl%catch(%cursor%)%block_sl%
# Special
this=$this->%cursor%
req=require_once '%cursor%';
inc=include_once '%cursor%';
reqo=require '%cursor%';
inco=include '%cursor%';
def=define('%cursor%',0);
throw=throw\snew\s%cursor%Exception\s('%cursor%');e%
declare=declare\s(%cursor%);
dump=var_dump(%cursor%);\sexit;

[Javascript]
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%
# jQuery
jquery=<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
jqueryui=<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
jready=$(document).ready(function(){\n\t%cursor%\n});
jfunc=$(function(){\n\t%cursor%\n});
log=console.log('%cursor%');

[HTML]
# by Tomasz Karbownicki <tomasz at karbownicki.com>
# top
html5=<!DOCTYPE html>\n<html lang="en">\n\t<head>\n\t\t<meta charset="utf-8" />\n\t\t<title>%cursor%</title>\n\t</head>\n\n\t<body>\n\t%cursor%\n\t</body>\n</html>
html=<html lang="%cursor%">\n\t%cursor%\n</html>
head=<head>\n\t%cursor%\n</head>
js=<script type="text/javascript">\n\t%cursor%\n</script>
js2=<script src="%cursor%" type="text/javascript"></script>
css=<style type="text/css">\n\t%cursor%\n</style>
css2=<link href="%cursor%" rel="stylesheet" type="text/css" />
rss=<link rel="alternate" type="application/rss+xml" title="%cursor%" href="%cursor%" />
title=<title>%cursor%</title>
utf=<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
ie7=<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
refresh=<meta http-equiv="refresh" content="2;url=%cursor%" />
body=<body>\n\t%cursor%\n</body>
# table
table=<table>\n\t<thead>\n\t\t<tr>\n\t\t\t<th>%cursor%</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td>%cursor%</td>\n\t\t</tr>\n\t</tbody>\n</table>
td=<td>%cursor%</td>
tr=<tr>%cursor%</tr>
th=<th>%cursor%</th>
caption=<caption>%cursor%</caption>
# form
form=<form action="%cursor%" method="post">\n\n\t<input type="submit" value="%cursor%" />\n</form>
formp=<form action="%cursor%" method="post">\n\n\t<p>{{ form.as_p }}</p>\n<p><input type="submit" value="%cursor%" /></p>\n</form>
label=<label for="%cursor%"></label>
input=<input type="text" name="%cursor%" value="%cursor%" id="%cursor%" />
pass=<input type="password" name="%cursor%" id="%cursor%" />
textarea=<textarea name="%cursor%" cols="50" rows="10" id="%cursor%" ></textarea>
select=<select name="%cursor%" id="%cursor%">\n\t<option value="%cursor%"></option>\n</select>
radio=<input type="radio" name="%cursor%" value="%cursor%" />
checkbox=<input type="checkbox" name="%cursor%" value="%cursor%" />
button=<button type="%cursor%">%cursor%</button>
fieldset=<fieldset>\n\t<legend>%cursor%</legend>\n</fieldset>
# list
ul=<ul class="%cursor%">\n\t<li>%cursor%</li>\n</ul>
ol=<ol class="%cursor%">\n\t<li>%cursor%</li>\n</ol>
li=<li>%cursor%</li>
dl=<dl class="%cursor%">\n\t<dt>%cursor%</dt>\n\t<dd>%cursor%</dd>\n</dl>
dt=<dt>%cursor%</dt>
dd=<dd>%cursor%</dd>
# inline
a=<a href="%cursor%">%cursor%</a>
span=<span>%cursor%</span>
em=<em>%cursor%</em>
small=<small>%cursor%</small>
big=<big>%cursor%</big>
cite=<cite>%cursor%</cite>
strong=<strong>%cursor%</strong>
img=<img src="%cursor%" alt="%cursor%" title="%cursor%" />
thumb=<a href="%cursor%"><img src="%cursor%" alt="%cursor%" title="%cursor%" /></a>
# block
div=<div class="%cursor%">%cursor%</div>
h1=<h1>%cursor%</h1>
h2=<h2>%cursor%</h2>
h3=<h3>%cursor%</h3>
h4=<h4>%cursor%</h4>
h5=<h5>%cursor%</h5>
h6=<h6>%cursor%</h6>
p=<p>%cursor%</p>
pre=<pre>\n%cursor%\n</pre>
code=<code>%cursor%</code>
prec=<pre><code>%cursor%</code></pre>
quote=<blockquote>\n\t<p>\n\t\t%cursor%\n\t</p>\n</blockquote>
# other
cl=class="%cursor%"
id=id="%cursor%"
cmt=<!--\n\t%cursor%\n-->
cmt2=<!-- %cursor% -->
br=<br/>
hr=<hr/>
1s= 
3s=   
7s=       
dummyimage=<img src="http://dummyimage.com/%cursor%x%cursor%/000/fff.png" alt="" title="" />
dummyimage2=<img src="http://lorempixel.com/%cursor%/%cursor%/" alt="" title="" />

[CSS]
# by Tomasz Karbownicki <tomasz at karbownicki.com>
bc=background-color: %cursor%;
bp=background-position: %cursor%;
bct=background-color: transparent;
ba=background: url(%cursor%) %cursor%;
ma=margin: %cursor%;
pa=padding: %cursor%;
bo=border: %cursor%;
co=color: %cursor%;
cu=cursor: %cursor%;
he=height: %cursor%;
wi=width: %cursor%;
di=display: %cursor%;
fs=font-size: %cursor%;
ff=font-family: %cursor%;
fw=font-weight: %cursor%;
ta=text-align: %cursor%;
ts=text-shadow: %cursor%;
td=text-decoration: %cursor%;
fl=float: %cursor%;
lh=line-height: %cursor%;
im=!important
po=position: %cursor%;
ov=overflow: %cursor%;
op=opacity: 0.5;
ra=-moz-border-radius: %cursor%px; -webkit-border-radius: %cursor%px; border-radius: %cursor%px;
sh=border-shadow: %cursor%px %cursor%px #%cursor% %cursor%px;
cmt=/* ######### %cursor% ######### */
hide=text-indent: 9999em; line-height: 9999em; overflow: hidden;

[C#]
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%

[Vala]
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%

[ActionScript]
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%

[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
# Django templates
if={% if %cursor% %}\n\t\n{% endif %}
for={% for sth in %cursor% %}\n\t%cursor%\n{% endfor %}
dv={{ %cursor% }}
db={% %cursor% %}
dbl={% block %cursor% %}\n\t%cursor%\n{% endblock %}
trans={% trans "%cursor%" %}

[Ferite]
iferr=iferr%block_cursor%fix%block%
monitor=monitor%block_cursor%handle%block%

[Haskell]

[C]
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%

[C++]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close%
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%

[Java]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close%
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%


More information about the Devel mailing list