Files
dotfiles/base/zshrc

72 lines
2.0 KiB
Bash
Executable File

# this is my zsh config. there are many like it, but this one is mine.
# shellcheck shell=bash
# Defaults
export DOTFILES="$HOME/.dotfiles"
# shellcheck source=scripts/shared.sh
source "$DOTFILES/scripts/shared.sh"
export COMPLETION_WAITING_DOTS=true
# Run x-load-configs in your terminal to reload the files.
function x-load-configs()
{
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
HOST="$(hostname -s)"
# global (exports|alias|functions) file for all hosts
# shellcheck source=../config/exports
[ -r "$file" ] && source "$file"
# global secret file, git ignored
# shellcheck source=../config/exports-secret
[ -r "$file-secret" ] && source "$file-secret"
# host specific (exports|alias|functions) file
# shellcheck source=../config/exports
[ -r "$file-$HOST" ] && source "$file-$HOST"
# host specific (exports|alias|functions) file, git ignored
# shellcheck source=../config/exports
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
}
x-load-configs
export HISTFILE="$XDG_STATE_HOME"/zsh/history
autoload -U colors zsh/terminfo
colors
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
# Add completion scripts to zsh path
FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
autoload -Uz compinit
if type brew &> /dev/null; then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
fi
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
# Try to load antigen, if present
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
# shellcheck source=../../.local/bin/antigen.zsh
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
# antigen is present
have antigen && {
antigen use oh-my-zsh
# config/functions
x-default-antigen-bundles
antigen apply
}
# shellcheck source=../config/fzf/fzf.zsh
[ -f "${DOTFILES}/config/fzf/fzf.zsh" ] \
&& source "${DOTFILES}/config/fzf/fzf.zsh"
# Start starship
eval "$(starship init zsh)"