...
|
...
|
@@ -2,10 +2,63 @@
|
2
|
2
|
|
3
|
3
|
A 14-line [Vim][] "plugin manager" using [Git][] and [`:packadd`][].
|
4
|
4
|
|
|
5
|
+Annoyed by having to [bootstrap plugin manager plugins][vim-plug-installation]?
|
|
6
|
+By having to run a [separate install step][vim-plug-pluginstall] even though
|
|
7
|
+you explicitly said you wanted a plugin in your `vimrc`? Tired of your plugin
|
|
8
|
+manager doing [weird, hard to debug][vim-plug-issues] things behind your back?
|
|
9
|
+Concerned that GitHub is becoming the [implicit custodian][vim-plug-url-format]
|
|
10
|
+of all of the worlds software? <small>*(I bully [`vim-plug`][] here, probably
|
|
11
|
+undeservedly, because it is the most popular. I used it for a long time and
|
|
12
|
+it's great!)*</small>
|
|
13
|
+
|
|
14
|
+Give this a try in your [`vimrc`][]!
|
|
15
|
+
|
|
16
|
+```vim
|
|
17
|
+" https://git.rcrnstn.net/rcrnstn/vim-gitadd
|
|
18
|
+" Make sure to not enable |:syntax| or |:filetype| until all plugins that
|
|
19
|
+" interact with them have been added! See |:packadd|.
|
|
20
|
+command! -bar -bang -nargs=+ GitAdd call s:GitAdd(<q-bang>, <f-args>)
|
|
21
|
+function! s:GitAdd(bang, url, ...) abort
|
|
22
|
+ let name = split(a:url, '/')[-1]
|
|
23
|
+ let dir = split(&packpath, ',')[0] . '/pack/gitadd/opt/' . name
|
|
24
|
+ if !isdirectory(dir)
|
|
25
|
+ silent execute '!git clone --recurse-submodules' join(a:000) a:url dir
|
|
26
|
+ if isdirectory(dir . '/doc')
|
|
27
|
+ execute 'helptags' dir . '/doc'
|
|
28
|
+ endif
|
|
29
|
+ endif
|
|
30
|
+ if empty(a:bang)
|
|
31
|
+ execute 'packadd!' name
|
|
32
|
+ endif
|
|
33
|
+endfunction
|
|
34
|
+```
|
|
35
|
+
|
|
36
|
+Any arguments that [`git clone`][] accepts, e.g. [`--branch`][] or
|
|
37
|
+[`--depth`][], can be given after the URL.
|
|
38
|
+
|
|
39
|
+Requiring the full URL might be slightly annoying, but it is self-documenting,
|
|
40
|
+works with [`netrw-gx`][], and does not discriminate against non-GitHub
|
|
41
|
+repositories by making them stick out like a sore thumb.
|
|
42
|
+
|
|
43
|
+No "update plugins" command? Nope. You know what tool is great at handling
|
|
44
|
+different versions of software? Git! A Git alias/shell function helps,
|
|
45
|
+something to the effect of `for dir in *; do echo "=== $dir ==="; git -C "$dir"
|
|
46
|
+"$@"; done`.
|
|
47
|
+
|
5
|
48
|
[`vim-gitadd`]: https://git.rcrnstn.net/rcrnstn/vim-gitadd
|
6
|
49
|
[Vim]: https://en.wikipedia.org/wiki/Vim_(text_editor)
|
7
|
50
|
[Git]: https://en.wikipedia.org/wiki/Git
|
8
|
51
|
[`:packadd`]: https://vimhelp.org/repeat.txt.html#%3Apackadd
|
|
52
|
+[vim-plug-installation]: https://github.com/junegunn/vim-plug/blob/0.11.0/README.md#installation
|
|
53
|
+[vim-plug-pluginstall]: https://github.com/junegunn/vim-plug/blob/0.11.0/README.md#pluginstall-and-plugupdate
|
|
54
|
+[vim-plug-issues]: https://github.com/junegunn/vim-plug/issues?q=
|
|
55
|
+[vim-plug-url-format]: https://github.com/junegunn/vim-plug/blob/0.11.0/doc/plug.txt#L231
|
|
56
|
+[`vim-plug`]: https://github.com/junegunn/vim-plug
|
|
57
|
+[`vimrc`]: https://vimhelp.org/starting.txt.html#vimrc
|
|
58
|
+[`git clone`]: https://git-scm.com/docs/git-clone
|
|
59
|
+[`--branch`]: https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---branchltnamegt
|
|
60
|
+[`--depth`]: https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt
|
|
61
|
+[`netrw-gx`]: https://vimhelp.org/pi_netrw.txt.html#netrw-gx
|
9
|
62
|
|
10
|
63
|
## License
|
11
|
64
|
|