dotfiles/zsh/zshrc

60 lines
1.6 KiB
Bash

# autoload and kickoff
autoload -Uz colors vcs_info compinit
compinit
colors
# Make sure moving by whole word can stop at directories
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
# 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
if [[ -d $HOME/.config/dotfiles/zsh ]]; then
SCRIPTPATH=$HOME/.config/dotfiles/zsh
elif [[ -d $HOME/dotfiles/zsh ]]; then
SCRIPTPATH=$HOME/dotfiles/zsh
fi
source $SCRIPTPATH/zprofile
# Use emacs-style binds instead of vim
bindkey -e
# google cloud sdk
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
# 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
# starship
if [[ -x "$(command -v starship)" ]]; then
export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml"
eval "$(starship init zsh)"
else
source $SCRIPTPATH/zprompt
fi
# asdf
if [[ -d "$HOME/.asdf/completions" ]]; then
fpath=($HOME/.asdf/completions $fpath)
fi