86 lines
2.3 KiB
Bash
86 lines
2.3 KiB
Bash
# shellcheck disable=SC1091,SC1094,SC2206,SC2148
|
|
|
|
if [ $(uname -s) = "Darwin" ]; then
|
|
realhome=$(dscl . -read /Users/${USER} | grep Home | cut -d' ' -f2)
|
|
else
|
|
realhome=$(getent passwd ${USER} | cut -d: -f6)
|
|
fi
|
|
|
|
# quick note functionality
|
|
if [[ -f "${realhome}/.note" ]]; then
|
|
echo
|
|
cat "${realhome}/.note"
|
|
echo
|
|
fi
|
|
|
|
# instant prompt should stay on the top
|
|
if [[ -r "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
|
source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh"
|
|
fi
|
|
|
|
# macOS specific
|
|
if [[ $(uname -s) = "Darwin" ]]; then
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
fi
|
|
|
|
# prepare directories
|
|
mkdir -p "${XDG_CACHE_HOME}/zsh"
|
|
mkdir -p "${XDG_DATA_HOME}/zsh"
|
|
|
|
# history settings
|
|
export HISTFILE="${XDG_DATA_HOME}/zsh/history"
|
|
export HISTSIZE=10000
|
|
export SAVEHIST=$HISTSIZE
|
|
setopt extended_history
|
|
setopt hist_expire_dups_first
|
|
setopt hist_find_no_dups
|
|
setopt hist_ignore_all_dups
|
|
setopt hist_ignore_dups
|
|
setopt hist_ignore_space
|
|
setopt hist_reduce_blanks
|
|
setopt hist_save_no_dups
|
|
setopt inc_append_history
|
|
setopt share_history
|
|
setopt rmstarsilent
|
|
#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}/keys.zsh"
|
|
source "${ZDOTDIR}/fzf.zsh"
|
|
|
|
# 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
|
|
source "${realhome}/.local/git/zsh_modules/powerlevel10k/powerlevel10k.zsh-theme"
|
|
source "${ZDOTDIR}/p10k.zsh"
|
|
|
|
# completion
|
|
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"
|
|
|
|
zstyle ':completion:*' menu select
|
|
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
|
|
|
# source modules
|
|
source "${realhome}/.local/git/zsh_modules/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"
|
|
source "${realhome}/.local/git/zsh_modules/wd/wd.plugin.zsh"
|
|
source "${realhome}/.local/git/zsh_modules/diff-so-fancy/diff-so-fancy.plugin.zsh"
|
|
export WD_CONFIG="${XDG_CONFIG_HOME}/wd_list"
|
|
|
|
# cleaning
|
|
rm -rf "${realhome}/.warprc"
|