Is there any way to get python omnicomplete to work with non-system modules in vim?


Question

The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on.

1
9
10/13/2008 10:08:26 PM

Accepted Answer

I get completion for my own modules in my PYTHONPATH or site-packages. I'm not sure what version of the pythoncomplete.vim script you're using, but you may want to make sure it's the latest.

EDIT: Here's some examples of what I'm seeing on my system...

This file (mymodule.py), I puth in a directory in PYTHONPATH, and then in site-packages. Both times I was able to get the screenshot below.

myvar = 'test'

def myfunction(foo='test'):
    pass

class MyClass(object):
    pass
2
3/29/2018 3:00:50 AM

Once I generated ctags for one of my site-packages, it started working for that package -- so I'm guessing that the omnicomplete function depends on ctags for non-sys modules.

EDIT: Not true at all.

Here's the problem -- poor testing on my part -- omnicomplete WAS working for parts of my project, just not most of it.

The issue was that I'm working on a django project, and in order to import django.db, you need to have an environment variable set. Since I couldn't import django.db, any class that inherited from django.db, or any module that imported a class that inherited from django.db wouldn't complete.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon