dotfiles/config/zsh/.zshrc

77 lines
2.0 KiB
Bash

# shellcheck disable=SC1091,SC1094,SC2206,SC2148
# macOS specific
if [[ $(uname -s) = "Darwin" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# prepare directories
touch "${HOME}/.hushlogin"
mkdir -p "${XDG_CACHE_HOME}/zsh"
mkdir -p "${XDG_DATA_HOME}/zsh"
# global exports and options
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY
setopt INC_APPEND_HISTORY
rm -rf "${ZDOTDIR}/.zsh_history" && ln -sf "${XDG_DATA_HOME}/zsh/history" "${ZDOTDIR}/.zsh_history"
# set path
path=(~/.local/bin "${path[@]}")
# source configuration
source "${ZDOTDIR}/aliases.zsh"
source "${ZDOTDIR}/cleanhome.zsh"
source "${ZDOTDIR}/keys.zsh"
## it has to be last
source "${ZDOTDIR}/fzf.zsh"
# source modules
source "${HOME}/.local/git/zsh_modules/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"
source "${HOME}/.local/git/zsh_modules/wd/wd.plugin.zsh"
export WD_CONFIG="${XDG_CONFIG_HOME}/wd_list"
# set fpath
fpath=(~/.local/git/zsh_modules/wd $fpath)
# theme and colors
if [[ $(command -v vivid) ]]; then
LS_COLORS=$(vivid generate molokai)
export LS_COLORS
else
unset LS_COLORS
fi
# if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then
# eval "$(oh-my-posh --config "${XDG_CONFIG_HOME}/omp/omp.toml" init zsh)"
# fi
source "${ZDOTDIR}/p10k.zsh"
source ~/.local/git/zsh_modules/powerlevel10k/powerlevel10k.zsh-theme
if [[ -r "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# completion
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors ''
autoload -Uz compinit
if [ ! -e "${XDG_DATA_HOME}/zsh/zcompdump.zwc" ]; then
autoload -Uz zrecompile
zrecompile -p -R "${XDG_DATA_HOME}/zsh/zcompdump"
fi
compinit -C -d "${XDG_DATA_HOME}/zsh/zcompdump"
# quick note functionality
if [[ -f "${HOME}/.note" ]]; then
echo
cat "${HOME}/.note"
echo
fi
# local settings
if [[ -f "${HOME}/.local/config/zsh" ]]; then
source "${HOME}/.local/config/zsh"
fi