Saturday, February 27, 2016

Re: Packages

Ben Fritz wrote:

> On Friday, February 26, 2016 at 12:02:42 PM UTC-6, Bram Moolenaar wrote:
> > Christian Brabandt wrote:
> > >
> > > Really a plugin directory is necessary? That sounds awkward. What about
> > > colorschemes, indent or ftplugins and syntax scripts?
> > >
> > > We could still change it, right?
> > >
> > > > It would be possible to make another command than :loadplugin to find
> > > > any directory with the specified name under 'packpath', but I don't see
> > > > a good reason. Perhaps adding a remark to the documentation is
> > > > sufficient?
> > >
> > > I'd rather prefer it to be fixed instead of adding yet another command
> > > or option.
> >
> > Hmm, so we throw out ":loadplugin" and add ":loadpackitem"?
> > It would then find directories matching "pack/*/opt/{name}"
> >
>
> I agree this needs fixing. I did not realize only things with a "plugin" folder would be loaded, that makes the current implementation next to worthless as a replacement for things like Pathogen.
>
> The naming of the plugin was discussed in the first link from the OP: https://groups.google.com/d/msg/vim_dev/BN5DuHpzzBc/OjoGDSqeEQAJ
>
> I think ":loadpackitem" would be a very awkward name, please don't use that. ":loadplugin" is sufficient and matches user expectations even if it isn't pedantically correct. ":loadaddon" might be a little better although we don't use the term "addon" anywhere else that I know of.
>
> TL;DR: just stick with the current name but fix the behavior.

We do have two different pieces of functionality:
- loading a plugin when desired
- adding a directory to 'runtimepath'

When talking about plugins, we expect a file plugin/foobar.vim that gets
loaded. Thus I do think that :loadplugin should do that.

Adding a directory to 'runtimepath', without loading a plugin, is
something else. Perhaps there is a plugin/foobar.vim, but it would only
be loaded if 'runtimepath' is updated early in initialization, so that
the plugin is found in step 4, see ":help load-plugins".

It gets more complicated if a plugin that is loaded in step 4 decides it
needs another plugin. Changing 'runtimepath' is not sufficient then,
the plugin must actually be loaded, it won't happen later. That is what
we need :loadplugin for.

Also, if there are several matching directories in 'packpath', and only
one actually has the plugin, that one must be used. Not one that is
found earlier but perhaps only has a syntax file.

We could add a command to add a directory under "pack" to
'runtimepath'. I believe that is the most straightforward way to allow
a user to do what he wants. We just need a good name.

":addtopath" perhaps? ":packadd"?

--
There are only two hard things in programming: Cache invalidation,
naming things and off-by-one errors.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment