I have omnicomplete working (haven't used it too much yet). I have this
in my $HOME/.vimrc file:
--.vimrc--
if has("autocmd")
autocmd BufRead *.py set smartindent
\ cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set
omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
endif
" Allow <C-space> to be used instead of <C-x><C-o> like other IDE's do
" for auto-completion
inoremap <Nul> <C-x><C-o>
--.vimrc--
All 'autocmd' lines should be single lines.
Also, I have vim starting automatically importing the Django db. I have
a little script (below) that will automatically find my settings.py file
and start vim. I do this by starting at the location of the file on the
vim command line and working upwards in the directory structure until I
find it:
--dvim--
#!/packages/bin/python
"""
Start vim for Django files
"""
import os
import sys
args = sys.argv
# Get our starting directory to look for the settings file. If no
# filename is given, start in the current directory
if len(args) > 1:
# If multiple filenames are given on the command line, we assume
# the same Django settings apply to all
dir = os.path.realpath(os.path.dirname(args[1]))
else:
dir = os.path.realpath(".")
# Start looking for the settings file, going up one directory if we
# don't find it until we hit the top of the filesystem
while not os.path.exists(dir + "/settings.py"):
if dir == "/":
# We are as far as we can go and didn't find anything
dir = None
break
# Go up one directory
dir = os.path.dirname(dir)
if dir != None:
# Found the settings file
os.putenv("PYTHONPATH", os.path.dirname(dir))
os.putenv("DJANGO_SETTINGS_MODULE", os.path.basename(dir) +
".settings")
os.system("/packages/bin/vim '+python from django import db' " + \
" ".join(args[1:]))
else:
raise IOError("Django settings file not found")
sys.exit(0)
--dvim--
I'm sure some lines are probably getting wrapped.
I only use Django on Unix/Linux so I'm guessing it would need some
tweaking for Windows.
> --
Adam Stein @ Xerox Corporation Email:
ad...@eng.mc.xerox.com
Disclaimer: Any/All views expressed
here have been proven to be my own. [
http://www.csh.rit.edu/~adam/]