|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
|
|
|
symlink_dir=$(cd "$( dirname "`readlink -f ${(%):-%N}`" )" && pwd)
|
|
|
|
else
|
|
|
|
# OS X is not a fan of `readlink -f`
|
|
|
|
symlink_dir=$(cd "$( dirname "`readlink ${(%):-%N}`" )" && pwd)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Store private information (exports, keys, etc) in .bash_private.
|
|
|
|
if [[ -f $HOME/.bash_private ]]; then
|
|
|
|
source $HOME/.bash_private
|
|
|
|
echo ".bash_private loaded"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Or alternatively .private...
|
|
|
|
if [[ -f $HOME/.private ]]; then
|
|
|
|
source $HOME/.private
|
|
|
|
echo ".private loaded"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $HOME/.inputrc ]; then
|
|
|
|
source $HOME/.inputrc
|
|
|
|
else
|
|
|
|
echo "No .inputrc detected"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
if [ -f $HOME/.macrc ]; then
|
|
|
|
source $HOME/.macrc
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set up projects and gopath folder properly for the export in the export section.
|
|
|
|
|
|
|
|
if [[ ! -d $HOME/projects ]]; then
|
|
|
|
echo "Making $HOME/projects"
|
|
|
|
mkdir -p $HOME/projects
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -x go ]]; then
|
|
|
|
echo "Making $HOME/.go"
|
|
|
|
mkdir -p $HOME/.go
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Install zsh completion in ~/.zsh if it doesn't exist
|
|
|
|
if [[ ! -d $HOME/.zsh ]]; then
|
|
|
|
echo "Installing zsh git completion scripts"
|
|
|
|
mkdir -p $HOME/.zsh
|
|
|
|
pushd
|
|
|
|
|
|
|
|
cd $HOME/.zsh
|
|
|
|
|
|
|
|
curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
|
|
|
|
curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh
|
|
|
|
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Install zsh-syntax-highlighting if it doesn't exist
|
|
|
|
if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then
|
|
|
|
if ! is-at-least 4.3.11; then
|
|
|
|
echo "ZSH syntax highlighting requires ZSH >= 4.3.11 (current: $ZSH_VERSION)."
|
|
|
|
else
|
|
|
|
echo "Installing zsh syntax highlighting"
|
|
|
|
pushd
|
|
|
|
|
|
|
|
cd $HOME/.zsh
|
|
|
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
|
|
|
|
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
zstyle ':completion:*:*:git:*' script $HOME/.zsh/git-completion.bash
|
|
|
|
fpath=(~/.zsh $fpath)
|
|
|
|
|
|
|
|
autoload -Uz compinit && compinit
|
|
|
|
|
|
|
|
|
|
|
|
# Pull in other configurations
|
|
|
|
source $symlink_dir/aliases.zsh
|
|
|
|
source $symlink_dir/functions.zsh
|
|
|
|
source $symlink_dir/exports.zsh
|
|
|
|
source $symlink_dir/initializations.zsh
|
|
|
|
source $symlink_dir/ps1.zsh
|
|
|
|
|
|
|
|
# ZSH syntax highlighting must be sourced last
|
|
|
|
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|