Skip to content

Instantly share code, notes, and snippets.

@mritzco
Created April 26, 2016 06:16
Show Gist options
  • Save mritzco/0385de67325f4b3de98e5ffe0ef0e5fd to your computer and use it in GitHub Desktop.
Save mritzco/0385de67325f4b3de98e5ffe0ef0e5fd to your computer and use it in GitHub Desktop.
Geany snippets
# 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=\s{\n\t%cursor%\n}
block_cursor=\s{\n\t%cursor%\n}\n%cursor%
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# Optional keybindings to insert snippets
# Note: these can be overridden by Geany's configurable keybindings
[Keybindings]
#for=<Ctrl>7
[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%
[PHP]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for ($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%
[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
[Ferite]
iferr=iferr%block_cursor%fix%block%
monitor=monitor%block_cursor%handle%block%
[Haskell]
[HTML]
table=<table>\n\t<tr>\n\t\t<td>%cursor%</td>\n\t</tr>\n</table>
row=<div class="row">\n\t%cursor%\n</div>
row2=<div class="row">\n\t<div class="col-sm-6">\n\t\t%cursor%\n\t</div>\n\t<div class="col-sm-6">\n\t\t%cursor%\n\t</div>\n</div>
row3=<div class="row">\n\t<div class="col-sm-4">\n\t\t%cursor%\n\t</div>\n\t<div class="col-sm-4">\n\t\t%cursor%\n\t</div>\n\t<div class="col-sm-4">\n\t\t%cursor%\n\t</div>\n</div>
t1=<div class="row title1">\n\t<div class="col-md-12">\n\t\t<h1>%cursor%</h1>\n\t</div>\n</div>
t2=<div class="row title2">\n\t<div class="col-md-12">\n\t\t<h2>%cursor%</h1>\n\t</div>\n</div>
t3=<div class="row title3">\n\t<div class="col-md-12">\n\t\t<h3>%cursor%</h1>\n\t</div>\n</div>
thumb=<div class="thumbnail">\n\t<img src="/img/%cursor%.jpg" alt="" class="thumbnail col-sm-12">\n\t<h4>%cursor%</h4>\n\t<p>%cursor%</p>\n</div><!--thumb-->
img=<img src="/img/%cursor%" alt="" />
js=<script type="text/js">%cursor%</script>
script=<script src="%cursor%.js"></script>
css=<link rel="stylesheet" type="text/css" href="%cursor%.css" />
[Erlang]
case=case %cursor% of\n\t%cursor% -> %cursor%\nend
if=if\n\t%cursor% -> %cursor%\nend
begin=begin\n\t%cursor%\nend
fun=fun(%cursor%) ->\n\t%cursor%\nend
try=try %cursor% of\n\t%cursor% ->\n\t%cursor%\ncatch\n\t%cursor% ->\n\t%cursor%\nend
module=-module(%cursor%).
export=-export(%cursor%).
compile=-compile(%cursor%).
include=-include(%cursor%).
[MarkDown]
jscode=```javascript\n```
[Scala]
app=object %cursor% {\n\tdef main(args: Array[String]) {\n\n\t}\n}
save=saveAsTextFile(%cursor%)
load=textFile(%cursor)
count=map( line => (%cursor%, 1)).\n\treduceByKey( (a,b) => a+b ).\n\tsortByKey().\n\tmap( item => item.swap ).\n\tsortByKey(false,1).\n\tmap(item => item.swap)
[Javascript]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (var i = 0, len = %cursor%.length; i < len; i++) {\n\t\n}
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 (e)%block_cursor%
log=console.log(%cursor%);
app=var app = angular.module("%cursor%", [/* dep modules*/]);
factory=angular.module("%cursor%").factory('%cursor%', ['%cursor%', function (%cursor%)\n{\n /* Internal functions */\n return {\n\t\t/* public functions */\n\t\tpublic : function() {}\n }\n}]);
controller=angular.module("%cursor%").controller('%cursor%', ['$scope', function ($scope) {\n\t\n}]);\n
directive=angular.module("%cursor%").directive('%cursor%', [function() {\n\tvar tpl = '';\n\treturn {\n\t\trestrict: 'EA',\n\t\tscope: {/* @, =, &, true,false, empty*/},\n\t\ttransclude: true,\n\t\treplace: true,\n\t\ttemplate: tpl ,\n\t\tcontroller: ['$scope', function($scope){\n\t\t\t\n\t\t}],\n\t\tlink: function(scope, el, at, ctrl) {\n\t\t\t\n\t\t}\n\t} //return\n}]);\n
service=angular.module("%cursor%").service('%cursor%', [ /* Dependencies */\n\tfunction(){\n\t\t// Variables and internal functions\n\t\t\n\t\t\n\t\treturn {\n\t\t\t/* Public methods or exposed internal ones */\n\t\t};\n\t}\n]);\n
module=(function() {\n\t"use strict";\n\t/* variables & includes */\n\n\tvar methods = {};\n\tvar priv = {};\n\t\n\t/* private functions and public methods */\n\t%cursor%\n}());\n
onload=$(function() {\n\tconsole.log( "ready!" );\n});
has=hasOwnProperty(%cursor%)
own=Object.getOwnPropertyNames(%cursor%);
mod2=var module = (function () {\n\t// private variables and functions\n\tvar foo = 'bar';\n\n\t// constructor\n\tvar module = function () {\n\t};\n\n\t// prototype\n\tmodule.prototype = {\n\t\tconstructor: module,\n\t\tsomething: function () {\n\t\t}\n\t};\n\n\t// return module\n\treturn module;\n})();\n\nvar my_module = new module();
desc=describe('%cursor%', function() {\n\t\n});
it=it('%cursor%',function(done) {\n\tdone();\n});
xp=expect(%cursor%).to.
xeq=expect(%cursor%).to.equal();
xdeep=expect(%cursor%).to.deep.equal();
x1=expect(%cursor%).to.be.true;
x0=expect(%cursor%).to.be.false;
xhas=expect(%cursor%).to.haveOwnProperty();
after=after(function(done) {\n\t\n});
before=before(function(done) {\n\t\n});
end=end(function(err, res){\n\tif (err) return done(err);\n\t\n\tdone();\n});
cc=/* %cursor% */
mod3=(function() {\n\t"use strict";\n\t%cursor%\n})();
cb=function(err) {\n\t%cursor%\n}
cbd=%cursor%, function(err, data) {\n\t%cursor%\n});
fn=function %cursor%() { \n\t\n}
cb=function(err, data) {\n\t%cursor%\n});
chai="use strict"\nvar chai = require('chai');\nvar expect = chai.expect;
adel=splice(%cursor%,1);
adelat=splice(%cursor%.indexOf(),1);
arrins=Array.prototype.splice.apply(%cursor%, [idx, 0].concat( /*other array*/ ));
arrcopy=.slice();
chalk=console.log(chalk.%cursor%(''), );
forin=for(var item in %cursor%) {\n\t\n}
throw= throw "%cursor%"
timeloop=(function myLoop () {\n\tsetTimeout(function () {\n\t\t//Your code goes here\n\t\tif (condition_for_running) myLoop(); // call loop again if condition is valid\n\t}, 200)\n})();
exit=process.exit();
timer=setInterval (\n\tfunction() {\n\t\t//do something\n\t},\n\t500 // Time\n);
apply=$scope.$apply(function() %block% );
time=$timeout( function() %block%, %cursor% );
debug=debugger
case= case %cursor%:\n\t\nbreak;
util=console.log(util.inspect(%cursor%, false, 6, true));
keys=Object.keys(%cursor%)
olen=Object.keys(%cursor%).length
oeach=Object.keys(%cursor%).forEach(function(key) {\n\t\n});
each=forEach(function(item) {\n\t%cursor%\n});
asyncloop=var countdown = %cursor%.length;\nfor (var i = 0, len = %cursor%.length; i < len; i++) {\n\t /*jshint -W083 */\n\t obj.method(params, function (err, data) {\n\t\t if (err) grunt.log.error(err);\n\t\t if (--countdown === 0) {\n\t\t\t done();\n\t\t }\n\t });\n }\n
longtest=this.timeout(8000);
def="undefined" !== typeof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment