2

I am new in using vim-plug. It works fine installing and updating all the plugins configured in .vimrc. But some plugins require some additional settings inside .vimrc to work correctly.

Is there a way to make vim-plug do this automatically too (would be a pain after installing 10 or more plugins at once)?

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – D. Ben Knoble
    Dec 31, 2020 at 15:41

2 Answers 2

1

That's an interesting question! To my knowledge, there is no option to do so.

I think it's better to let the user chose his own mapping to avoid collisions. This is the reason why some plugins use <Plug> for their features (see :help using-<Plug>).

I am happy to see that you are keen on plugins (they are really useful), but I suggest you to not install too many of them (in my humble opinion).

Some plugins duplicate features already existing in vim and I think your knowledge about vim is more portable than any plugins.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.