Hi,
> What is the best practice when a plugin needs a minimum version of
> Vim with certain features, or on some other plugin?
1- I try to document the identified requirement
2- I provide emulation of new features I use when this is possible.
See for instance https://github.com/luchermitte/lh-vim-lib/blob/master/autoload/lh/list.vim
3- Regarding the dependency to other plugins I usually expect the plugin I depend on to be up-to-date. And I provide the dependencies in the documentation of my plugin. I also highly recommend people to use plugin managers that understand dependencies (like VAM or vim-flavor). But I'm perfectly aware that people usually fancy plugin managers that download multiple plugins in parallel or have some other smooths feature. Personally I'm mainly interested in dependencies management.
BTW, version requirements can be expressed with vim-flavor.
> Do you check
> for the version (and if so how) or do you check for some each
> feature or for some feature which is indicative that the others
> exist too? Is it best to check when the plugin is loaded or in
> each function which needs a certain feature? What do you do when
> the requirements aren't met --- issue a warning/error message or
> just silently do nothing?
"Ignore" or "error" when the plugin file is loaded. But definitively "error" when a plugin feature is triggered and that the requirements are not met.
It depends on whether the plugin is critical or not. And whether it could be a non-critical dependency on some other plugin. For instance, my refactoring plugin implements a refactoring that depends on a plugin (lh-tags) that depends on ctags. It also implements other refactoring. I don't want to notify the end user that lh-tags cannot be used because ctags is not installed just because lh-tags is automatically installed (VAM) when the refactoring plugin is installed.
> My preference is definitely to issue a
> message, but I'm concerned that it may be too noisy and get lost
> if it is issued at loading time.
> There is also the concern that if
> you are using a plugin manager some other plugin which you depend
> on may not be loaded yet even though it eventually will be.
My plugin manager updates the runtimepath before any file from plugin/ is sourced. Then the dependencies are mainly done through autoloaded function. In case I depend on a mapping or a command, I explicitly source the files that defines it with :runtime.
HTH
--
Luc Hermitte
--
--
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.
Monday, February 18, 2019
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment