7

I'm using pythoncomplete omnicompletion in vim. It works great when I instantiate classes directly, eg

import numpy as np
x = np.ndarray(l)

then x attributes complete correctly.

But I work with numpy and matplotlib so usually use factory functions ie

x = np.zeros((2,2)) 
f = plt.figure()  
ax = f.add_subplot(111)

Is there any way I can hard code the return types of these common functions so I can complete on the returned object. (ie set up some mappings that matplotlib.pyplot.figure returns matplotlib.figure.Figure, np.zeros returns np.ndarray etc.?

robince
  • 10,826
  • 3
  • 35
  • 48
  • 1
    I asked a similar question here: http://stackoverflow.com/questions/1678953/komodo-python-auto-complete-type-inference-by-variable-metadata – Gary van der Merwe Nov 20 '09 at 08:26

1 Answers1

2

Try jedi-vim.

There's an open issue for the problem you're facing. I think there's a good chance that it will be fixed in 3-4 months time: https://github.com/davidhalter/jedi/issues/372.

Jedi is also the library used behind YouCompleteMe and almost every other decent autocompletion plugin for Python.

Dave Halter
  • 15,556
  • 13
  • 76
  • 103