Find file
Fetching contributors…
Cannot retrieve contributors at this time
130 lines (96 sloc) 6.11 KB
*vim-django.txt* For Vim version 7.3 Last Change: 2012 June 19
Django - A web framework for perfectionist
A vim script for a better way to work with django.
CONTENTS *django-contents*
1. Introduction .......................... |django-introduction|
2. Configuration ......................... |django-configuration|
3. Keymappings ........................... |django-keymappings|
3.1 Editing Related .................... |django-editing-related|
4. Extensions To Vim ..................... |django-extensions|
5. Commands .............................. |django-commands|
6. Custom Setup .......................... |django-custom-setup|
7. Thanks & Contributing ................. |django-thank-contribute|
Introduction *django-introduction*
Django VIM is my extension to vim to making working with django projects
easier. This means making creating new apps, working with your projects
management commands inside of ViM, the script, managing
the apps, and various other extensions.
Configuration *django-configruation*
*django-vim-global-vars* -----------------------------------------------------
*g:project_directory* This should be set to where your projects live.
it needs either a absolute path or you can use the |expand()| to include
your home directory.
g:project_directory = expand('~/Projects')
*g:django_activate_nerdtree* when set to 1 it will activate |NERDTree| if you
are using it. This is only done when activating a new django project.
*g:django_activate_virtualenv* when also set to 1, this will activate a
corresponding virtual environment. The virtual environment must start with
the same name as your project does. An example being: colinbits is my django
project; this will activate the virtualenv.
*g:django_project_container* is used when autocompleting django projects.
If you use a complex project organization structure. This can come in handy
for making autocompletions faster. For example. If you have a
project_name.something/source/django_project. You could set
g:django_projects_container and it will look for your source directory.
Keymappings *django-keymappings*
*django-editing-related* ----------------------------------------------------
There are mappings for editing related source for a django app. The mappings
to edit related files all follow the same pattern. That being. (r) for
related, (m) for, and (t) for tab. So this will be edit the related in a new tab. There is also (s), and (v) for split and vsplit
Extenions to ViM *django-extenions*
Nothing yet...
Commands *django-commands*
*DjangoProjectActivate* activates your project inside of ViM. This has
to be run first in order for the other commands and for ViM to take
full advantage of your project and your site-packages that use django.
*DjangoManage* this will wrap the command for your project. It will
try to autocomplete the commands available to your This is only
problematic if your project doesn't use the standard django settings or can't
be imported by doing from django.conf import settings.
*DjangoAdmin* will wrap the for your systems
script. If you use virtualenv's it should wrap it for your enviroment. This
isn't that different than from |DjangoManage| other than access to the admin
*DjangoCreateApp* will create a new app based on a python path. If you
give it your app.apps.super_cool_app it will create the app there by using
the django-admin and it will also create corresponding init files and
directories if they are not already created.
Custom Setup *django-custom-setup*
Incase you dont use the standard setup method or have the ability to use
the settings enviroment variable from your env. You can create your own
setup function.
The function has to be named *ActivateProject* it should accept a project name
you can also access the other global variables such as |g:project_directory| .
function! ActivateProject(project)
python << EOF
import cbsettings
import sys
The above example will activate a project that uses django-classbasesettings.
If a custom function is not created it will activate the project by adding
the project_directory to sys.path and setting $DJANOG_SETTINGS_MODULE to
Thank You & Contributing *django-thank-contribute*
Thanks for using my little plug-in. I plan on adding more features as I need
them. If there is something you would like to see in this script feel free
to add a issue at the Github project.
It is located at Also feel free to
fork it and send in a pull request. I love seeing people using my code.