在jedi-vim中将goto与用户定义的模块一起使用 [英] Using goto with user-defined modules in jedi-vim
问题描述
jedi-vim与系统中安装的模块和功能非常兼容.例如,如果我将光标放在glob.glob()上并按下<leader>d
,则jedi-vim将我带到/usr/lib/python/中的glob()定义.
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可能无法带我进入函数定义.如果模块与我正在编辑的文件不在同一目录中,它将显示消息"jedi-vim:找不到相关文档".同样,键入<Shift>k
会给出相同的错误消息.
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.
您知道如何在jedi-vim中使不同目录中的用户定义模块起作用吗?
Do you know how to make user-defined modules in a different directory work with jedi-vim?
推荐答案
如果要在vim中解决此问题,则要设置的正确变量是PYTHONPATH
.请参阅此文档.
If you want to solve this from within vim, the right variable to set is PYTHONPATH
. See this doc.
因此,如果将其添加到.vimrc
So if you add this to your .vimrc
let $PYTHONPATH .= ';' . 'path/to/distant/file/'
然后Jedi的goto命令也可以在远程文件上使用.
then Jedi's goto command also works on the distant file.
.
是vim脚本字符串连接.
The .
is the vim script string concatenation.
这篇关于在jedi-vim中将goto与用户定义的模块一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!