Giter VIP home page Giter VIP logo

vim-packager's Introduction

Vim packager

preview-gif

This is Yet Another plugin manager for Vim/Neovim. It's written in pure vimscript and utilizes jobs and pack features.

Tested with:

  • Neovim 0.3.2 - Linux, MacOS and Windows 10
  • Vim 8.0 - Linux and Windows 10

Why?

There's a lot of plugin managers for vim out there.

Most popular one is definitely vim-plug. It's a great fully featured plugin manager. One 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. This also has one more advantage: You can use (load) plugin manager only when you need it.

One plugin manager that utilizes the same features as this one is minpac, which I used for some time, and which inspired me to write this one (Many thanks to @k-takata). In minpac, I missed having the window which shows the process and information about all the plugins while they are being installed/updated/previewed. I contributed and added a status window, but it still has a bit bad looking install/update process (echoing information to command line). You can easily loose track what's happening in the process, and echoing causes a lot "Press enter to continue." messages, which blocks the process.

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.

Requirement

  • Neovim 0.20+ OR Vim 8.0.0902+
  • Git
  • Windows, Linux, macOS

Installation

Mac/Linux

Vim

git clone https://github.com/kristijanhusak/vim-packager ~/.vim/pack/packager/opt/vim-packager

Neovim

git clone https://github.com/kristijanhusak/vim-packager ~/.config/nvim/pack/packager/opt/vim-packager

Windows

Vim

git clone https://github.com/kristijanhusak/vim-packager ~/vimfiles/pack/packager/opt/vim-packager

Neovim

git clone https://github.com/kristijanhusak/vim-packager ~/AppData/Local/nvim/pack/packager/opt/vim-packager

Example .vimrc content

Using setup function.

if &compatible
  set nocompatible
endif

function! s:packager_init(packager) abort
  call a:packager.add('kristijanhusak/vim-packager', { 'type': 'opt' })
  call a:packager.add('junegunn/fzf', { 'do': './install --all && ln -s $(pwd) ~/.fzf'})
  call a:packager.add('junegunn/fzf.vim')
  call a:packager.add('vimwiki/vimwiki', { 'type': 'opt' })
  call a:packager.add('Shougo/deoplete.nvim')
  call a:packager.add('autozimu/LanguageClient-neovim', { 'do': 'bash install.sh' })
  call a:packager.add('morhetz/gruvbox')
  call a:packager.add('lewis6991/gitsigns.nvim', {'requires': 'nvim-lua/plenary.nvim'})
  call a:packager.add('haorenW1025/completion-nvim', {'requires': [
  \ ['nvim-treesitter/completion-treesitter', {'requires': 'nvim-treesitter/nvim-treesitter'}],
  \ {'name': 'steelsojka/completion-buffers', 'opts': {'type': 'opt'}},
  \ 'kristijanhusak/completion-tags',
  \ ]})
  call a:packager.add('hrsh7th/vim-vsnip-integ', {'requires': ['hrsh7th/vim-vsnip'] })
  call a:packager.local('~/my_vim_plugins/my_awesome_plugin')

  "Provide full URL; useful if you want to clone from somewhere else than Github.
  call a:packager.add('https://my.other.public.git/tpope/vim-fugitive.git')

  "Provide SSH-based URL; useful if you have write access to a repository and wish to push to it
  call a:packager.add('[email protected]:mygithubid/myrepo.git')

  "Loaded only for specific filetypes on demand. Requires autocommands below.
  call a:packager.add('kristijanhusak/vim-js-file-import', { 'do': 'npm install', 'type': 'opt' })
  call a:packager.add('fatih/vim-go', { 'do': ':GoInstallBinaries', 'type': 'opt' })
  call a:packager.add('neoclide/coc.nvim', { 'do': function('InstallCoc') })
  call a:packager.add('sonph/onehalf', {'rtp': 'vim/'})
endfunction

packadd vim-packager
call packager#setup(function('s:packager_init'))

and run PackagerInstall or PackagerUpdate. See all available commands here

Or doing the old way that allows more control.

if &compatible
  set nocompatible
endif

" Load packager only when you need it
function! PackagerInit() abort
  packadd vim-packager
  call packager#init()
  call packager#add('kristijanhusak/vim-packager', { 'type': 'opt' })
  call packager#add('junegunn/fzf', { 'do': './install --all && ln -s $(pwd) ~/.fzf'})
  call packager#add('junegunn/fzf.vim')
  call packager#add('vimwiki/vimwiki', { 'type': 'opt' })
  call packager#add('Shougo/deoplete.nvim')
  call packager#add('autozimu/LanguageClient-neovim', { 'do': 'bash install.sh' })
  call packager#add('morhetz/gruvbox')
  call packager#add('lewis6991/gitsigns.nvim', {'requires': 'nvim-lua/plenary.nvim'})
  call packager#add('haorenW1025/completion-nvim', {'requires': [
  \ ['nvim-treesitter/completion-treesitter', {'requires': 'nvim-treesitter/nvim-treesitter'}],
  \ {'name': 'steelsojka/completion-buffers', 'opts': {'type': 'opt'}},
  \ 'kristijanhusak/completion-tags',
  \ ]})
  call packager#add('hrsh7th/vim-vsnip-integ', {'requires': ['hrsh7th/vim-vsnip'] })
  call packager#local('~/my_vim_plugins/my_awesome_plugin')

  "Provide full URL; useful if you want to clone from somewhere else than Github.
  call packager#add('https://my.other.public.git/tpope/vim-fugitive.git')

  "Provide SSH-based URL; useful if you have write access to a repository and wish to push to it
  call packager#add('[email protected]:mygithubid/myrepo.git')

  "Loaded only for specific filetypes on demand. Requires autocommands below.
  call packager#add('kristijanhusak/vim-js-file-import', { 'do': 'npm install', 'type': 'opt' })
  call packager#add('fatih/vim-go', { 'do': ':GoInstallBinaries', 'type': 'opt' })
  call packager#add('neoclide/coc.nvim', { 'do': function('InstallCoc') })
  call packager#add('sonph/onehalf', {'rtp': 'vim/'})
endfunction

function! InstallCoc(plugin) abort
  exe '!cd '.a:plugin.dir.' && yarn install'
  call coc#add_extension('coc-eslint', 'coc-tsserver', 'coc-pyls')
endfunction

" These commands are automatically added when using `packager#setup()`
command! -nargs=* -bar PackagerInstall call PackagerInit() | call packager#install(<args>)
command! -nargs=* -bar PackagerUpdate call PackagerInit() | call packager#update(<args>)
command! -bar PackagerClean call PackagerInit() | call packager#clean()
command! -bar PackagerStatus call PackagerInit() | call packager#status()

"Load plugins only for specific filetype
"Note that this should not be done for plugins that handle their loading using ftplugin file.
"More info in :help pack-add
augroup packager_filetype
  autocmd!
  autocmd FileType javascript packadd vim-js-file-import
  autocmd FileType go packadd vim-go
augroup END

"Lazy load plugins with a mapping
nnoremap <silent><Leader>ww :unmap <Leader>ww<BAR>packadd vimwiki<BAR>VimwikiIndex<CR>

After that, reload vimrc, and run :PackagerInstall. It will install all the plugins and run it's hooks.

If some plugin installation (or it's hook) fail, you will get (as much as possible) descriptive error on the plugin line. To view more, press E on the plugin line to view whole stdout.

Neovim Lua support

There is some basic Lua support for latest Neovim (0.5.0). Here's short example:

vim.cmd [[packadd vim-packager]]
require('packager').setup(function(packager)
  packager.add('kristijanhusak/vim-packager', { type = 'opt' })
  packager.add('junegunn/fzf', { ['do'] = './install --all && ln -s $(pwd) ~/.fzf'})
  packager.add('junegunn/fzf.vim')
  packager.add('vimwiki/vimwiki', { type = 'opt' })
  packager.add('Shougo/deoplete.nvim')
  packager.add('autozimu/LanguageClient-neovim', { ['do'] = 'bash install.sh' })
  packager.add('morhetz/gruvbox')
  packager.add('lewis6991/gitsigns.nvim', {requires = 'nvim-lua/plenary.nvim'})
  packager.add('haorenW1025/completion-nvim', {requires = {
    {'nvim-treesitter/completion-treesitter', {requires = 'nvim-treesitter/nvim-treesitter'}},
    {name = 'steelsojka/completion-buffers', opts = {type = 'opt'}},
    'kristijanhusak/completion-tags',
  }})
  packager.add('hrsh7th/vim-vsnip-integ', {requires = {'hrsh7th/vim-vsnip'} })
  packager['local']('~/my_vim_plugins/my_awesome_plugin')

  --Provide full URL; useful if you want to clone from somewhere else than Github.
  packager.add('https://my.other.public.git/tpope/vim-fugitive.git')

  --Provide SSH-based URL; useful if you have write access to a repository and wish to push to it
  packager.add('[email protected]:mygithubid/myrepo.git')

  packager.add('kristijanhusak/vim-js-file-import', { ['do'] = 'npm install', type = 'opt' })
  packager.add('fatih/vim-go', { ['do'] = ':GoInstallBinaries', type = 'opt' })
  packager.add('neoclide/coc.nvim', {branch = 'master', ['do'] = function(plugin)
    vim.loop.spawn('yarn', {
        args = {'install'},
        cwd = plugin.dir,
      })
  end})
  packager.add('sonph/onehalf', {rtp = 'vim/'})
end)

and run PackagerInstall or PackagerUpdate. See all available commands here

Functions

packager#setup(callback_function, opts)

This is a small wrapper around functions explained below. It does this:

  1. Adds all necessary commands. PackagerInstall, PackagerUpdate, PackagerClean and PackagerStatus
  2. Running any of the command does this:
  • calls packager#init(opts)
  • calls provided callback_function with packager instance
  • calls proper function for the command

packager#init(options)

Available options:

  • depth - --depth value to use when cloning. Default: 5
  • jobs - Maximum number of jobs that can run at same time. 0 is treated as unlimited. Default: 8
  • dir - Directory to use for installation. By default uses &packpath value, which is ~/.vim/pack/packager in Vim, and ~/.config/nvim/pack/packager in Neovim.
  • window_cmd - What command to use to open packager window. Default: vertical topleft new
  • default_plugin_type - Default type option for plugins where it's not provided. More info below in packager#add options. Default: start
  • disable_default_mappings - Disable all default mappings for packager buffer. Default: 0

packager#add(name, options)

name - Url to the git directory, or only last part of it to use github.

Example: for github repositories, kristijanhusak/vim-packager is enough, for something else, like bitbucket, use full path https://bitbucket.org/owner/package

Options:

  • name - Custom name of the plugin. If ommited, last part of url explained above is taken (example: vim-packager, in kristijanhusak/vim-packager)
  • type - In which folder to install the plugin. Plugins that are loaded on demand (with packadd), goes to opt directory, where plugins that are auto loaded goes to start folder. Default: start
  • branch - git branch to use. Default: '' (Uses the default from the repository, usually master)
  • tag - git tag to use. Default: ''
  • rtp - Used in case when subdirectory contains vim plugin. Creates a symbolink link from subdirectory to the packager folder. If type of package is opt use packadd {packagename}__{rtp} to load it (example: packadd onehalf__vim)
  • commit - exact git commit to use. Default: '' (Check below for priority explanation)
  • do - Hook to run after plugin is installed/updated: Default: ''. Examples below.
  • frozen - When plugin is frozen, it is not being updated. Default: 0
  • requires - Dependencies for the plugin. Can be
    • string (ex. 'kristijanhusak/vim-packager')
    • list (ex. ['kristijanhusak/vim-packager', {'type': 'opt'}])
    • dict (ex. {'name': 'kristijanhusak/vim-packager', 'opts': {'type': 'opt'} }). See example vimrc above.

branch, tag and commit options go in certain priority:

  • commit
  • tag
  • branch

Hooks can be defined in 3 ways:

  1. As a string that doesn't start with :. This runs the command as it is a shell command, in the plugin directory. Example:
call packager#add('junegunn/fzf', { 'do': './install --all'})
call packager#add('kristijanhusak/vim-js-file-import', { 'do': 'npm install' })
  1. As a string that starts with :. This executes the hook as a vim command. Example:
  call packager#add('fatih/vim-go', { 'do': ':GoInstallBinaries' })
  call packager#add('iamcco/markdown-preview.nvim' , { 'do': ':call mkdp#util#install()' })
  1. As a funcref that gets the plugin info as an argument. Example:
  call packager#add('iamcco/markdown-preview.nvim' , { 'do': { -> mkdp#util#install() } })
  call packager#add('junegunn/fzf', { 'do': function('InstallFzf') })

  function! InstallFzf(plugin) abort
    exe a:plugin.dir.'/install.sh --all'
  endfunction

packager#local(name, options)

Note: This function only creates a symbolic link from provided path to the packager folder

name - Full path to the local folder Example: ~/my_plugins/my_awesome_plugin

Options:

  • name - Custom name of the plugin. If ommited, last part of path is taken (example: my_awesome_plugin, in ~/my_plugins/my_awesome_plugin)
  • type - In which folder to install the plugin. Plugins that are loaded on demand (with packadd), goes to opt directory, where plugins that are auto loaded goes to start folder. Default: start
  • do - Hook to run after plugin is installed/updated: Default: ''
  • frozen - When plugin is frozen, it is not being updated. Default: 0

packager#install(opts)

This only installs plugins that are not installed

Available options:

  • on_finish - Run command after installation finishes. For example to quit at the end: call packager#install({ 'on_finish': 'quitall' })
  • plugins - Array of plugin names to install. Example: call packager#install({'plugins': ['gruvbox', 'gitsigns.nvim']})

When installation finishes, there are two mappings that can be used:

  • 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)
  • 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.

