dotfiles/zsh/.zshrc

152 lines
4.4 KiB
Bash

## Start of .zshrc config
## User settings
# Editor
export EDITOR="nano"
export VISUAL="nano"
setopt prompt_subst
# =========================
# zinit - plugin manager
# =========================
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing Zinit…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# =========================
# OMZ core library
# =========================
zinit snippet OMZ::lib/completion.zsh
zinit snippet OMZ::lib/history.zsh
zinit snippet OMZ::lib/key-bindings.zsh
zinit snippet OMZ::lib/theme-and-appearance.zsh
zinit snippet OMZ::lib/functions.zsh
zinit snippet OMZ::lib/directories.zsh
zinit snippet OMZ::lib/git.zsh
zinit snippet OMZ::lib/spectrum.zsh
zinit snippet OMZ::lib/termsupport.zsh
# Pager (replaces OMZ lib/misc.zsh)
export PAGER="${PAGER:-less}"
export LESS="${LESS:--R}"
# =========================
# OMZ plugins (turbo)
# =========================
zinit ice wait lucid
zinit snippet OMZ::plugins/git/git.plugin.zsh
zinit ice wait lucid
zinit snippet OMZ::plugins/command-not-found/command-not-found.plugin.zsh
# =========================
# NVM with lazy loading
# =========================
export NVM_LAZY_LOAD=true
export NVM_AUTO_USE=true
zinit ice wait lucid
zinit light lukechilds/zsh-nvm
# =========================
# Completions (load after 1s)
# =========================
zinit ice wait"1" lucid
zinit light zsh-users/zsh-completions
# =========================
# Autosuggestions (after prompt)
# =========================
zinit ice wait"0a" lucid atload'_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
# =========================
# Syntax highlighting (load last)
# =========================
zinit ice wait"0a" lucid
zinit light zdharma-continuum/fast-syntax-highlighting
# =========================
# Starship prompt
# =========================
if (( $+commands[starship] )); then
eval "$(starship init zsh)"
fi
# =========================
# Aliases
# =========================
if [ -f ~/.zsh_aliases ]; then
. ~/.zsh_aliases
fi
# opencode
export PATH=/home/mikjoh/.opencode/bin:$PATH
# =========================
# Atuin - shell history
# =========================
. "$HOME/.atuin/bin/env"
eval "$(atuin init zsh)"
# =========================
# Zoxide - smarter cd
# =========================
if (( $+commands[zoxide] )); then
eval "$(zoxide init zsh)"
fi
# =========================
# fzf - fuzzy finder
# =========================
if (( $+commands[fzf] )); then
source <(fzf --zsh 2>/dev/null)
fi
# Use ripgrep for fzf file listing if available (faster, respects .gitignore)
if (( $+commands[rg] )); then
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
# =========================
# Theme / Gruvbox Dark Hard
# =========================
# Bat theme
export BAT_THEME="Gruvbox Dark"
# FZF colors (Gruvbox Dark Hard)
export FZF_DEFAULT_OPTS=" \
--color=bg+:#3c3836,bg:#1d2021,spinner:#fabd2f,hl:#fb4934 \
--color=fg:#ebdbb2,header:#fb4934,info:#d3869b,pointer:#fabd2f \
--color=marker:#fabd2f,fg+:#ebdbb2,prompt:#d3869b,hl+:#fb4934"
# fast-syntax-highlighting colors (Gruvbox Dark Hard)
typeset -gA FAST_HIGHLIGHT_STYLES
FAST_HIGHLIGHT_STYLES[default]=fg=#ebdbb2
FAST_HIGHLIGHT_STYLES[unknown-token]=fg=#fb4934
FAST_HIGHLIGHT_STYLES[reserved-word]=fg=#d3869b,bold
FAST_HIGHLIGHT_STYLES[alias]=fg=#83a598
FAST_HIGHLIGHT_STYLES[builtin]=fg=#83a598
FAST_HIGHLIGHT_STYLES[function]=fg=#83a598
FAST_HIGHLIGHT_STYLES[command]=fg=#83a598
FAST_HIGHLIGHT_STYLES[precommand]=fg=#83a598
FAST_HIGHLIGHT_STYLES[hashed-command]=fg=#83a598
FAST_HIGHLIGHT_STYLES[path]=fg=#b8bb26,underline
FAST_HIGHLIGHT_STYLES[path-to-dir]=fg=#b8bb26,underline
FAST_HIGHLIGHT_STYLES[single-hyphen-option]=fg=#fabd2f
FAST_HIGHLIGHT_STYLES[double-hyphen-option]=fg=#fabd2f
FAST_HIGHLIGHT_STYLES[single-quoted-argument]=fg=#fabd2f
FAST_HIGHLIGHT_STYLES[double-quoted-argument]=fg=#fabd2f
FAST_HIGHLIGHT_STYLES[back-quoted-argument]=fg=#fb4934
FAST_HIGHLIGHT_STYLES[assign]=fg=#ebdbb2
FAST_HIGHLIGHT_STYLES[globbing]=fg=#d3869b
FAST_HIGHLIGHT_STYLES[comment]=fg=#7c6f64
FAST_HIGHLIGHT_STYLES[redirection]=fg=#d3869b