diff --git a/README.md b/README.md index 51a0321..eee5f47 100644 --- a/README.md +++ b/README.md @@ -83,20 +83,15 @@ plug "$HOME/.config/zsh/aliases.zsh" plug "$HOME/.config/zsh/exports.zsh" ``` -By default `Zap` when installing a plugin will clone a GitHub repository using a HTTPS web URL, if you require to be able to install from a private GitHub or from a different git server (for example GitLab) you can provide a different URL prefix to be used. For example, using a password-protected SSH key: +By default `Zap` when installing a plugin will clone a GitHub repository using a HTTPS web URL, if you require to be able to install from a private GitHub or from a different git server (for example GitLab) you can provide a different URL prefix to be used. For example: ```zsh -# Your ZSHRC file -... - -# Example globally set Zap to git clone using an SSH key -export ZAP_GIT_PREFIX='git@github.com:' +# Example globally seting the prefix for Zap to git clone using an SSH key +export ZAP_GIT_PREFIX="git@github.com:" plug "zap-zsh/private-repo" # Example git clone using GitLab for a single plugin -ZAP_GIT_PREFIX='https://gitlab.com/' plug "user/repo" - -... +ZAP_GIT_PREFIX="https://gitlab.com/" plug "user/repo" ``` It is possible to call `plug` in any interactive shell session to source a file or to download and source a plugin for that particular session. @@ -127,8 +122,16 @@ Zap provided commands for updating and cleaning up plugins ## Uninstall +To uninstall Zap, when currently active, execute the following: + +```zsh +rm -rf "$ZAP_DIR" +``` + +When not currently active, execute the following: + ```zsh -rm -rf ~/.local/share/zap +rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/zap" ``` ## Notes @@ -137,7 +140,7 @@ For sourcing local files use `$HOME` instead of `~` when giving a full path to t --- -[![zap thumbnail](https://user-images.githubusercontent.com/29136904/237558142-b6201b3f-bf85-4866-95f3-df275cc94759.png)](https://www.youtube.com/watch?v=LhDMw6n3GI4) +[![zap thumbnail](https://user-images.githubusercontent.com/29136904/238183118-943e3f25-5198-45a5-a22e-45a3a27db11d.png)](https://www.youtube.com/watch?v=LhDMw6n3GI4) diff --git a/zap.zsh b/zap.zsh index 5ee2f85..78effd3 100644 --- a/zap.zsh +++ b/zap.zsh @@ -40,7 +40,10 @@ function plug() { git clone --depth 1 "${ZAP_GIT_PREFIX:-"https://github.com/"}${plugin}.git" "$plugin_dir" > /dev/null 2>&1 || { echo -e "\e[1A\e[K❌ Failed to clone $plugin_name"; return 12 } echo -e "\e[1A\e[K⚡ Zap installed $plugin_name" fi - [[ -n "$git_ref" ]] && { git -C "$plugin_dir" checkout "$git_ref" > /dev/null 2>&1 || { echo "❌ Failed to checkout $git_ref"; return 13 }} + [[ -n "$git_ref" ]] && { + git -C "$plugin_dir" pull --unshallow > /dev/null 2>&1 + git -C "$plugin_dir" checkout "$git_ref" > /dev/null 2>&1 || { echo "❌ Failed to checkout $git_ref"; return 13 } + } _try_source && { ZAP_INSTALLED_PLUGINS+="$plugin_name" && return 0 } || echo "❌ $plugin_name not activated" && return 1 }