-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from zap-zsh/mamaraddio-patch
Massive refactor and a bug fix
- Loading branch information
Showing
7 changed files
with
145 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[*.*sh] | ||
shell_variant = bash | ||
[*.zsh] | ||
shell_variant = zsh | ||
indent_style = space | ||
indent_size = 4 | ||
space_redirects = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
#compdef zap | ||
|
||
_arguments -C -s \ | ||
"(-)"{-h,--help}"[Show help information]" \ | ||
"(-)"{-v,--version}"[Show version information]" \ | ||
"(-)"{-u,--update}"[Update plugins]" \ | ||
"(-)"{-c,--clean}"[Remove unused plugins]" \ | ||
local -a subcmds=( | ||
"clean:Remove unused plugins" | ||
"help:Show help informations" | ||
"update:Update plugins" | ||
"version:Show version information" | ||
) | ||
_describe 'zap' subcmds |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env zsh | ||
|
||
main() { | ||
local ZAP_DIR="$HOME/.local/share/zap" | ||
local ZSHRC="${ZDOTDIR:-$HOME}/.zshrc" | ||
[[ $1 == "--branch" || $1 == "-b" && -n $2 ]] && local BRANCH="$2" | ||
|
||
# check if ZAP_DIR already exists | ||
[[ -d "$ZAP_DIR" ]] && { echo "Zap is already installed in '$ZAP_DIR'!" && read -q "res?Reinstall Zap? [y/N] "; echo "" } | ||
[[ "$res" == "y" ]] && { echo "Reinstalling Zap..." && rm -rf "$ZAP_DIR" } || return 0 | ||
|
||
git clone -b "${BRANCH:-master}" https://github.com/zap-zsh/zap.git "$ZAP_DIR" > /dev/null 2>&1 || { echo "❌ Failed to install Zap" && return 2 } | ||
mkdir -p "$ZAP_DIR/plugins" | ||
|
||
# @formatter:off | ||
if ! grep -q '[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh"' "$ZSHRC"; then | ||
sed -i.old '1 i\ | ||
[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh"' "$ZSHRC" | ||
fi | ||
# @formatter:on | ||
|
||
echo " Zapped" | ||
return 0 | ||
} | ||
|
||
main $@ | ||
|
||
# vim: ft=zsh ts=4 et |
Oops, something went wrong.