88 lines
5.2 KiB
Bash
88 lines
5.2 KiB
Bash
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ ZSH Config │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Preoload stuff │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
# Set the directory we want to store zinit and plugins
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit"
|
|
|
|
# Auto install zinit
|
|
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
|
|
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
|
|
# Source/Load zinit, installation is handle by chezmoi external script
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
|
|
# source catppuccin theme for zsh-syntax-highlighting
|
|
zinit snippet "https://raw.githubusercontent.com/catppuccin/zsh-syntax-highlighting/main/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh"
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ ZSH plugins │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
# BUG: this makes it work funky on some terminals
|
|
# zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-completions
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
|
|
zinit ice pick"async.zsh" src"pure.zsh"
|
|
zinit light sindresorhus/pure
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Oh My Zsh snippets │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
zinit ice as"completion"
|
|
zinit snippet "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd"
|
|
|
|
zinit snippet OMZP::colored-man-pages
|
|
zinit snippet OMZP::systemd
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ History │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
HISTSIZE=5000
|
|
HISTFILE=~/.zsh_history
|
|
SAVEHIST=$HISTSIZE
|
|
HISTDUP=erase
|
|
setopt appendhistory
|
|
setopt sharehistory
|
|
setopt hist_ignore_space
|
|
setopt hist_ignore_all_dups
|
|
setopt hist_save_no_dups
|
|
setopt hist_ignore_dups
|
|
setopt hist_find_no_dups
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Source other files │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
# this prevents errors and not loading some files
|
|
for file in $HOME/.config/zsh/**/*.zsh; do
|
|
source $file
|
|
done
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Load completions │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
# Custom completions
|
|
fpath+=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions
|
|
autoload -Uz ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions/*
|
|
|
|
autoload -Uz complist
|
|
autoload -Uz compinit && compinit
|
|
zinit cdreplay -q
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Init external programs │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
# eval "$(zoxide init --cmd cd zsh)"
|
|
|
|
# Drop into fish
|
|
if [[ $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z ${BASH_EXECUTION_STRING} && ${SHLVL} == 1 ]]; then
|
|
# shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=''
|
|
exec fish $LOGIN_OPTION
|
|
fi
|