= Using Vim with Django = This page is intented to be used as a collection of hints for using the Vim editor with Django. == [http://www.vim.org/scripts/script.php?script_id=1318 SnippetsEmu] == The [http://www.vim.org/scripts/script.php?script_id=1318 SnippetsEmu] plugin for Vim allows one to define abbreviations which can be expanded into larger blocks of text. The abbreviations can also contain place markers which can be 'jumped to' in a similar manner to the macros defined in TextMate on OS X. The following is a collection of Django specific abbreviations for use with the plugin (using the default start and end tags: '<' and '>'): Models: {{{ Iabbr addmodel class <>(meta.Model):<>def __repr__(self):return "%s" % (<>,)class META:admin = meta.Admin() Iabbr mcf meta.CharField(maxlength=<>)<> Iabbr mff meta.FileField(upload_to=<>)<> Iabbr mfpf meta.FilePathField(path=<>, match=<".*">, recursive=)<> Iabbr mfloat meta.FloatField(max_digits=<>, decimal_places=<>)<> Iabbr mfk meta.ForeignKey(<>, edit_inline=)<> Iabbr m2m meta.ManyToManyField(<>)<> Iabbr o2o meta.OneToOneField(<>)<> }}} Templates: {{{ Iabbr fore {% for in %}{{ .<> }}<>{% endfor %}<> }}} == XML.vim == The [http://www.vim.org/scripts/script.php?script_id=301 xml.vim] plugin is really useful for editing XML and HTML files. It makes tag completion easy and allows you to bounce between start and end tags.