packager#update(opts)

This installs plugins that are not installed, and updates existing one to the latest (If it's not marked as frozen)

Available options:

  • on_finish - Run command after update finishes. For example to quit at the end: call packager#update({ 'on_finish': 'quitall' })
  • 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 })
  • plugins - Array of plugin names to update. Example: call packager#update({'plugins': ['gruvbox', 'gitsigns.nvim']})

When update finishes, there are two mappings that can be used:

  • 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)
  • 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.

packager#status()

This shows the status for each plugin added from vimrc.

You can come to this view from Install/Update screens by pressing D.

Each plugin can have several states:

  • Not installed - Plugin directory does not exist. If something failed during the clone process, shows the error message that can be previewed with E
  • Install/update failed - Something went wrong during installation/updating of the plugin. Press E on the plugin line to view stdout of the process.
  • Post hook failed - Something went wrong with post hook. Press E on the plugin line to view stdout of the process.
  • OK - Plugin is properly installed and it doesn't have any update information.
  • Updated - Plugin has some information about the last update.

packager#clean()

This removes unused plugins. It will ask for confirmation before proceeding. Confirmation allows selecting option to delete all folders from the list (default action), or ask for each folder if you want to delete it.

Commands

Commands are added only when using packager#setup or Lua require('packager').setup()

Configuration

Several buffer mappings are added for packager buffer by default:

  • q - Close packager buffer (<Plug>(PackagerQuit))
  • <CR> - Preview commit under cursor (<Plug>(PackagerOpenSha))
  • E - Preview stdout of the installation process of plugin under cursor (<Plug>(PackagerOpenStdout))
  • <C-j> - Jump to next plugin (<Plug>(PackagerGotoNextPlugin))
  • <C-k> - Jump to previous plugin (<Plug>(PackagerGotoPrevPlugin))
  • D - Go to status page (<Plug>(PackagerStatus))
  • O - Open details of plugin under cursor (<Plug>(PackagerPluginDetails))

To use different mapping for any of these, create filetype autocmd with different mapping.

For example, to use <c-h> instead of <c-j> for jumping to next plugin, add this to vimrc:

autocmd FileType packager nmap <buffer> <C-h> <Plug>(PackagerGotoNextPlugin)

Thanks to:

vim-packager's People

Contributors

andrewferrier avatar deathlyfrantic avatar kristijanhusak avatar mvarelaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-packager's Issues

Possible feature: PackagerSnapshot command

I like vim-packager better than minpac because of its more useful feedback during install and update operations.

It would be nice in my use case to have an equivalent to vim-plug's PlugSnapshot command, which writes a vim buffer with the current plugins and their commit IDs, like so:

" Generated by vim-plug
" Mon 26 Sep 2022 02:36:23 PM MDT
" :source this file in vim to restore the snapshot
" or execute: vim -S snapshot.vim

silent! let g:plugs['base16-vim'].commit = '3be3cd82cd31acfcab9a41bad853d9c68d30478d'
silent! let g:plugs['fzf'].commit = '731daf0f37bcaa45ba6ec6f67f716a76c291ad35'
silent! let g:plugs['fzf.vim'].commit = '9ceac718026fd39498d95ff04fa04d3e40c465d7'
silent! let g:plugs['vim-fugitive'].commit = 'dd8107cabf5fe85df94d5eedcae52415e543f208'
silent! let g:plugs['vim-mkbuild'].commit = '8d497467bb03397587c1ae6364afb56542164484'
silent! let g:plugs['vim-sensible'].commit = '8985da7669bbd73afce85ef0e4a3e1ce2e488595'

PlugUpdate!

I write this to a file that I keep alongside vimrc in my dotfiles.git. If I ever update plugins and things break, I can revert the update by running the above vimscript. With this scheme, I can also revert to any previous version of my vim setup and easily replicate a setup to another computer.

Error using requires option with list

I've encountered an error while using the requires option with a list.

call a:packager.add('tools-life/taskwiki', {'requires': ['vimwiki/vimwiki', {'branch': 'dev'}]})

The above produces this error:

Error detected while processing function <SNR>3_run_cmd[2]..<SNR>2_packager_init[31]..2[1]..pa
ckager#plugin#new[1]..52[45]..3:                                                              
line   14:                                                                                    
E605: Exception not caught: Missing "requires" package name for taskwiki.                     
Error detected while processing function <SNR>3_run_cmd[2]..<SNR>2_packager_init[31]..2[1]..pa
ckager#plugin#new[1]..52:                                                                     
line   45:                                                                                    
E170: Missing :endfor

However, wrapping the 'vimwiki' list in another list works:

call a:packager.add('tools-life/taskwiki', {'requires': [['vimwiki/vimwiki', {'branch': 'dev'}]]})

Error (exit status 127)

When running packager#update(), I get this error for already installed packages.

First issue 🎉

Configurable keybindings

Would you consider making keybindings configurable in some way? I use <C-j> and <C-k> to move between windows and having them mapped to move between plugins here always trips me up. I could use some timer hackery to removing the bindings after they're set but that doesn't feel great.

Crash on :PackagerUpdate

When I run :PackagerUpdate, I get this

Error detected while processing function packager#update[2]..284[19]..308[2]..305[18]..313:
line   13:
E730: using List as a String
E116: Invalid arguments for function get(split(l:ref, '/') -1, '')
Error detected while processing function packager#update[2]..284[19]..308:
line    2:
E714: List required

Also, the plugin window does not show many plugins, and shows an error:

Installing plugins 4 / 33
[======--------------------------------------------]

✗ eunuch — Error (exit status 2) - -abefhkmnptuvxBCHP or -o option
✓ snippets — Already up to date.
✓ matchup — Already up to date.
✓ nvim-yarp — Already up to date.

Here is my vimrc: https://github.com/greg0ire/dotvim/blob/master/vimrc

question about the post-install hooks

I have a few questions regarding the value for do in packager#add() function.

  1. For nvim-gdb, it requires us to run install.sh script and :UpdateRemotePlugins command after install. Is it possible to combine the two in post update? I can't seem to get it right. For vim-plug, the following would work:
 Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
  1. It seems that post-install hooks default to bash command. So for deoplete call packager#add('Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}) works, while call packager#add('Shougo/deoplete.nvim', {'do': 'UpdateRemotePlugins'}) (note that there is no colon before the UpdateRemotePlugins) does not. Is the colon a must?

Thanks for this wonderful plugin. It seems to be even faster than vim-plug. Very promising!

E117 on `:PackagerUpdate`

Thanks for the awesome vim-packager! I switched recently from minpac (https://github.com/k-takata/minpac) to packager and am enjoying your plugin manager very much!

Nevertheless I'm having an issue: while running :PackagerUpdate I'm getting the following error:

Error detected while processing function <lambda>5[1]..35:
line   18:
E117: Unknown function: setbufline

But the updating process seems to work (at least the most recent repository versions are pulled). The other commands (:PackagerStatus, :PackagerInstall) seem to work fine.

The relevant section from my '~/.config/nvim/init.vim' are:


function! PackagerInit() abort
  packadd vim-packager
  call packager#init()
  call packager#add('kristijanhusak/vim-packager', { 'type': 'opt' })

  call packager#add('https://github.com/tpope/vim-vinegar')

  " ...

endfunction

command!        PackagerInstall call    PackagerInit() | call packager#install()
command! -bang  PackagerUpdate  call    PackagerInit() | call packager#update({ 'force_hooks': '<bang>' })
command!        PackagerClean   call    PackagerInit() | call packager#clean()
command!        PackagerStatus  call    PackagerInit() | call packager#status()

I'm using nvim v0.3.4 on a Debian-based OS (PureOS 9.0 amber).

Any ideas?

"Last update" shows all updates

When I run ":call packager#status()", I always see all updates pulled since the initial installation, instead of only the last updates.
I found that it is solved by running "git checkout master" manually in the repositories of the plugins, but this is not ideal obvisouly.

VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 28 2018 01:38:28)
Included patches: 1-549

Latest version of vim-packager

git version 2.19.2

Document using 'git@' SSH URLs for packages user may want to modify

I maintain a few git plugins myself. It's not documented, but I tried using [email protected]:... style URLs (as generated by GitHub when you select the 'Clone via SSH' option, and they worked! This is an incredibly useful resource for any plugin author, or anyone who plans to fork and modify a plugin.

I suggest documenting this in the README, perhaps with an example. I'd be happy to send in a pull req if you're interested.

`Too many open files: "sh"` error since 234249d

Since commit 234249d I'm getting the following error when trying add my plugins to Packager using packager#add():

Error detected while processing function <SNR>15_packager_init[8]..packager#add[2]..17[1]..packager#plugin#new[1]..37[20]..48[1]..packager#utils#system_async[9]..packager#job#start[1]..<SNR>78_job_start:
line   30:
E903: Process failed to start: too many open files: "sh"

Commit 86be118 is the last one that works without this error. I have 41 plugins. I'm using Neovim on macOS 10.14.6.

Update selected packages

How do I update a single package(or few packages)? Many times I don't want to update all the packages.

Cannot install a plugin as an optional

Thank you for the great package manager. It's fast and simple and I just love it. I just have one problem when trying to install some plugins as an optional type. One such example is https://github.com/iamcco/markdown-preview.nvim which I added like this:

call packager#add('iamcco/markdown-preview.nvim', {'do': 'sh -c "cd app & yarn install"', 'type': 'opt'})

and then:

augroup packager_filetype
  autocmd!
  autocmd FileType markdown packadd markdown-preview
augroup END

but when I open a markdown file, all the commands for this plugin are missing. I had the same problem with few other plugins with optional type (but not will all) so maybe I am missing something.

runtimepath is not added automatically for all plugins

through reasons i have yet known, certain plugins like lambdalisue/gina.vim still requires the following to be done manually 🤔

set runtimepath+=~/.config/nvim/pack/packager/start/gina.vim

otherwise it's not recognized

Add setting to default to 'opt' type

Thanks for the plugin, I think it's the best way to manage vim packages right now. I currently have a shim function that sets the plugins to {'type': 'opt'} by default. I was wondering if there is any interest in incorporating this into the plugin.

I generally only put filetype plugins in 'start', but maybe my usage is not common.

'Error (exit status 128)'

information

OS: Windows 10 1903 build 18362.535
Vim Version: Neovim v0.5.0-240-gbc879dd1f

init.vim

" Load packager only when you need it
function! PackagerInit() abort
  packadd vim-packager
  call packager#init()
  call packager#add('kristijanhusak/vim-packager', { 'type': 'opt' })
  call packager#add('easymotion/vim-easymotion', { 'type': 'opt' })
  call packager#add('neovim/nvim-lsp', { 'type': 'opt'})
endfunction

command! PackagerInstall call PackagerInit() | call packager#install()
command! -bang PackagerUpdate call PackagerInit() | call packager#update({ 'force_hooks': '<bang>' })
command! PackagerClean call PackagerInit() | call packager#clean()
command! PackagerStatus call PackagerInit() | call packager#status()

Detail info

When running :PackagerInstal in nvim, git clone info shows properly at first, and when clone finished (I do found plugins at ~\AppData\Local\nvim\pack\packager\opt) it shows that
Error (exit status 128) - fatal: not a git repository (or any of the parent directories): .git
It shows the same error when i run :PackagerUpdate command.

With default value of jobs, PackagerUpdate freezes at 9 updated plugins

With the default call packager#init() when calling command :PackagerUpdate it freezes with status “9 of 60 updates”. I had to switch to {'jobs': 0} to get updates working (although, now the command seems unnervingly too fast, I am not sure whether the update actually happened).

Using neovim from the master branch of the github repo (commit bb24fec33 if it matters).

bottom bar

i use an 80 col terminal, so the side bar is hard to use; could we have an option for a bottom bar?

[Suggestion] Move the directory if the only change was plugin type (start or opt)

First of all, thank you for making this great plugin manager. I've been using minpac for a while. I like how minpac works, but I don't really like the interface. That's why I decided to try vim-packager.

While using it, I've noticed that when i changed the plugin type (changed from opt to start) and do an update, vim-packager re-cloning the plugin repo rather than moving the plugin directory from opt directory to start directory. So there are two directories which is basically the same.

For now, what I use is call packager#clean() | call packager#update(<args>) so that there's no double directories of the same plugin. Is there a way to move the plugin directory if the only thing that changed is the plugin type? Like, checking if the plugin directory already in start or opt first before doing the update.

Thank you.

How to lazy load a plugin on event ?

For example , i want to lazy load a autocompletion plugin like nvim-compe on InsertEnter ,what should i do ?
I tried the following, but failed

if &compatible
	set nocompatible
endif

" Load packager only when you need it
function! PackagerInit() abort
	packadd vim-packager
	call packager#init()
	call packager#add('kristijanhusak/vim-packager', { 'type': 'opt' })
	" complete
	call packager#add('neovim/nvim-lspconfig')
	call packager#add('hrsh7th/nvim-compe', { 'type': 'opt' })
	" call packager#add('hrsh7th/nvim-compe')
	" call packager#add('hrsh7th/vim-vsnip-integ', {'requires': ['hrsh7th/vim-vsnip'] })

" ui
call packager#add('bagrat/vim-buffet', { 'type': 'opt' })

endfunction



" These commands are automatically added when using `packager#setup()`
command! -nargs=* -bar PackagerInstall call PackagerInit() | call packager#install(<args>)
command! -nargs=* -bar PackagerUpdate call PackagerInit() | call packager#update(<args>)
command! -bar PackagerClean call PackagerInit() | call packager#clean()
command! -bar PackagerStatus call PackagerInit() | call packager#status()

"Load plugins only for specific filetype
"Note that this should not be done for plugins that handle their loading using ftplugin file.
"More info in :help pack-add
" augroup packager_filetype
"   autocmd!
"   autocmd FileType javascript packadd vim-js-file-import
"   autocmd FileType go packadd vim-go
" augroup END

"Lazy load plugins with a mapping
" nnoremap <silent><Leader>ww :unmap <Leader>ww<BAR>packadd vimwiki<BAR>VimwikiIndex<CR>
set completeopt=menuone,noselect " required
augroup packager_envent
	autocmd!
	autocmd InsertEnter * packadd nvim-compe
	autocmd BufReadPre,BufNewFile * packadd vim-buffet
augroup END

let g:buffet_powerline_separators = 1
let g:buffet_left_trunc_icon = "\uf0a8"
let g:buffet_right_trunc_icon = "\uf0a9"

" compe
let g:compe = {}
let g:compe.enabled = v:true
let g:compe.autocomplete = v:true
let g:compe.debug = v:false
let g:compe.min_length = 0
let g:compe.preselect = 'enable'
let g:compe.throttle_time = 80
let g:compe.source_timeout = 200
let g:compe.incomplete_delay = 400
let g:compe.max_abbr_width = 100
let g:compe.max_kind_width = 100
let g:compe.max_menu_width = 100
let g:compe.documentation = v:true

let g:compe.source = {}
let g:compe.source.path = v:true
let g:compe.source.buffer = v:true
let g:compe.source.calc = v:false
let g:compe.source.nvim_lsp = v:true
let g:compe.source.nvim_lua = v:true
let g:compe.source.vsnip = v:true
highlight link CompeDocumentation NormalFloat
inoremap <silent><expr> <C-Space> compe#complete()
inoremap <silent><expr> <CR>      compe#confirm('<CR>')
inoremap <silent><expr> <C-e>     compe#close('<C-e>')
inoremap <silent><expr> <C-f>     compe#scroll({ 'delta': +4 })
inoremap <silent><expr> <C-d>     compe#scroll({ 'delta': -4 })
" lsp
lua require("lsp_config")

In addition , is there anyway to control a plugin config before/after a lazy load plugin ? Thanks.

vim-packager removes itself when running PackagerClean

vim-packager removes itself when running PackagerClean

I get this:
"Clean up [$MY_HOME]/.config/nvim/pack/packager/opt/vim-packager — Waiting for confirmation..."

This is the part of my config.

function! PackagerInit() abort
  packadd vim-packager
  call packager#init()

  call packager#add(...
endfunction

command! PackagerInstall call PackagerInit() | call packager#install()
command! -bang PackagerUpdate call PackagerInit() | call packager#update({ 'force_hooks': '<bang>' })
command! PackagerClean call PackagerInit() | call packager#clean()
command! PackagerStatus call PackagerInit() | call packager#status()

Error exit status 1 and plugins are actually installed.

Hi, this is good plugin with nice UI. I tried this plugin on my Linux server. When I run :call packager#update(), I am seeing Error (exit status 1) for every plugin I try to install. The full error is (using E):

usage: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] deinit [-f|--force] [--] <path>...
   or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--reference <re
pository>] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--recursive] [--] [<path>...]                                                                   

I suppose this is somehow related to git command, but I am not sure how to fix it. My git version (git --version): 2.7.4.

My minimal failing config:

packadd vim-packager
let site_path = stdpath('data') . '/site/pack/my_plugins'
call packager#init({'dir': site_path, 'jobs': 16})
call packager#add('prabirshrestha/vim-lsp')

Start with nvim -u minimal.vim and then :call packager#update(), and then I see the error message.

Update Error on Linux: too many open files

Information

OS: Ubuntu 18.04
Vim Version: Neovim 0.5-dev (nightly)

Commit responsible: "Use async command calls when possible"

I successfully bisected to this commit: 234249d

Command

call PackagerInit() | call packager#update({ 'force_hooks': '<bang>' })

Error

Error detected while processing function PackagerInit[168]..packager#add[2]..26[1]..packager#pl
ugin#new[1]..46[20]..57[1]..packager#utils#system_async[9]..packager#job#start[1]..<SNR>176_job
_start:
line   30:
E903: Process failed to start: too many open files: "sh"

packager.add() URL detection

Not an issue per se but an FYI that might suggest a code change.

Deciding if a URL supplied in a packager.add() call is a 'name/repo' for github or not may need to be expanded. Here's a couple of SSH based Git URLs that vim-packager currently misinterprets:

function! s:packager_init(packager) abort
  call a:packager.add('kristijanhusak/vim-packager', { 'type': 'opt' })
  ...
  call a:packager.add('ssh://proj.sporian.com:29418/~smckown/vim-mkbuild.git')
  call a:packager.add('repo.titaniummirror.com:vim-mkbuild.git')
  ...
  call plug#end()
endfunction

My quick and dirty solution is to assume that no valid GitHUb 'name/repo' URL will contain either '@' or ':'.

diff --git i/autoload/packager/plugin.vim w/autoload/packager/plugin.vim
index 73c6425..34040c7 100644
--- i/autoload/packager/plugin.vim
+++ w/autoload/packager/plugin.vim
@@ -27,7 +27,7 @@ function! s:plugin.new(name, opts, packager) abort
     let l:rtp = substitute(l:rtp, '[\\\/]', '__', 'g')
     let l:instance.rtp_dir = printf('%s__%s', l:instance.dir, l:rtp)
   endif
-  let l:instance.url = a:name =~? '^\(http\|git@\).*'
+  let l:instance.url = a:name =~? '\(@\|:\)'
         \ ? a:name
         \ : l:instance.local ? a:name : printf('https://github.com/%s', a:name)
   let l:instance.event_messages = []

The ability to get plugin list

Minpack have minpac#getpluglist and minpac#getpluginfo. In very convenient for scripting. Could you add a the same API?

readme issue

In the second init.vim setup example, there is a spelling error of PackagerUpdate

" These commands are automatically added when using packager#setup()
command! -nargs=* -bar PackagerInstall call PackagerInit() | call packager#install()
command! -nargs=* -bar ackagerUpdate call PackagerInit() | call packager#update()

Controlling load order

I like the manager. Super light and works great. One question: Is there any way to control load order. For example vim-devicons must load before vim-startify for icons to work.

Thanks again!

Switching from minpac, slow startup

This might not be a plugin issue, maybe it's more how my config is set up. But I hope I can find some pointers on how to fix this.

This is my current setup with minpac & plugins#init() is called in init.vim

This is the new setup with vim-packager as you can see nothing much changed, it's a drop-in replacement for minpac.

I'm facing an issue with this line which runs every time I open neovim. With minpac there is nearly no overhead & things are instantaneous but with vim-packager this takes a couple of seconds.

minpac
minpac

vim-packager
vim-packager

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.