Recently I came back to Django development and after a year my set of tools had change a lot. Mainly because vim became my main text editor.
The following lines of code will turn vim into a more powerful tool to work with Django and Python, place them inside your
First lines are activating the Omni Completion feature of Vim for those type of files and the last lines reference Super Tab which installed as a plugin.
Now we will define a wrapper, paste this lines inside a file called djvim (DON’T FORGET TO MODIFY YOUR PROJECT PATH):
<code>PROJECT_PATH="/home/marin/Code" if [ $# -eq 2 ] then export PYTHONPATH="$PROJECT_PATH/$1" export DJANGO_SETTINGS_MODULE=$1.settings vim $2 else echo "Usage: djvim [Project] [File]" fi </code>
then make the file executable and move it to your /bin folder, that will do the trick. Test djvim with:
<code>[email protected]:$ djvim myproject models.py </code>
and inside Vim type:
<code>:python from django import db </code>
Then test the autocomplete with some functions, launch it with the Tab key.