Files
dotfiles/base/zshrc

83 lines
2.4 KiB
Bash

# this is my zsh config. there are many like it, but this one is mine.
# shellcheck shell=bash
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] \
&& builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
# Defaults
export DOTFILES="$HOME/.dotfiles"
# shellcheck source=shared.sh
source "$DOTFILES/scripts/shared.sh"
export HISTFILE="$XDG_STATE_HOME"/zsh/history
autoload -U colors zsh/terminfo
colors
setopt correct
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
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
fi
# 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
[ -r "$file" ] && source "$file"
[ -r "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
done
}
x-load-configs
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
# Try to load antigen, if present
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/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
}
[ -f "${DOTFILES}/config/fzf/fzf.zsh" ] \
&& source "${DOTFILES}/config/fzf/fzf.zsh"
export LESSHISTFILE="$XDG_CACHE_HOME"/less_history
# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] \
&& builtin source "$HOME/.fig/shell/zshrc.post.zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
export P10K_LOCATION="$XDG_CONFIG_HOME/zsh/p10k.zsh"
[[ ! -f $P10K_LOCATION ]] || source $P10K_LOCATION