Using goto with user-defined modules in jedi-vim

馋奶兔 提交于 2019-12-11 04:42:37

问题


jedi-vim works very well with modules and functions installed on my system. For example, if I put the cursor on glob.glob() and hit <leader>d, jedi-vim brings me to the definition of glob() in /usr/lib/python/.

However, for a user-defined module where a function is imported with a line like

from mymodule import myfunction

jedi-vim may not bring me to the function definition. It instead gives the message "jedi-vim: No documentation found for that" if the modules is not in the same directory as the file I'm editing. Similarly, typing <Shift>k gives the same error message.

Do you know how to make user-defined modules in a different directory work with jedi-vim?


回答1:


If you want to solve this from within vim, the right variable to set is PYTHONPATH. See this doc.

So if you add this to your .vimrc

let $PYTHONPATH .= ';' . 'path/to/distant/file/'

then Jedi's goto command also works on the distant file.

The . is the vim script string concatenation.



来源:https://stackoverflow.com/questions/40235611/using-goto-with-user-defined-modules-in-jedi-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!