Search code examples
vimjedi-vim

Using goto with user-defined modules in jedi-vim


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?


Solution

  • 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.