Friday, August 5, 2016

Re: How does one load plugin-specific settings after a plugin with the new packages feature?

Ben Fritz wrote:

> Previously, when I installed a plugin, I could set up mappings to that plugin's functionality by putting commands in ~/vimfiles/after/plugin/someplugin_maps.vim
>
> Now with packages, this no longer works, because loading plugins is done as with ":runtime! plugin/**/*.vim" BEFORE loading packages.
>
> This is somewhat counter-intuitive because the ~/vimfiles/after directory DOES come after the package plugin directories.
>
> What's the best practice now? I tried using an after/plugin directory in a plugin folder within a package, but although the after directory gets added to the runtime path, stuff in the after/plugin directory won't get sourced.
>
> I'm not fond of adding a VimEnter autocmd for this, since that prevents me from easily installing/uninstalling plugins by simply removing their directory (and maybe an "override" directory).
>
> The best I can come up with is adding a new pluginname_overrides/plugin/pluginname_maps.vim in the same package as the plugin itself. Then by virtue of sort order it will always get sourced after the plugin itself.
>
> Is there a better way?

I suppose we should do the "after" plugins only after all plugins and
packages are done.

This is a bit tricky, because theoretically any directory could be used
for "after" plugins and added to the end of 'runtimepath'. And they do
not necessarily are last in 'runtimepath'.

But I think it's fine to go through 'runtimepath' twice, once to use
entries that don't end in "after", then load packages and then load the
entries ending in "after".

Is that not too weird?

--
OLD WOMAN: King of the WHO?
ARTHUR: The Britons.
OLD WOMAN: Who are the Britons?
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// 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: