mkomitee / vim-gf-python Goto Github PK
View Code? Open in Web Editor NEWPlugin to enhance support for vim's 'gf' map in python.
Plugin to enhance support for vim's 'gf' map in python.
For relative imports, gf
resolves an import statement such as:
from .common.exceptions import MyException
into:
/common/exceptions
and then vim yells saying that it cannot find /common/exceptions
, because obviously it cannot be found at the filesystem's root ☺.
A patch would be to resolve the path before looking up the module, so that it gets translated to:
$VIM_PWD/$BUFFER_DIR_PATH/common/exceptions
where $VIM_PWD
is the path to where vim is living, and $BUFFER_DIR_PATH
is the path to the current buffer's file.
I'll try to figure out a patch for that…
Two things need to be changed to support py3k:
python3
instead of python
python3 <<<EOF
heredoc instead of python <<<EOF
heredocI'm not sure how to make the plugin work for both python version...
I have a solution to find things like os.path, but the implementation could be considered unsafe. It would involve attempting to import it, and so depending on what one tries to find, it could be dangerous as the code would in effect be evaluated.
You could use the AST standard module for this. You wouldn't be evaluating the code, but rather only parsing it.
If I have time I'll create a pull request adding a part of this feature.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.