Version 3 (modified by 19 years ago) ( diff ) | ,
---|
Using Vim with Django
This page is intented to be used as a collection of hints for using the Vim editor with Django.
SnippetsEmu
The 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):<CR><><CR><CR>def __repr__(self):<CR>return "%s" % (<>,)<CR><CR>class META:<CR>admin = meta.Admin()<CR><CR> Iabbr mcf meta.CharField(maxlength=<>)<CR><> Iabbr mff meta.FileField(upload_to=<>)<CR><> Iabbr mfpf meta.FilePathField(path=<>, match=<".*">, recursive=<False>)<CR><> Iabbr mfloat meta.FloatField(max_digits=<>, decimal_places=<>)<CR><> Iabbr mfk meta.ForeignKey(<>, edit_inline=<False>)<CR><> Iabbr m2m meta.ManyToManyField(<>)<CR><> Iabbr o2o meta.OneToOneField(<>)<CR><>
Templates:
Iabbr fore {% for <entry> in <list> %}<CR>{{ <entry>.<> }}<CR><>{% endfor %}<CR><>
XML.vim
The 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.
Attachments (5)
-
python.vim
(572 bytes
) - added by 19 years ago.
Sample ftplugin file containing SnippetsEmu abbreviations for Django models
-
django.tar.gz
(4.6 KB
) - added by 19 years ago.
Unzip this file in your ~/.vim/ directory to install snippetsEmu.vim and Django specific abbreviations
-
django-vim-taglist.png
(56.7 KB
) - added by 18 years ago.
screenshot of vim with the taglist plugin
-
django_url_snippets.vim
(544 bytes
) - added by 16 years ago.
SnippetsEmu for urls.py
-
django_view_snippets.vim
(310 bytes
) - added by 16 years ago.
SnippetsEmu for views.py
Download all attachments as: .zip