|
1 | 1 | # Miscellaneous auto-load Vim scripts
|
2 | 2 |
|
3 |
| -The git repository at <http://github.com/xolox/vim-misc> contains Vim scripts that are used by most of the [Vim plug-ins I've written] [plugins] yet don't really belong with any single one. I include this repository as a subdirectory of my plug-in repositories using the following commands: |
| 3 | +The git repository at [github.com/xolox/vim-misc] [repository] contains Vim scripts that are used by most of the [Vim plug-ins I've written] [plugins] yet don't really belong with any single one. I include this repository as a subdirectory of my plug-in repositories using the following commands: |
4 | 4 |
|
5 | 5 | $ git remote add -f vim-misc https://github.com/xolox/vim-misc.git
|
6 | 6 | $ git merge -s ours --no-commit vim-misc/master
|
7 | 7 | $ git read-tree --prefix=autoload/xolox/misc/ -u vim-misc/master
|
8 | 8 | $ git commit -m "Merge vim-misc repository as subdirectory"
|
9 | 9 |
|
10 |
| -To update a plug-in repository to the latest versions of the miscellaneous auto-load scripts I execute the following command: |
| 10 | +The above trick is called the [subtree merge strategy] [merge-strategy]. To update a plug-in repository to the latest version of the miscellaneous auto-load scripts I execute the following command: |
11 | 11 |
|
12 | 12 | $ git pull -s subtree vim-misc master
|
13 | 13 |
|
| 14 | +## Why make things so complex? |
| 15 | + |
| 16 | +I came up with this solution after multiple years of back and forth between Vim Online users, the GitHub crowd and my own sanity: |
| 17 | + |
| 18 | +1. When I started publishing my first Vim plug-ins I would prepare ZIP archives for Vim Online using makefiles. The makefiles would make sure the miscellaneous scripts were included in the uploaded distributions. This had two disadvantages: It lost git history and the repositories on GitHub were not usable out of the box, so [I got complaints from GitHub (Pathogen) users] [github-complaints]. |
| 19 | + |
| 20 | +2. My second attempt to solve the problem used git submodules which seemed like the ideal solution until I actually started doing it. Submodules are not initialized during a normal `git clone`, you need to use `git clone --recursive` instead but Vim plug-in managers like [Pathogen] [pathogen] and [Vundle] [vundle] don't do this (at least [they didn't when I tried] [vundle-discussion]) so people would end up with broken checkouts. |
| 21 | + |
| 22 | +3. After finding out that git submodules were not going to solve my problems I searched for other inclusion strategies supported by git. After a while I came upon the [subtree merge strategy] [merge-strategy] which I have been using for more than two years now. |
| 23 | + |
| 24 | +## Compatibility issues |
| 25 | + |
| 26 | +Regardless of the inclusion strategies discussed above, my current scheme has a flaw: If more than one of my plug-ins are installed in a Vim profile using [Pathogen] [pathogen] or [Vundle] [vundle], the miscellaneous autoload scripts will all be loaded from the subdirectory of one single plug-in. |
| 27 | + |
| 28 | +This means that when I break compatibility in the miscellaneous scripts, I have to make sure to merge the changes into all of my plug-ins. Even then, if a user has more than one of my plug-ins installed but updates only one of them, the other plug-ins (that are not yet up to date) can break (because of the backwards incompatible change). |
| 29 | + |
| 30 | +The `xolox#misc#compat#check()` function makes sure that incompatibilities are detected early so that the user knows which plug-in to update if incompatibilities arise. |
| 31 | + |
14 | 32 | ## Contact
|
15 | 33 |
|
16 | 34 | If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/misc> and <http://github.com/xolox/vim-misc>.
|
17 | 35 |
|
18 | 36 | ## License
|
19 | 37 |
|
20 |
| -This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License). |
21 |
| -© 2011 Peter Odding <<peter@peterodding.com>>. |
| 38 | +This software is licensed under the [MIT license] [mit]. |
| 39 | +© 2013 Peter Odding <<peter@peterodding.com>>. |
22 | 40 |
|
23 | 41 |
|
| 42 | +[github-complaints]: https://github.com/xolox/vim-easytags/issues/1 |
| 43 | +[merge-strategy]: http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html |
| 44 | +[mit]: http://en.wikipedia.org/wiki/MIT_License |
| 45 | +[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332 |
24 | 46 | [plugins]: http://peterodding.com/code/vim/
|
| 47 | +[repository]: https://github.com/xolox/vim-misc |
| 48 | +[vundle-discussion]: https://github.com/gmarik/vundle/pull/41 |
| 49 | +[vundle]: https://github.com/gmarik/vundle |
0 commit comments