Changes between Version 12 and Version 13 of UsingVimWithDjango


Ignore:
Timestamp:
Jul 7, 2006, 4:06:56 PM (18 years ago)
Author:
Lllama
Comment:

Updated snippetsemu examples for latest versions of django and the plugin

Legend:

Unmodified
Added
Removed
Modified
  • UsingVimWithDjango

    v12 v13  
    1919One can add specific abbreviations for models or templates based on file contents.  Adding the following line to your ~/.vim/ftplugin/python.vim file (create it if you don't have it) will allow you to define abbreviations just for models:
    2020{{{
    21 if getline(1) =~ 'from django.core import meta'
     21if getline(1) =~ 'from django.db import models'
    2222    "Your abbreviations here
    2323endif
     
    2929
    3030{{{
    31 Iabbr addmodel class <>(meta.Model):<CR><><CR><CR>def __repr__(self):<CR>return "%s" % (<>,)<CR><CR>class META:<CR>admin = meta.Admin()<CR><CR>
    32 Iabbr mcf meta.CharField(maxlength=<>)<CR><>
    33 Iabbr mff meta.FileField(upload_to=<>)<CR><>
    34 Iabbr mfpf meta.FilePathField(path=<>, match=<".*">, recursive=<False>)<CR><>
    35 Iabbr mfloat meta.FloatField(max_digits=<>, decimal_places=<>)<CR><>
    36 Iabbr mfk meta.ForeignKey(<>, edit_inline=<False>)<CR><>
    37 Iabbr m2m meta.ManyToManyField(<>)<CR><>
    38 Iabbr o2o meta.OneToOneField(<>)<CR><>
     31Iabbr addmodel class <>(models.Model):<CR><><CR><CR>def __str__(self):<CR>return "%s" % (<>,)<CR><CR>class Admin:<CR>pass<CR><CR>
     32Iabbr mcf models.CharField(maxlength=<>)<CR><>
     33Iabbr mff models.FileField(upload_to=<>)<CR><>
     34Iabbr mfpf models.FilePathField(path=<>, match="<>", recursive=<False>)<CR><>
     35Iabbr mfloat models.FloatField(max_digits=<>, decimal_places=<>)<CR><>
     36Iabbr mfk models.ForeignKey(<>, edit_inline=<False>)<CR><>
     37Iabbr m2m models.ManyToManyField(<>)<CR><>
     38Iabbr o2o models.OneToOneField(<>)<CR><>
    3939}}}
    4040
Back to Top