3 # AX-ZSH: Alex' Modular ZSH Configuration
4 # Copyright (c) 2015 Alexander Barton <alex@barton.de>
7 # Include "ax-common.sh":
8 for dir in "$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr; do
9 [ -z "$ax_common_sourced" ] || break
10 ax_common="${dir}/lib/ax/ax-common.sh"
11 [ -r "$ax_common" ] && . "$ax_common"
13 if [ -z "$ax_common_sourced" ]; then
19 unset dir ax_common ax_common_sourced
22 if [ -f "$1" -a ! -L "$1" ]; then
23 rm -f "$1.bak" || exit 1
24 mv -v "$1" "$1.bak" || exit 1
31 [ -n "$AXZSH" ] || AXZSH="$HOME/.axzsh"
36 if [ "$S" = "$AXZSH" -o "$PWD" = "$AXZSH" ]; then
37 ax_msg 1 "Initializing \"$AXZSH\":"
39 ax_msg 1 "Install AX-ZSH into \"$AXZSH\":"
41 [ -L "$AXZSH" ] && rm -f "$AXZSH"
42 mkdir -p "$AXZSH" || exit 1
44 ax_msg - "Copying binaries and scripts ..."
45 cp -pRv "$S/ax.zsh"* "$AXZSH/" || exit 1
46 mkdir -p "$AXZSH/bin" || exit 1
47 cp -pRv "$S/bin/"* "$AXZSH/bin/" || exit 1
49 for f in AUTHORS LICENSE.md README.md; do
50 cp -pRv "$S/$f" "$AXZSH/" || exit 1
53 ax_msg - "Copying plugins ..."
54 for plugin_type in core default_plugins plugins; do
55 mkdir -p "$AXZSH/$plugin_type" || exit 1
56 for p in "$S/$plugin_type/"*; do
57 echo "$p -> $AXZSH/$p"
58 rm -fr "${AXZSH:?}/$p" || exit 1
59 cp -pR "$S/$p" "$AXZSH/$p" || exit 1
64 ax_msg - "Linking ZSH startup files ..."
66 for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do
67 safe_rm "$f" || exit 1
68 ln -sv "$AXZSH/ax.zsh" "$f" || exit 1
71 if [ ! -d "$AXZSH/active_plugins" ]; then
72 ax_msg - "Initializing plugin directory \"$AXZSH/active_plugins\" ..."
73 which zsh >/dev/null 2>&1
75 zsh "$AXZSH/bin/axzshctl" reset-plugins
78 ax_msg 2 "Oops, \"zsh\" not found!?"
82 ax_msg - "Plugin directory \"$AXZSH/active_plugins\" already exists. Ok."