开发者

pythoncomplete in vim - hardcode factory function returns?

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 fu开发者_Go百科nctions 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.?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