vim-gf-python icon indicating copy to clipboard operation
vim-gf-python copied to clipboard

Added support for relative imports

Open guyzmo opened this issue 8 years ago • 5 comments

fixes #4

guyzmo avatar Mar 23 '16 15:03 guyzmo

This works for me only if I cd my vim to be where the Python file is. It doesn't work relative to the file when my vim working directory is somewhere else.

Ezra avatar Nov 22 '16 22:11 Ezra

Specifically, the error when I "gf" on a relative import "from .ThatFile import *" is 'E447: Can't find file "/ThatFile" in path'. It might be relevant that when it does work, I get a double slash in the file path, like "ThatModule//ThatFile".

Ezra avatar Dec 01 '16 00:12 Ezra

weirdly, since I upgraded to both vim8 and nvim, I'm having issues loading the plugin again in my current python install ☹ It might be because of VimPlug.

guyzmo avatar Dec 01 '16 00:12 guyzmo

ok, I think I fixed the issue.

So, as far as I've tested, it's working with:

  • module_x
  • .module_a.module_b
  • ..module_y.module_z

with the path being relative to the buffer's file being open, not the current directory.

guyzmo avatar Dec 10 '16 18:12 guyzmo

BTW, you can directly use:

Plug "guyzmo/vim-gf-python"

to have the relative support.

guyzmo avatar Dec 10 '16 18:12 guyzmo