01c1e4b1 |
Annoyed by having to [bootstrap plugin manager plugins][vim-plug-installation]?
By having to run a [separate install step][vim-plug-pluginstall] even though
you explicitly said you wanted a plugin in your `vimrc`? Tired of your plugin
manager doing [weird, hard to debug][vim-plug-issues] things behind your back?
Concerned that GitHub is becoming the [implicit custodian][vim-plug-url-format]
of all of the worlds software? <small>*(I bully [`vim-plug`][] here, probably
undeservedly, because it is the most popular. I used it for a long time and
it's great!)*</small>
Give this a try in your [`vimrc`][]!
```vim
" https://git.rcrnstn.net/rcrnstn/vim-gitadd
" Make sure to not enable |:syntax| or |:filetype| until all plugins that
" interact with them have been added! See |:packadd|.
command! -bar -bang -nargs=+ GitAdd call s:GitAdd(<q-bang>, <f-args>)
function! s:GitAdd(bang, url, ...) abort
let name = split(a:url, '/')[-1]
let dir = split(&packpath, ',')[0] . '/pack/gitadd/opt/' . name
if !isdirectory(dir)
silent execute '!git clone --recurse-submodules' join(a:000) a:url dir
if isdirectory(dir . '/doc')
execute 'helptags' dir . '/doc'
endif
endif
if empty(a:bang)
execute 'packadd!' name
endif
endfunction
```
Any arguments that [`git clone`][] accepts, e.g. [`--branch`][] or
[`--depth`][], can be given after the URL.
Requiring the full URL might be slightly annoying, but it is self-documenting,
works with [`netrw-gx`][], and does not discriminate against non-GitHub
repositories by making them stick out like a sore thumb.
No "update plugins" command? Nope. You know what tool is great at handling
different versions of software? Git! A Git alias/shell function helps,
something to the effect of `for dir in *; do echo "=== $dir ==="; git -C "$dir"
"$@"; done`.
|