In theory it could be possible to hack this together using the do
option to Plug
. From the plug documentation:
*plug-options*
*:Plug*
------------------------+-----------------------------------------------
Option | Description ~
------------------------+-----------------------------------------------
`branch` / `tag` / `commit` | Branch/tag/commit of the repository to use
`rtp` | Subdirectory that contains Vim plugin
`dir` | Custom directory for the plugin
`as` | Use different name for the plugin
`do` | Post-update hook (string or funcref)
`on` | On-demand loading: Commands or <Plug>-mappings
`for` | On-demand loading: File types
`frozen` | Do not update unless explicitly specified
------------------------+-----------------------------------------------
However, I'm not sure of the use case for this: you would be writing code to write settings, when you may as well write the settings themselves. It may help you to know that even if a certain plugin is not installed, you can still set options with let g:my_plugin_option = "value"
with no ill effect. Furthermore, many plugins set g:loaded_plugin_name
which you could use inside a conditional, although you'd have to pay attention to your &runtimepath
order.