Now `:PlugInstall!` and `:PlugUpdate!` forces to update submodules.
`:PlugInstall!` now also checks out to new specified branch, tag, or
commit.
Also added tests for changing branch, tag, or commit.
This commit extracts duplicate logic out of three installers.
Pros.
- Better maintainability
- Easier to add/extend the features
- Fixes a bug when 'commit' option is used, submodules are updated
before the designated commit is checked out
Cons.
- The whole process takes slightly longer due to lost parallelism after pull
- Especially, submodule updates are not parallelized
- However, this shouldn't matter much in practice as there are few
plugins that heavily rely on submodules
- The output file is no longer executable but a source-able vim script
- PlugSnapshot FILENAME to prompt the user if the file already exists
- Add PlugSnapshot! FILENAME variant to force overwrite existing file
- Apply -complete=file option to PlugSnapshot command
The older documentation of vim-plug suggested that the second string
parameter to Plug command was for both branches and tags. But we've
realized that tags and branches are not interchangeable (#174), and it
is now recommended that the user explicitly specify whether it's a
branch or a tag. The now-undocumented second parameter is currently for
branches, but I'd like to change it for tags, as the use of tags are
much more common.
/cc @andreicristianpetcu
plug#begin expands its path argument and converts it to the absolute
path by default. However, it makes sense to use the unexpanded form in
case of PlugSnapshot as described in
https://github.com/junegunn/vim-plug/issues/97#issuecomment-57421483
For example, for the following cases,
- call plug#begin('~/.vim/plugged')
- call plug#begin('$HOME/.vim/plugged')
PlugSnapshot will use the exact arguments, `~/.vim/plugged` or
`$HOME/.vim/plugged`, instead of the absolute paths such as
`/home/jg/.vim/plugged`.