1

Is there a way in which if you move file A to another location and there are other files that have imported file A, the import path will change accordingly in Vim?

PyCharm has this and I was wondering if this could be implemented for Vim. An example written in Python:

main.py

from projects.scripts import file_a

I then move file_a.py to projects/final. If I'm using PyCharm, main.py will be updated with the new import path

main.py

from projects.final import file_a
1

I'm afraid vim can't listen for files moved.

What you can do is to check how Eunuch plugin works regarding moving files, then you'll need to search for all files that import the moved one, and to update them.

You could also provide a service "ModePythonFile" built on top of Eunuch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.