{"id":13485311,"url":"https://github.com/kristijanhusak/vim-packager","last_synced_at":"2025-03-27T17:30:57.183Z","repository":{"id":76535402,"uuid":"147971536","full_name":"kristijanhusak/vim-packager","owner":"kristijanhusak","description":"Vim plugin manager that utilizes \"jobs\" and \"pack\" features.","archived":true,"fork":false,"pushed_at":"2021-11-20T19:30:54.000Z","size":143,"stargazers_count":248,"open_issues_count":4,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-24T11:18:13.882Z","etag":null,"topics":["neovim","neovim-plugin","plugin-manager","vim","vim-plugins","viml"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kristijanhusak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-09-08T21:33:30.000Z","updated_at":"2025-03-23T07:21:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"f86d4578-0ce6-495e-b6a4-e9d4c9b2f977","html_url":"https://github.com/kristijanhusak/vim-packager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristijanhusak%2Fvim-packager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristijanhusak%2Fvim-packager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristijanhusak%2Fvim-packager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristijanhusak%2Fvim-packager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kristijanhusak","download_url":"https://codeload.github.com/kristijanhusak/vim-packager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245892510,"owners_count":20689509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","neovim-plugin","plugin-manager","vim","vim-plugins","viml"],"created_at":"2024-07-31T17:01:54.809Z","updated_at":"2025-03-27T17:30:56.883Z","avatar_url":"https://github.com/kristijanhusak.png","language":"Vim script","funding_links":[],"categories":["Vim Script","Vim script"],"sub_categories":[],"readme":"# Vim packager\n\n![preview-gif](https://i.imgur.com/KOTn843.gif)\n\nThis is Yet Another plugin manager for Vim/Neovim. It's written in pure vimscript and utilizes [jobs](https://neovim.io/doc/user/job_control.html) and [pack](https://neovim.io/doc/user/repeat.html#packages) features.\n\nTested with:\n* Neovim 0.3.2 - Linux, MacOS and Windows 10\n* Vim 8.0 - Linux and Windows 10\n\n## Why?\nThere's a lot of plugin managers for vim out there.\n\nMost popular one is definitely [vim-plug](https://github.com/junegunn/vim-plug). It's a great fully featured plugin manager.\nOne thing that it does different is managing `runtimepath` manually. In latest Vim (and Neovim), packages can be added to `runtimepath` automatically by vim, just by placing the plugins in the right folder.\nThis also has one more advantage: You can use (load) plugin manager only when you need it.\n\nOne plugin manager that utilizes the same features as this one is [minpac](https://github.com/k-takata/minpac),\nwhich I used for some time, and which inspired me to write this one (Many thanks to @k-takata).\nIn minpac, I missed having the window which shows the process and information about\nall the plugins while they are being installed/updated/previewed.\nI contributed and added a status window, but it still has a bit bad looking install/update process (echoing information to command line).\nYou can easily loose track what's happening in the process, and echoing causes a lot \"Press enter to continue.\" messages, which blocks the process.\n\n`Packager` utilizes jobs feature to the maximum, and runs everything that it can in a job, and shows whole process in the separate window, in a very similar way that vim-plug does.\n\n## Requirement\n* Neovim 0.20+ OR Vim 8.0.0902+\n* Git\n* Windows, Linux, macOS\n\n## Installation\n### Mac/Linux\n#### Vim\n```sh\ngit clone https://github.com/kristijanhusak/vim-packager ~/.vim/pack/packager/opt/vim-packager\n```\n\n#### Neovim\n```sh\ngit clone https://github.com/kristijanhusak/vim-packager ~/.config/nvim/pack/packager/opt/vim-packager\n```\n\n### Windows\n#### Vim\n```sh\ngit clone https://github.com/kristijanhusak/vim-packager ~/vimfiles/pack/packager/opt/vim-packager\n```\n\n#### Neovim\n```sh\ngit clone https://github.com/kristijanhusak/vim-packager ~/AppData/Local/nvim/pack/packager/opt/vim-packager\n```\n\n#### Example .vimrc content\nUsing `setup` function.\n\n```vim\nif \u0026compatible\n  set nocompatible\nendif\n\nfunction! s:packager_init(packager) abort\n  call a:packager.add('kristijanhusak/vim-packager', { 'type': 'opt' })\n  call a:packager.add('junegunn/fzf', { 'do': './install --all \u0026\u0026 ln -s $(pwd) ~/.fzf'})\n  call a:packager.add('junegunn/fzf.vim')\n  call a:packager.add('vimwiki/vimwiki', { 'type': 'opt' })\n  call a:packager.add('Shougo/deoplete.nvim')\n  call a:packager.add('autozimu/LanguageClient-neovim', { 'do': 'bash install.sh' })\n  call a:packager.add('morhetz/gruvbox')\n  call a:packager.add('lewis6991/gitsigns.nvim', {'requires': 'nvim-lua/plenary.nvim'})\n  call a:packager.add('haorenW1025/completion-nvim', {'requires': [\n  \\ ['nvim-treesitter/completion-treesitter', {'requires': 'nvim-treesitter/nvim-treesitter'}],\n  \\ {'name': 'steelsojka/completion-buffers', 'opts': {'type': 'opt'}},\n  \\ 'kristijanhusak/completion-tags',\n  \\ ]})\n  call a:packager.add('hrsh7th/vim-vsnip-integ', {'requires': ['hrsh7th/vim-vsnip'] })\n  call a:packager.local('~/my_vim_plugins/my_awesome_plugin')\n\n  \"Provide full URL; useful if you want to clone from somewhere else than Github.\n  call a:packager.add('https://my.other.public.git/tpope/vim-fugitive.git')\n\n  \"Provide SSH-based URL; useful if you have write access to a repository and wish to push to it\n  call a:packager.add('git@github.com:mygithubid/myrepo.git')\n\n  \"Loaded only for specific filetypes on demand. Requires autocommands below.\n  call a:packager.add('kristijanhusak/vim-js-file-import', { 'do': 'npm install', 'type': 'opt' })\n  call a:packager.add('fatih/vim-go', { 'do': ':GoInstallBinaries', 'type': 'opt' })\n  call a:packager.add('neoclide/coc.nvim', { 'do': function('InstallCoc') })\n  call a:packager.add('sonph/onehalf', {'rtp': 'vim/'})\nendfunction\n\npackadd vim-packager\ncall packager#setup(function('s:packager_init'))\n```\nand run `PackagerInstall` or `PackagerUpdate`. See all available commands [here](#commands)\n\nOr doing the old way that allows more control.\n\n```vim\nif \u0026compatible\n  set nocompatible\nendif\n\n\" Load packager only when you need it\nfunction! PackagerInit() abort\n  packadd vim-packager\n  call packager#init()\n  call packager#add('kristijanhusak/vim-packager', { 'type': 'opt' })\n  call packager#add('junegunn/fzf', { 'do': './install --all \u0026\u0026 ln -s $(pwd) ~/.fzf'})\n  call packager#add('junegunn/fzf.vim')\n  call packager#add('vimwiki/vimwiki', { 'type': 'opt' })\n  call packager#add('Shougo/deoplete.nvim')\n  call packager#add('autozimu/LanguageClient-neovim', { 'do': 'bash install.sh' })\n  call packager#add('morhetz/gruvbox')\n  call packager#add('lewis6991/gitsigns.nvim', {'requires': 'nvim-lua/plenary.nvim'})\n  call packager#add('haorenW1025/completion-nvim', {'requires': [\n  \\ ['nvim-treesitter/completion-treesitter', {'requires': 'nvim-treesitter/nvim-treesitter'}],\n  \\ {'name': 'steelsojka/completion-buffers', 'opts': {'type': 'opt'}},\n  \\ 'kristijanhusak/completion-tags',\n  \\ ]})\n  call packager#add('hrsh7th/vim-vsnip-integ', {'requires': ['hrsh7th/vim-vsnip'] })\n  call packager#local('~/my_vim_plugins/my_awesome_plugin')\n\n  \"Provide full URL; useful if you want to clone from somewhere else than Github.\n  call packager#add('https://my.other.public.git/tpope/vim-fugitive.git')\n\n  \"Provide SSH-based URL; useful if you have write access to a repository and wish to push to it\n  call packager#add('git@github.com:mygithubid/myrepo.git')\n\n  \"Loaded only for specific filetypes on demand. Requires autocommands below.\n  call packager#add('kristijanhusak/vim-js-file-import', { 'do': 'npm install', 'type': 'opt' })\n  call packager#add('fatih/vim-go', { 'do': ':GoInstallBinaries', 'type': 'opt' })\n  call packager#add('neoclide/coc.nvim', { 'do': function('InstallCoc') })\n  call packager#add('sonph/onehalf', {'rtp': 'vim/'})\nendfunction\n\nfunction! InstallCoc(plugin) abort\n  exe '!cd '.a:plugin.dir.' \u0026\u0026 yarn install'\n  call coc#add_extension('coc-eslint', 'coc-tsserver', 'coc-pyls')\nendfunction\n\n\" These commands are automatically added when using `packager#setup()`\ncommand! -nargs=* -bar PackagerInstall call PackagerInit() | call packager#install(\u003cargs\u003e)\ncommand! -nargs=* -bar PackagerUpdate call PackagerInit() | call packager#update(\u003cargs\u003e)\ncommand! -bar PackagerClean call PackagerInit() | call packager#clean()\ncommand! -bar PackagerStatus call PackagerInit() | call packager#status()\n\n\"Load plugins only for specific filetype\n\"Note that this should not be done for plugins that handle their loading using ftplugin file.\n\"More info in :help pack-add\naugroup packager_filetype\n  autocmd!\n  autocmd FileType javascript packadd vim-js-file-import\n  autocmd FileType go packadd vim-go\naugroup END\n\n\"Lazy load plugins with a mapping\nnnoremap \u003csilent\u003e\u003cLeader\u003eww :unmap \u003cLeader\u003eww\u003cBAR\u003epackadd vimwiki\u003cBAR\u003eVimwikiIndex\u003cCR\u003e\n```\n\nAfter that, reload vimrc, and run `:PackagerInstall`. It will install all the plugins and run it's hooks.\n\nIf some plugin installation (or it's hook) fail, you will get (as much as possible) descriptive error on the plugin line.\nTo view more, press `E` on the plugin line to view whole stdout.\n\n### Neovim Lua support\nThere is some basic Lua support for latest Neovim (0.5.0). Here's short example:\n```lua\nvim.cmd [[packadd vim-packager]]\nrequire('packager').setup(function(packager)\n  packager.add('kristijanhusak/vim-packager', { type = 'opt' })\n  packager.add('junegunn/fzf', { ['do'] = './install --all \u0026\u0026 ln -s $(pwd) ~/.fzf'})\n  packager.add('junegunn/fzf.vim')\n  packager.add('vimwiki/vimwiki', { type = 'opt' })\n  packager.add('Shougo/deoplete.nvim')\n  packager.add('autozimu/LanguageClient-neovim', { ['do'] = 'bash install.sh' })\n  packager.add('morhetz/gruvbox')\n  packager.add('lewis6991/gitsigns.nvim', {requires = 'nvim-lua/plenary.nvim'})\n  packager.add('haorenW1025/completion-nvim', {requires = {\n    {'nvim-treesitter/completion-treesitter', {requires = 'nvim-treesitter/nvim-treesitter'}},\n    {name = 'steelsojka/completion-buffers', opts = {type = 'opt'}},\n    'kristijanhusak/completion-tags',\n  }})\n  packager.add('hrsh7th/vim-vsnip-integ', {requires = {'hrsh7th/vim-vsnip'} })\n  packager['local']('~/my_vim_plugins/my_awesome_plugin')\n\n  --Provide full URL; useful if you want to clone from somewhere else than Github.\n  packager.add('https://my.other.public.git/tpope/vim-fugitive.git')\n\n  --Provide SSH-based URL; useful if you have write access to a repository and wish to push to it\n  packager.add('git@github.com:mygithubid/myrepo.git')\n\n  packager.add('kristijanhusak/vim-js-file-import', { ['do'] = 'npm install', type = 'opt' })\n  packager.add('fatih/vim-go', { ['do'] = ':GoInstallBinaries', type = 'opt' })\n  packager.add('neoclide/coc.nvim', {branch = 'master', ['do'] = function(plugin)\n    vim.loop.spawn('yarn', {\n        args = {'install'},\n        cwd = plugin.dir,\n      })\n  end})\n  packager.add('sonph/onehalf', {rtp = 'vim/'})\nend)\n```\nand run `PackagerInstall` or `PackagerUpdate`. See all available commands [here](#commands)\n\n### Functions\n\n#### packager#setup(callback_function, opts)\nThis is a small wrapper around functions explained below. It does this:\n1. Adds all necessary commands. `PackagerInstall`, `PackagerUpdate`, `PackagerClean` and `PackagerStatus`\n2. Running any of the command does this:\n  * calls `packager#init(opts)`\n  * calls provided `callback_function` with `packager` instance\n  * calls proper function for the command\n\n#### packager#init(options)\n\nAvailable options:\n\n* `depth` - `--depth` value to use when cloning. Default: `5`\n* `jobs` - Maximum number of jobs that can run at same time. `0` is treated as unlimited. Default: `8`\n* `dir` - Directory to use for installation. By default uses `\u0026packpath` value, which is `~/.vim/pack/packager` in Vim, and `~/.config/nvim/pack/packager` in Neovim.\n* `window_cmd` - What command to use to open packager window. Default: `vertical topleft new`\n* `default_plugin_type` - Default `type` option for plugins where it's not provided. More info below in `packager#add` options. Default: `start`\n* `disable_default_mappings` - Disable all default mappings for packager buffer. Default: `0`\n\n#### packager#add(name, options)\n\n`name` - Url to the git directory, or only last part of it to use `github`.\n\nExample: for github repositories, `kristijanhusak/vim-packager` is enough, for something else, like `bitbucket`, use full path `https://bitbucket.org/owner/package`\n\nOptions:\n* `name` - Custom name of the plugin. If ommited, last part of url explained above is taken (example: `vim-packager`, in `kristijanhusak/vim-packager`)\n* `type` - In which folder to install the plugin. Plugins that are loaded on demand (with `packadd`), goes to `opt` directory,\nwhere plugins that are auto loaded goes to `start` folder. Default: `start`\n* `branch` - git branch to use. Default: '' (Uses the default from the repository, usually master)\n* `tag` - git tag to use. Default: ''\n* `rtp` - Used in case when subdirectory contains vim plugin. Creates a symbolink link from subdirectory to the packager folder.\nIf `type` of package is `opt` use `packadd {packagename}__{rtp}` to load it (example: `packadd onehalf__vim`)\n* `commit` - exact git commit to use. Default: '' (Check below for priority explanation)\n* `do` - Hook to run after plugin is installed/updated: Default: ''. Examples below.\n* `frozen` - When plugin is frozen, it is not being updated. Default: 0\n* `requires` - Dependencies for the plugin. Can be\n  * *string* (ex. `'kristijanhusak/vim-packager'`)\n  * *list* (ex. `['kristijanhusak/vim-packager', {'type': 'opt'}]`)\n  * *dict* (ex. `{'name': 'kristijanhusak/vim-packager', 'opts': {'type': 'opt'} }`).\n    See example vimrc above.\n\n`branch`, `tag` and `commit` options go in certain priority:\n* `commit`\n* `tag`\n* `branch`\n\nHooks can be defined in 3 ways:\n1. As a string that **doesn't** start with `:`. This runs the command as it is a shell command, in the plugin directory. Example:\n```vimL\ncall packager#add('junegunn/fzf', { 'do': './install --all'})\ncall packager#add('kristijanhusak/vim-js-file-import', { 'do': 'npm install' })\n```\n2. As a string that starts with `:`. This executes the hook as a vim command. Example:\n```vimL\n  call packager#add('fatih/vim-go', { 'do': ':GoInstallBinaries' })\n  call packager#add('iamcco/markdown-preview.nvim' , { 'do': ':call mkdp#util#install()' })\n```\n\n3. As a `funcref` that gets the plugin info as an argument. Example:\n```vimL\n  call packager#add('iamcco/markdown-preview.nvim' , { 'do': { -\u003e mkdp#util#install() } })\n  call packager#add('junegunn/fzf', { 'do': function('InstallFzf') })\n\n  function! InstallFzf(plugin) abort\n    exe a:plugin.dir.'/install.sh --all'\n  endfunction\n```\n\n#### packager#local(name, options)\n**Note**: This function only creates a symbolic link from provided path to the packager folder\n\n`name` - Full path to the local folder\nExample: `~/my_plugins/my_awesome_plugin`\n\nOptions:\n* `name` - Custom name of the plugin. If ommited, last part of path is taken (example: `my_awesome_plugin`, in `~/my_plugins/my_awesome_plugin`)\n* `type` - In which folder to install the plugin. Plugins that are loaded on demand (with `packadd`), goes to `opt` directory,\nwhere plugins that are auto loaded goes to `start` folder. Default: `start`\n* `do` - Hook to run after plugin is installed/updated: Default: ''\n* `frozen` - When plugin is frozen, it is not being updated. Default: 0\n\n#### packager#install(opts)\n\nThis only installs plugins that are not installed\n\nAvailable options:\n\n* `on_finish` - Run command after installation finishes. For example to quit at the end: `call packager#install({ 'on_finish': 'quitall' })`\n* `plugins` - Array of plugin names to install. Example: `call packager#install({'plugins': ['gruvbox', 'gitsigns.nvim']})`\n\nWhen installation finishes, there are two mappings that can be used:\n\n* `D` - Switches view from installation to status. This prints all plugins, and it's status (Installed, Updated, list of commits that were pulled with latest update)\n* `E` - View stdout of the plugin on the current line. If something errored (From installation or post hook), it's printed in the preview window.\n\n#### packager#update(opts)\n\nThis installs plugins that are not installed, and updates existing one to the latest (If it's not marked as frozen)\n\nAvailable options:\n\n* `on_finish` - Run command after update finishes. For example to quit at the end: `call packager#update({ 'on_finish': 'quitall' })`\n* `force_hooks` - Force running post hooks for each package even if up to date. Useful when some hooks previously failed. Must be non-empty value: `call packager#update({ 'force_hooks': 1 })`\n* `plugins` - Array of plugin names to update. Example: `call packager#update({'plugins': ['gruvbox', 'gitsigns.nvim']})`\n\nWhen update finishes, there are two mappings that can be used:\n\n* `D` - Switches view from installation to status. This prints all plugins, and it's status (Installed, Updated, list of commits that were pulled with latest update)\n* `E` - View stdout of the plugin on the current line. If something errored (From installation or post hook), it's printed in the preview window.\n\n#### packager#status()\n\nThis shows the status for each plugin added from vimrc.\n\nYou can come to this view from Install/Update screens by pressing `D`.\n\nEach plugin can have several states:\n\n* `Not installed` - Plugin directory does not exist. If something failed during the clone process, shows the error message that can be previewed with `E`\n* `Install/update failed` - Something went wrong during installation/updating of the plugin. Press `E` on the plugin line to view stdout of the process.\n* `Post hook failed` - Something went wrong with post hook. Press `E` on the plugin line to view stdout of the process.\n* `OK` - Plugin is properly installed and it doesn't have any update information.\n* `Updated` - Plugin has some information about the last update.\n\n#### packager#clean()\n\nThis removes unused plugins. It will ask for confirmation before proceeding.\nConfirmation allows selecting option to delete all folders from the list (default action),\nor ask for each folder if you want to delete it.\n\n### Commands\nCommands are added only when using `packager#setup` or Lua `require('packager').setup()`\n\n* PackagerInstall - same as [packager#install(`\u003cargs\u003e`)](https://github.com/kristijanhusak/vim-packager#packagerinstallopts).\n* PackagerUpdate - same as [packager#update(`\u003cargs\u003e`)](https://github.com/kristijanhusak/vim-packager#packagerupdateopts). Note that args are passed as they are written.\n    For example, to force running hooks you would do `:PackagerUpdate {'force_hooks': 1}`\n* PackagerClean - same as [packager#clean()](https://github.com/kristijanhusak/vim-packager#packagerclean)\n* PackagerStatus - same as [packager#status()](https://github.com/kristijanhusak/vim-packager#packagerstatus)\n\n## Configuration\nSeveral buffer mappings are added for packager buffer by default:\n\n* `q` - Close packager buffer (`\u003cPlug\u003e(PackagerQuit)`)\n* `\u003cCR\u003e` - Preview commit under cursor (`\u003cPlug\u003e(PackagerOpenSha)`)\n* `E` - Preview stdout of the installation process of plugin under cursor (`\u003cPlug\u003e(PackagerOpenStdout)`)\n* `\u003cC-j\u003e` - Jump to next plugin (`\u003cPlug\u003e(PackagerGotoNextPlugin)`)\n* `\u003cC-k\u003e` - Jump to previous plugin (`\u003cPlug\u003e(PackagerGotoPrevPlugin)`)\n* `D` - Go to status page (`\u003cPlug\u003e(PackagerStatus)`)\n* `O` - Open details of plugin under cursor (`\u003cPlug\u003e(PackagerPluginDetails)`)\n\nTo use different mapping for any of these, create filetype autocmd with different mapping.\n\nFor example, to use `\u003cc-h\u003e` instead of `\u003cc-j\u003e` for jumping to next plugin, add this to vimrc:\n\n```\nautocmd FileType packager nmap \u003cbuffer\u003e \u003cC-h\u003e \u003cPlug\u003e(PackagerGotoNextPlugin)\n```\n\n## Thanks to:\n\n* [@k-takata](https://github.com/k-takata) and his [minpac](https://github.com/k-takata/minpac) plugin for inspiration and parts of the code\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristijanhusak%2Fvim-packager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristijanhusak%2Fvim-packager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristijanhusak%2Fvim-packager/lists"}