122 lines
3.1 KiB
Bash
122 lines
3.1 KiB
Bash
# autoload and kickoff
|
|
autoload -Uz colors vcs_info compinit
|
|
compinit
|
|
colors
|
|
|
|
# Make sure moving by whole word can stop at directories
|
|
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
|
|
ZSH_CACHE_DIR="$HOME/.cache/zsh"
|
|
|
|
# history support, time reporting, auto-cd
|
|
HISTFILE=~/.zhistory
|
|
HISTSIZE=5000
|
|
SAVEHIST=5000
|
|
setopt INC_APPEND_HISTORY
|
|
setopt EXTENDED_HISTORY
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
setopt HIST_IGNORE_SPACE
|
|
setopt AUTO_CD
|
|
setopt PROMPT_SUBST
|
|
|
|
SCRIPTPATH=$HOME/.config/dotfiles/zsh
|
|
|
|
# history substring search
|
|
if [[ -a "$SCRIPTPATH/zsh-history-substring-search/zsh-history-substring-search.zsh" ]]; then
|
|
source "$SCRIPTPATH/zsh-history-substring-search/zsh-history-substring-search.zsh"
|
|
bindkey '^[[A' history-substring-search-up
|
|
bindkey '^[[B' history-substring-search-down
|
|
fi
|
|
|
|
# extra autocompletions
|
|
if [[ -a "$SCRIPTPATH/zsh-completions/zsh-completions.plugin.zsh" ]]; then
|
|
fpath=($SCRIPTPATH/zsh-completions/src $fpath)
|
|
fi
|
|
|
|
# google cloud sdk
|
|
if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" ]]; then
|
|
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
|
|
fi
|
|
|
|
if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ]]; then
|
|
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
|
|
fi
|
|
|
|
# rust additions
|
|
if [[ -a "$HOME/.cargo/bin" ]]; then
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
fi
|
|
|
|
# krew additions
|
|
if [[ -a "$HOME/.krew" ]]; then
|
|
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
|
fi
|
|
|
|
# pythonpath additions
|
|
if [[ -a "$HOME/src/oreilly/tools/chassis" ]]; then
|
|
export PYTHONPATH="${PYTHONPATH}:$HOME/src/oreilly/tools/chassis"
|
|
fi
|
|
|
|
# Android SDK additions
|
|
if [[ -a "$HOME/Library/Android/sdk/platform-tools" ]]; then
|
|
export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH"
|
|
fi
|
|
|
|
if [[ -a "$HOME/Library/Android/sdk/emulator" ]]; then
|
|
export PATH="$HOME/Library/Android/sdk/emulator:$PATH"
|
|
fi
|
|
|
|
# Local bin additions
|
|
if [[ -d "$HOME/bin" ]]; then
|
|
export PATH="$HOME/bin:$PATH"
|
|
fi
|
|
|
|
# homebrew
|
|
if [[ -a "/opt/homebrew/bin/brew" ]]; then
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
fi
|
|
|
|
# starship
|
|
if [[ -x "$(command -v starship)" ]]; then
|
|
export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml"
|
|
eval "$(starship init zsh)"
|
|
fi
|
|
|
|
# asdf
|
|
if [[ -d "$HOME/.asdf/shims" ]]; then
|
|
export PATH="$HOME/.asdf/shims:$PATH"
|
|
fi
|
|
if [[ -d "$HOME/.asdf/completions" ]]; then
|
|
fpath=($HOME/.asdf/completions $fpath)
|
|
fi
|
|
|
|
# plugins
|
|
mkdir -p "$ZSH_CACHE_DIR"
|
|
source "$SCRIPTPATH/dotenv.zsh"
|
|
|
|
# env
|
|
export EDITOR=nvim
|
|
export GOPATH=~/src/golang
|
|
export GOBIN=$GOPATH/bin
|
|
export PATH=~/bin:$GOBIN:$PATH
|
|
export XDG_CONFIG_HOME=$HOME/.config
|
|
if [[ -d "/opt/homebrew/share/google-cloud-sdk/bin" ]]; then
|
|
export PATH=/opt/homebrew/share/google-cloud-sdk/bin:$PATH
|
|
fi
|
|
|
|
# other files
|
|
source "$SCRIPTPATH/functions.zsh"
|
|
source "$SCRIPTPATH/aliases.zsh"
|
|
|
|
# private aliases
|
|
if [[ -a "$SCRIPTPATH/private.zsh" ]]; then
|
|
source $SCRIPTPATH/private.zsh
|
|
fi
|
|
|
|
# What OS are we running?
|
|
if [[ $(uname) == "Darwin" ]]; then
|
|
source $SCRIPTPATH/mac.zsh
|
|
else
|
|
# Assume *nix of some kind
|
|
source $SCRIPTPATH/linux.zsh
|
|
fi
|