Manually loading SnippetsEmu's Django snippets

Posted 8 June 2008

To manually load SnippetsEmu’s Django model and template snippets, I run the following command in Vim:

:runtime! ftplugin/django_*_snippets.vim

Following the Using Vim with Django guide, I added the following lines to my python.vim file:

if getline(1) =~ 'from django.db import models' runtime! ftplugin/django_model_snippets.vim endif

filetypes.vim detects django templates as the filetype htmldjango, so all that needs to be done to enable the template snippets is to rename django_template_snippets.vim to htmldjango.vim. Creating htmldjango.vim with the one-liner

runtime! ftplugin/django_template_snippets.vim

has the same effect.

Comment