вторник, 21 мая 2013 г., 5:36:45 UTC+4 пользователь MarcWeber написал: > Yet another suggestion - what about adding &rtp to sys.path somehow ? > (with or without python version site-packages or the like) > > Then you could > - write .py files > - use them from python by > > import module > do_stuff() > > Yes - it can be trivially implemented in tools like vim-addon-manager, > but I'd prefer a global solution usable by everyone. > > Marc Weber
It is being discussed here: https://groups.google.com/d/msg/vim_dev/g5MTn7VOcnM/y95Ccjt1vh8J. > oh and it would be cool if python/*.py files could be loaded then, too ? > Did I also miss such feature proposal? Loading files from python/ in a way other then `import {name}` is not a good idea unless this directory is not added to `sys.path`. And even if it is not added in is not a good idea either: existing plugins do not expect such behavior. And `import {name}` cannot work reliably: it may, e.g., import other module from `sys.path`. I would rather suggest using execfile on special names: maybe `{rtp}/python/**/{__vim_init__.py,__vim_init_*_.py}` (not so good as being added to `sys.path` `{rtp}/python` is expected to contain modules and not script files) or even just `{rtp}/__vim_init{_*_,}.py` or `{rtp}/plugin/__vim_init{_*_,}.py` or `{rtp}/python/__vim_init__/**/*.py`. AFAIR there are some plugins keeping scripts (I mean executables) in `python/`, they would not be fine even with `import {name}` solution. Thus we have to use special name, it is very much unlikely __vim_init__ is used by existing plugins (I have seen no). -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
