Skip to content

Instantly share code, notes, and snippets.

@Frodox
Forked from scriptum/snippets.conf
Last active April 9, 2024 19:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Frodox/076c9acf8c124adcb548 to your computer and use it in GitHub Desktop.
Save Frodox/076c9acf8c124adcb548 to your computer and use it in GitHub Desktop.
# 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.
# Use {command:cmd} to execute a specified command and put the command's output into the template.
# In the environment of the executed command the variables GEANY_FILENAME, GEANY_FILETYPE and GEANY_FUNCNAME are set.
# 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
# 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}
my_name={command:sh -c '. ~/.bashrc_private; echo $_MY_ORG_NAME'}
my_mail={command:sh -c '. ~/.bashrc_private; echo $_MY_ORG_MAIL'}
my_company={command:sh -c '. ~/.bashrc_private; echo $_MY_COMPANY'}
my_company_url={command:sh -c '. ~/.bashrc_private; echo $_MY_COMPANY_URL'}
date={command:sh -c "LC_ALL=C date +'%a %b %d %Y'"}
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# Default is used for all filetypes and keys can be overwritten by [filetype] sections
[Default]
if=if(%cursor%)%block%
else=else%block%
for=for(i = 0; i < %cursor%; i++)%block%
forj=for(j = 0; j < %cursor%; j++)%block%
fork=for(k = 0; k < %cursor%; k++)%block%
while=while%(%cursor%)%block%
#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%
line=################################################################################
printd=printf("%d\\n", %cursor%);
prints=printf("%s\\n", %cursor%);
printp=printf("%p\\n", %cursor%);
printx=printf("%x\\n", %cursor%);
printss=printf("%s %s\\n", %cursor%);
printsss=printf("%s %s %s\\n", %cursor%);
printf=printf("%cursor%\\n");
puts=puts(%cursor%);
spec=Name: \nVersion: \nRelease: 1%{?dist}\nSummary: \nSummary(ru): \nGroup: System Environment/Base\nLicense: Copyright %my_company%. All rights reserved.\nURL: %my_company_url%\n\nSource0: %name-%version.tar.gz\n\nBuildRequires:\nRequires:\n\n%description\n%description -l ru\n\n\n%prep\n%setup -q\n\n\n%build\n%configure\nmake %{?_smp_mflags}\n\n\n%install\n%makeinstall\n\n\n%clean\nrm -rf $RPM_BUILD_ROOT\n\n\n%files\n%defattr(-,root,root,-)\n%doc\n\n\n\n%changelog
log=* %date% %my_name% <%my_mail%>\n- %cursor%\n
i=#include <%cursor%>
in=#include "%cursor%"
ii=#include "%cursor%"
omp=#pragma omp parallel
ompfor=#pragma omp parallel for
MIT={command:sh -c 'curl -s https://raw.githubusercontent.com/licenses/license-templates/master/templates/mit.txt | sed -e "s/.. year ../$(date +%Y)/" -e "s/.. organization ../$(. ~/.bashrc_private; echo "$_MY_NAME <$_MY_MAIL>")/"'}
sh=#!/bin/sh\n\n
bash=#!/bin/bash\n\n
py=#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\n%cursor%
nim=import strutils, tables\n\n
dn=/dev/null
f={filename}
[C++]
for=for(int i = 0; i < %cursor%; i++)%block%
forj=for(int j = 0; j < %cursor%; j++)%block%
fork=for(int k = 0; k < %cursor%; k++)%block%
do=do\s{\n\t%cursor%\n}\swhile(%cursor%);
main=int main(int argc, char **argv)%block_cursor%
line=/******************************************************************************/
[C]
do=do\s{\n\t%cursor%\n}\swhile(%cursor%);
main=int main(int argc, char **argv)%block_cursor%
std=#include <stdio.h>\n\nint main(int argc, char **argv)%block_cursor%
line=/******************************************************************************/
if=if(%cursor%)%block_cursor%
ife=if(%cursor%)%block_cursor%\nelse%block_cursor%
ifee=if(%cursor%)%block_cursor%\nelse if(%cursor%)%block_cursor%\nelse%block_cursor%
elif=else if(%cursor%)%block_cursor%
else=else%block_cursor%
for=for(i = 0; i < %cursor%; i++)%block%
forj=for(j = 0; j < %cursor%; j++)%block%
fork=for(k = 0; k < %cursor%; k++)%block%
while=while%(%cursor%)%block%
switch=switch(%cursor%)%brace_open%case %cursor%:\n\t\t%cursor%\n\t\tbreak;\n\tdefault:\n\t\t%cursor%\n%brace_close%%cursor%
d=#define
df=#define %cursor% do {\\\n\t%cursor%\\\n} while(0);
istd=#include <stdio.h>\n
istr=#include <string.h>\n
istl=#include <stdlib.h>\n
ifd=#ifdef %cursor%\n%cursor%\n#endif
ifde=#ifdef %cursor%\n%cursor%\n#else\n%cursor%\n#endif
ifnd=#ifndef %cursor%\n%cursor%\n#endif
ifnde=#ifndef %cursor%\n%cursor%\n#else\n%cursor%\n#endif
delse=#else\n%cursor%\n#endif
defelse=#else\n%cursor%\n#endif
file=FILE *f;\nf = fopen("%cursor%", "r");\nif(NULL == f)\n{\n\tperror("Cannot open file");\n}\nelse\n{\n\tfclose(f);\n}
fgets=char buf[512];\nwhile(fgets(buf, sizeof(buf), %cursor%f))\n{\n\tputs(buf);\n}
fline=char *line = NULL;\nsize_t len;\nwhile(getline(&buf, &len, stdin) != -1)%block_cursor%\nfree(line);
cloc=clock_t start = clock();\n%cursor%\nclock_t end = clock();\nfloat seconds = (float)(end - start) / CLOCKS_PER_SEC;\nprintf("%.1f\\n", seconds);
[Java]
[PHP]
for=for($i = 0; $i < %cursor%; $i++)%brace_open%\n%brace_close%
forj=for($j = 0; $j < %cursor%; $j++)%brace_open%\n%brace_close%
fork=for($k = 0; $k < %cursor%; $k++)%brace_open%\n%brace_close%
foreach=foreach (%cursor% as $v)%brace_open%\n%brace_close%
explode_nl=explode("\\n", str_replace("\\r", '', %cursor%))
opendir=$dir = '';\nif ($dh = opendir($dir)) %brace_open%while (($file = readdir($dh)) !== false) \n\t{\n\t\tif($file != '.' && $file != '..')\n\t\t{\n\t\t\t%cursor%\n\t\t}\n\t}\n\tclosedir($dh);\n%brace_close%
[Python]
for=for i in xrange(%cursor%):\n\t%cursor%
if=if %cursor%:\n\t%cursor%
elif=elif %cursor%:\n\t%cursor%
else=else:\n\t%cursor%
while=while %cursor%:\n\t%cursor%
try=try:\n\t%cursor%\nexcept:\n\t
with=with %cursor%:\n\t%cursor%
def=def %cursor% (%cursor%):\n\t""" Function doc """\n\t%cursor%
class=class %cursor%:\n\t""" Class doc """\n\t\n\tdef __init__ (self):\n\t\t""" Class initialiser """\n\t\tpass
stderr=sys.stderr.write('%cursor%\\n')
filesize=os.stat(%cursor%).st_size
rm=os.unlink(%cursor%)
rmfr=shutil.rmtree(%cursor%, True)
fline=with open("%cursor%") as f:\n\tfor line in f:\n\t\t%cursor%
pool=pool = Pool()\npool.map(%cursor%, [])\npool.close()\npool.join()
pool_full=from multiprocessing import Pool\npool = Pool()\npool.map(%cursor%, [])\npool.close()\npool.join()
sub=import subprocess\n%cursor% = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE).communicate()[0]
time=start = time.time()\n%cursor%\nend = time.time()\nprint end - start
fload== open("%cursor%").read()
i=import %cursor%
[HTML]
# by Tomasz Karbownicki <tomasz@karbownicki.com>
# top
html5=<!DOCTYPE html>\n<html lang="en">\n<head>\n\t<meta charset="utf-8" />\n\t<title>%cursor%</title>\n</head>\n<body>\n\t%cursor%\n</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=&nbsp;
3s=&nbsp;&nbsp;&nbsp;
7s=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dummyimage=<img src="http://dummyimage.com/%cursor%x%cursor%/000/fff.png" alt="" title="" />
dummyimage2=<img src="http://lorempixel.com/%cursor%/%cursor%/" alt="" title="" />
# 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%" %}
# 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%');
[Ferite]
iferr=iferr%block_cursor%fix%block%
monitor=monitor%block_cursor%handle%block%
[Lua]
for=for %cursor% do\n\t\nend
fori=for i = %cursor%, %cursor% do\n\t\nend
forj=for j = %cursor%, %cursor% do\n\t\nend
fork=for k = %cursor%, %cursor% do\n\t\nend
while=while %cursor% do\n\t\nend
repeat=repeat\n\t\nuntil %cursor%
do=do\n\t%cursor%\nend
then=then\n\t%cursor%\nend
else=else\n\t%cursor%
if=if %cursor% then\n\t%cursor%\nend
ife=if %cursor% then\n\t%cursor%\nelse\n\t%cursor%\nend
ifee=if %cursor% then\n\t%cursor%\nelseif %cursor% then\n\t%cursor%\nelse\n\t%cursor%\nend
ifeee=if %cursor% then\n\t%cursor%\nelseif %cursor% then\n\t%cursor%\nelseif %cursor% then\n\t%cursor%\nelse\n\t%cursor%\nend
f=function(%cursor%)\n\t\nend
line=--------------------------------------------------------------------------------
[Sh]
do=do\n\t%cursor%\ndone
if=if [[ %cursor% ]]; then\n\t%cursor%\nfi
ife=if [[ %cursor% ]]; then\n\t%cursor%\nelse\n\t%cursor%\nfi
case=case $%cursor% in\n)\n\t\n;;\n*)\n\t\n;;\nesac
for=for %cursor% in %cursor%\ndo\n\t%cursor%\ndone
else=else\n\t
f=%cursor%(){\n\t%cursor%\n}
DIR=DIR=$(dirname $(readlink -f "$BASH_SOURCE"))
utils=DIR=$(dirname $(readlink -f "$BASH_SOURCE"))\n. "$DIR/utils.sh"
[Nim]
for=for i in 0..%cursor%:\n\t%cursor%
forj=for j in 0..%cursor%:\n\t%cursor%
fork=for k in 0..%cursor%:\n\t%cursor%
forin=for %cursor% in %cursor%:\n\t%cursor%
if=if %cursor%:\n\t%cursor%
elif=elif %cursor%:\n\t%cursor%
else=else:\n\t%cursor%
while=while %cursor%:\n\t%cursor%
try=try:\n\t%cursor%\nexcept:\n\t
with=with %cursor%:\n\t%cursor%
def=proc %cursor% (%cursor%):\n\t%cursor%
proc=proc %cursor% (%cursor%) =\n\t%cursor%
cproc=proc %cursor% (%cursor%): cint {.importc, header:"%cursor%".}
fline=for line in "%cursor%".lines:\n\t%cursor%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment