/minPlug

Minimalistic plugin "manager" for Vim8

Primary LanguageVim Script

minPlug

Its function is simple: download, update and enable using :packadd!

It's limited only to GitHub repositories

Best utlized with, nomen omen, minimal list of plugins

<PACKDIR> in this README is a placeholder for substitute(&packpath, ",.*", "", "")."/pack/plugins" which by default equals to ~/.vim/pack/plugins.

Installation

Execute in shell:

git clone https://github.com/Jorengarenar/minPlug.git <PACKDIR>/plugins/opt/minPlug/

and in vimrc add:

packadd minPlug " initialize minPlug

If you want to have minPlug automatically installed, add this to your vimrc:

if empty(glob(substitute(&packpath, ",.*", "", "")."/pack/plugins/opt/minPlug")) " {{{
  call system("git clone --depth=1 https://github.com/Jorengarenar/minPlug ".
        \ substitute(&packpath, ",.*", "", "")."/pack/plugins/opt/minPlug")
  autocmd VimEnter * silent! MinPlugInstall | echo "minPlug: INSTALLED"
endif " }}}

Usage

Add plugin

After initialization of minPlug, use MinPlug in vimrc in such fasion:

MinPlug username/repo branch

If branch isn't provided, as defualt master will be used

To disable plugin, simply comment out this line

Practiacal example: MinPlug Jorengarenar/miniSnip

Single files

If you don't want to download whole repository just for one file (e.g. colorscheme), just add it to g:minPlug_singleFiles list variable in the following manner:

let g:minPlug_singleFiles = [
      \   [ "subdir/filename", "URL", "basedir" ],
      \ ]

basedir is optional and defaults to <PACKDIR>/start/singleFiles.

File from URL will be saved as filename in subdir of basedir

That means it will be loaded even if entry was to be deleted from the list!

Example:

let g:minPlug_singleFiles = [
      \   "[ colors/darkness.vim"   , "https://raw.githubusercontent.com/Jorengarenar/vim-darkness/master/colors/darkness.vim" ],
      \   "[ ftplugin/sql-upper.vim", "https://git.io/JkQjr", "~/.vim" ],
      \ ]

To use this feature you need to have curl installed!

On-demand loading

There is no on-demand loading in minPlug, but you can do:

MinPlug! username/repo branch

This will only add plugin to list, so you can download it, but it won't start automatically

Then you can use autocmd (or ftplugin) to load it on demand using packadd

Example:

MinPlug! Jorengarenar/fauxClip | autocmd filetype cpp packadd fauxClip

Please note, that this way is prone to bugs.

Download/update plugins

:MinPlugInstall

Download/update plugins overriding local changes

:MinPlugInstall!

Delete

Remove MinPlug username/repo line from vimrc, then go to <PACKDIR>/opt and remove the directory of plugin


Configuration

  • packpath - plugins will be downloaded into pack/plugins/opt subdir of the first enrty in this option
  • g:minPlug_updateSelf - whether minPlug should update itself alongside other plugins
  • g:minPlug_singleFiles - list of files to download
  • g:minPlug_echo (default: 0) - displaying list of plugins during installation or not
  • g:minPlug_paBang (default: !) - if empty, MinPlug will load plugins with :pa, otherwise with :pa! (read :h packadd)

Additional note

If you added something to the packpath option, ensure that your desired destination is first in the list
(use ^=, e.g. set packpath^=$XDG_DATA_HOME/vim)