Commit 2ac7c0cb0ac5795033c20544a9d4117f76ce9597
1 parent
c17d243a69
Bundles are installed without a bundle-install command.
When a plugin is specified with the `bundle` command, the plugin is immediately installed and loaded. No need of running a bundle-install and restarting your shell.
Showing 1 changed file with 29 additions and 0 deletions Side-by-side Diff
antigen.zsh
| ... | ... | @@ -55,7 +55,36 @@ bundle () { |
| 55 | 55 | # Add it to the record. |
| 56 | 56 | _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $clone_dir $btype" |
| 57 | 57 | |
| 58 | + -antigen-ensure-repo "$url" "$clone_dir" | |
| 59 | + | |
| 58 | 60 | bundle-load "$clone_dir/$loc" "$btype" |
| 61 | + | |
| 62 | +} | |
| 63 | + | |
| 64 | +-antigen-ensure-repo () { | |
| 65 | + | |
| 66 | + local update=false | |
| 67 | + if [[ $1 == --update ]]; then | |
| 68 | + update=true | |
| 69 | + shift | |
| 70 | + fi | |
| 71 | + | |
| 72 | + local handled_repos="" | |
| 73 | + local install_bundles="" | |
| 74 | + | |
| 75 | + local url="$1" | |
| 76 | + local clone_dir="$2" | |
| 77 | + | |
| 78 | + if ! echo "$handled_repos" | grep -Fqm1 "$url"; then | |
| 79 | + if [[ ! -d $clone_dir ]]; then | |
| 80 | + git clone "$url" "$clone_dir" | |
| 81 | + elif $update; then | |
| 82 | + git --git-dir "$clone_dir/.git" pull | |
| 83 | + fi | |
| 84 | + | |
| 85 | + handled_repos="$handled_repos\n$url" | |
| 86 | + fi | |
| 87 | + | |
| 59 | 88 | } |
| 60 | 89 | |
| 61 | 90 | bundle-install () { |