{"action":"created","issue":{"url":"https://api.github.com/repos/neovim/neovim/issues/3125","labels_url":"https://api.github.com/repos/neovim/neovim/issues/3125/labels{/name}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/3125/comments","events_url":"https://api.github.com/repos/neovim/neovim/issues/3125/events","html_url":"https://github.com/neovim/neovim/pull/3125","id":98584726,"number":3125,"title":"[WIP] Add plugin management primitives","user":{"login":"fmoralesc","id":221465,"avatar_url":"https://avatars.githubusercontent.com/u/221465?v=3","gravatar_id":"","url":"https://api.github.com/users/fmoralesc","html_url":"https://github.com/fmoralesc","followers_url":"https://api.github.com/users/fmoralesc/followers","following_url":"https://api.github.com/users/fmoralesc/following{/other_user}","gists_url":"https://api.github.com/users/fmoralesc/gists{/gist_id}","starred_url":"https://api.github.com/users/fmoralesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmoralesc/subscriptions","organizations_url":"https://api.github.com/users/fmoralesc/orgs","repos_url":"https://api.github.com/users/fmoralesc/repos","events_url":"https://api.github.com/users/fmoralesc/events{/privacy}","received_events_url":"https://api.github.com/users/fmoralesc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neovim/neovim/labels/WIP","name":"WIP","color":"dfdfdf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-02T05:11:14Z","updated_at":"2015-08-02T06:33:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/3125","html_url":"https://github.com/neovim/neovim/pull/3125","diff_url":"https://github.com/neovim/neovim/pull/3125.diff","patch_url":"https://github.com/neovim/neovim/pull/3125.patch"},"body":"One of the things that bug *me* about the plugin management situation for *vim is the lack of a built-in way to handle pathogen-style plugin bundles. It's quite clear in the popularity of Vundle, NeoBundle and vim-plug that people enjoy having a declarative way to define plugins, and I think this capability should be available to the user right on install without further configuration. [A previous attempt](https://github.com/fmoralesc/neovim/tree/early/pluginmanager) to figure out a way to do this used #2760 and #2852; with those, the plugin initialization was made transparent to the user by starting early and cleaning up after the `vimrc` file was sourced. [This comment](https://github.com/neovim/neovim/pull/2852#issuecomment-114995753) describes the approach on more detail.\r\n\r\nSome problems with that approach:\r\n* The user would still need to call the plugin-manager initialization end function if he needed to call autoloadable funtions from plugins in his vimrc:\r\n~~~ vim\r\nPlug 'plugin'\r\ncall plugin#function()\r\n~~~\r\nmight not work.\r\n* It could lead to conflicts between the default plugin manager and one that was user-installed. \r\n* The feature would require the runtime to work.\r\n\r\n# The new proposal\r\n\r\nThe approach in this PR tries to solve this by:\r\n* Adding a new command, `:plug`, that takes a \"spec\" and tries to use it as a path to load plugin files from. The spec can be either a full directory name, or a partial pathname:\r\n~~~ vim\r\n:plug ~/.config/nvim/bundles/nvimplugin\r\n:plug nvimplugin2\r\n~~~\r\nThe spec can also be prefixed, as is usual when defining plugins from a particular github repo in popular plugin managers:\r\n~~~ vim\r\n:plug neovim/nvimplugin\r\n~~~\r\nThe paths are appended to `'runtimepath'`, and if required, the *.vim files in the `plugin/` subdirectory are sourced (there is special syntax for this):\r\n~~~ vim\r\n:plug! nvimplugin2\r\n~~~ \r\n\r\n* Adding a new option, `'bundledir'`, that is used by plug to build up full plugin paths from partial paths. In the previous example, `plug nvimplugin2` should expand to `plug ~/.config/nvim/plugged/nvimplugin2` by default, to `~/.config/nvim/bundles/nvimplugin2` if `'bundledir'` is `\"bundles\"`, and to `~/devel/vimplugins/nvimplugin2` if `'bundledir'` is `~/devel/vimplugins`.\r\n\r\nThis allows the user to mix and match plugins from different sources:\r\n~~~ vim\r\nplug nvimplugin\r\nset bundledir=bundles\r\nplug nvimplugin \r\nset bundledir=~/devel/testing\r\nplug nvimplugin\r\necho &runtimepath\r\n> ... ~/.config/nvim/plugged/nvimplugin,~/.config/nvim/bundles/nvimplugin,~/devel/testing/nvimplugin\r\n~~~\r\n\r\nThese features can be used by more complex plugin managers, so they are as dumb as possible, yet useful enough that they can be used as a \"poors man plugin manager\". In this sense, they are in the middle point between pathogen and Vundle. This makes no attempt to solve the issue of fetching plugins and dependencies, which is the one people have focused on #247.\r\n\r\n# Ways to take this further\r\n\r\n* Support enabling/disabling plugin bundles. The `:plug` command could have subcommands for this:\r\n~~~ vim\r\n:plug enable goodplugin\r\n:plug disable badplugin\r\n~~~\r\nThe `disable` subcommand could work like `:Disarm` in tpope's scriptease.\r\n* The plugins registered using `:plug` should be appended to an internal variable `v:plugins`, that should contain information plugin managers could use to, for example, install plugins using the specs: if I have `:plug fmoralesc/vim-autochdir`, I should be able  to expect `:PlugInstall` to install it (would require support from plugin managers).\r\n* Allow extra arguments for `:plug` that define some metadata on how the plugin should be handled. For example:\r\n~~~ vim\r\n:plug Valloric/YouCompleteMe {'dir': 'ycm, 'do': './install.sh'}\r\n:plug scrooloose/nerdtree { 'on':  'NERDTreeToggle' }\r\n~~~\r\nThis will mean the `v:plugins` variable should be a list of dictionaries:\r\n~~~\r\necho v:plugins\r\n--> [{'Valloric/YouCompleteMe' : {'dir': 'ycm', 'do': './install.sh'}}, {'scroolose/nerdree': {'on': 'NERDTreeToggle'}}]\r\n~~~"},"comment":{"url":"https://api.github.com/repos/neovim/neovim/issues/comments/126994900","html_url":"https://github.com/neovim/neovim/pull/3125#issuecomment-126994900","issue_url":"https://api.github.com/repos/neovim/neovim/issues/3125","id":126994900,"user":{"login":"fmoralesc","id":221465,"avatar_url":"https://avatars.githubusercontent.com/u/221465?v=3","gravatar_id":"","url":"https://api.github.com/users/fmoralesc","html_url":"https://github.com/fmoralesc","followers_url":"https://api.github.com/users/fmoralesc/followers","following_url":"https://api.github.com/users/fmoralesc/following{/other_user}","gists_url":"https://api.github.com/users/fmoralesc/gists{/gist_id}","starred_url":"https://api.github.com/users/fmoralesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmoralesc/subscriptions","organizations_url":"https://api.github.com/users/fmoralesc/orgs","repos_url":"https://api.github.com/users/fmoralesc/repos","events_url":"https://api.github.com/users/fmoralesc/events{/privacy}","received_events_url":"https://api.github.com/users/fmoralesc/received_events","type":"User","site_admin":false},"created_at":"2015-08-02T06:33:22Z","updated_at":"2015-08-02T06:33:22Z","body":"> Should 'plugdir' allow a comma-separated list, like runtimepath?\r\n\r\nMaybe, but I think that could only be useful if we wanted to declare things with the same name in several directories? What would be the use-case?"}}