2
votes

I'm trying to create a shared C library that uses the gobject library as foundation. So my object inherits in GObject speak from GObject. GObject allows bindings to all different scripting languages such as Python via GObject introspection. Then from python one can import the library from the gi.repository.

import gi
gi.require_versions({'Edf': '0.0', 'GLib': '2.0'})
from gi.repository import Edf

Vim offers autocompletion via jedi-vim. This works out of the box for other libraries making use of the GObject introspections, such as GLib and GTK. I would like use pytest to run some unit tests of the libraries. I would like very much to edit my files using vim with autocompletion for my own library. So if I import a library as Above, I do get autocompletion for GLib, but not for my Edf module.

I've tried to getting autocompletion to work via setting the GI_TYPELIB_PATH environmental variable to the directory containing my Edf.typelib file. Also I've created a debian package and intstalled the library to /usr/lib/x86_64-linux-gnu/ and the typelib to /usr/lib/x86_64-linux-gnu/girepository-1.0/, both these methods are enough to get autocompletion in REPL's such as bpython3, ipython3 and even the python REPL, however I'm unable to get completion using jedi-vim inside vim.

I would be very happy to see it working. Has anyone any tips to get it to work?

Best regards and thank you for your attention.

2

2 Answers

0
votes

I had a similar error because of a mismatch between the python version I intended to use and the one that was called.

Make sure jedi is using the intended version of python. E.g. add let g:jedi#force_py_version = 3 to your .vimrc

0
votes

I think the problem is your vim version is too low,I suggest you update to vim 7.4 and make sure it has open the python function,If you want autocomplete function, I suggest you can try You complete Me,It is more powerful,it need Vim 7.3.584+,now the vim 7.4 is come out,it is easy to install, you can install in this ways,

If that is not the problem then try installing jedi-vim with pathogen, hope it works.