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.

On Wed, 2009-01-07 at 12:26 +0100, Oscar Carlsson wrote:
> Have you been able to make omnicomplete work with Django?
> I haven't been able to figure it out myself, and gave up after a few
> tries. It would be really sweet to have, since vim otherwise is a really
> good editor.
> 
> Oscar
> 
> On Wed, Jan 07, 2009 at 12:15:22PM +1930, Santiago wrote:
> > 
> > i recently switched to screen + vim with omnicomplete for python and html...
> > 
> > komodo edit its pretty good too....
> > 
> > 2009/1/7 martyn <andresmartinoc...@gmail.com>:
> > >
> > > Hi
> > >
> > > http://pyrox.utp.edu.co/
> > >
> > > Regards
> > >
> > > Bye.
> > >
> > > On Jan 6, 9:34 am, roberto <robertomariobeni...@gmail.com> wrote:
> > >> I tried them all (almost ... I think... at least the free ones).
> > >> - Pyscripter is really nice but it is true, it is only for windows.
> > >> (If it is developed with python it should be platform-independent,
> > >> shouldn' be ?) (no support for sql queries I think)
> > >> - Eclipse + PyDev (no good support for sql queries to relational db)
> > >> - Ulipad (open source / excellent / very small / some issues with
> > >> svn / no support for sql queries to db - django plugin to highlight
> > >> templates, etc)
> > >> - Netbeans (ex-NBPython) it is excellent (very good sql support - some
> > >> issues with memory consume - I didn't get debugger work 100% with
> > >> django)
> > >> - Oracle jdeveloper. it is an excellent tool. Its support for python
> > >> is still too new and I think that django support is still to come.
> > >> - Eric4: screenshots are very beautiful bu I couldn't get to install
> > >> it in my ubuntu box (too many precedences and too complicated for a
> > >> newbie like me).
> > >>
> > >> Have a great year 2009 everyone !
> > >>
> > >> On Jan 6, 9:02 am, "Trivedi, Apaar" <apaar.triv...@nymag.com> wrote:
> > >>
> > >> > I use Eclipse with PyDev and PyDev extensions.  I really like it, but I
> > >> > prefer the eclipse sort of IDE's.
> > >>
> > >> > ________________________________
> > >>
> > >> > From: django-users@googlegroups.com
> > >> > [mailto:django-us...@googlegroups.com] On Behalf Of Damien Hou
> > >> > Sent: Tuesday, January 06, 2009 8:43 AM
> > >> > To: django-users@googlegroups.com
> > >> > Subject: Re: Your IDE of choice
> > >>
> > >> > TextMate with Django and Django Templates bundles is pretty neat
> > >>
> > >> > On Tue, Jan 6, 2009 at 7:48 PM, HB <hubaghd...@gmail.com> wrote:
> > >>
> > >> > Hey,
> > >> > What is your favorite IDE for coding Django projects?
> > >> > Any ideas about PyDev and ActiveState Komodo IDE?
> > >> > Thanks.
> > >>
> > >> > --
> > >> > Best Regards,
> > >> > Damien
> > > >
> > >
> > 
> > > 
> 
> -- 
Adam Stein @ Xerox Corporation       Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to