Does anyone know how to set up auto completion to work nicely with python, django, and vim?
I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I also run pysmell in the project directory. Vim doesn't pick up the django tags, though, and they don't get auto completed.
Does anyone know how to set up auto completion in vim so that it will complete the long django functions (like get_object_or_404) as well as classes/functions in my own code? I have poked around on google but haven't found any good resources.
First off, thank you for asking this question, as it forced me to figure this out myself and it's great!
Here is the page I used as a reference: PySmell v0.6 released : orestis.gr
PYSMELLTAGSfile for django by going to your
site-packages/djangodirectory and running:
pysmell . -o ~/PYSMELLTAGS.django
pysmell .to generate the project PYSMELLTAGS file
I realize this is not a sustainable solution, but you should be able to use this as a start to getting it setup to always work (e.g., add the export to your .bashrc, add the :source to your .vimrc, setup
autocmd FileType python set omnifunc=pysmell#Complete, etc.)
Let me know if this is enough to get you started. It worked for me!
I simply added this to my .vimrc and as long as the
PYSMELLTAGS.django files are in my project root, it works fine without any other work:
python << EOF import os import sys import vim sys.path.append("/usr/local/python/lib/python2.5/site-packages") EOF exe ":source ~/src/pysmell/pysmell.vim" autocmd FileType python set omnifunc=pysmell#Complete
As I wrote in other places, I developed Jedi. I really think it is far better than all the existing solutions (even PyCharm).
It is built upon pythoncomplete and much much more powerful!
It works for complex code:
And has additional features:
There is a list of all possible features:
isinstancechecks for if/while/assert