Using goto with user-defined modules in jedi-vim

2019-08-03 03:36发布

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?

标签: vim jedi-vim
1条回答
爷的心禁止访问
2楼-- · 2019-08-03 04:17

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.

查看更多
登录 后发表回答