Skip to content

Instantly share code, notes, and snippets.

@vstoykov
Created October 21, 2011 08:36
Show Gist options
  • Save vstoykov/1303367 to your computer and use it in GitHub Desktop.
Save vstoykov/1303367 to your computer and use it in GitHub Desktop.
Add some Python and Django snippets to default Python snippets for 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 ot %ws% for an indentation step, if using only spaces for indentation only spaces will be used
# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue')
# use %cursor% to define where the cursor should be placed after completion
# use %key% for all keys defined in the [Special] section
# 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
[Python]
for=for i in xrange(%cursor%):\n\t%cursor%
doc=""" %cursor% """\n
elif=elif %cursor%:\n\t%cursor%\n%cursor%
else=else:\n\t%cursor%
if=if %cursor%:\n\t%cursor%\n%cursor%
from=from %cursor% import %cursor%\n
main=if __name__ == '__main__':\n\t%cursor%
class=class %cursor%(object):\n\t""" %cursor% """\n\t\n\tdef __init__ (self):\n\t\t""" Class initialiser """\n\t\t%cursor%
def=def %cursor%(self):\n\t""" %cursor%\n\n\t@param PARAM: DESCRIPTION\n\t@return RETURN: DESCRIPTION\n\t"""\n\t%cursor%
get=def get_%cursor%(self): return self.%cursor%\n
set=def set_%cursor%(self, var): self.%cursot% = var\n
.=self.%cursor%
try=try:\n\t%cursor%\nexcept Exception, e:\n\t%cursor%
py=#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\n%cursor%
while=while %cursor%:\n\t%cursor%
with=with %cursor%:\n\t%cursor%
head="""\n\t%cursor%PROJECT - MODULE\n\n\tDESCRIPTION\n\n\t@copyright: {year} by {developer} <{mail}>\n\t@license: GNU GPL, see COPYING for details.\n"""\n
superinit=def __init__(self, *args, **kwargs):\n\t%cursor%\n\tsuper(%cursor%, self).__init__(*args, **kwargs)
supersave=def save(self, *args, **kwargs):\n\t%cursor%\n\treturn super(%cursor%, self).save(*args, **kwargs)
model=class %cursor%(models.Model):\n\t""" %cursor% """\n\t\n\tclass Meta:\n\t\t%cursor%\n\t\n\tdef __unicode__(self):\n\t\treturn u'%s' % (self.%cursor%,)
admin=class %cursor%(admin.ModelAdmin):\n\tlist_display = ('%cursor%', )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment