# ~/.zshrc — managed by Guix Home (see home.scm)
# Interactive-only guard
case $- in
*i*) ;;
*) return ;;
esac
# =============================================================================
# History
# =============================================================================
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000
SAVEHIST=10000
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_ALL_DUPS # ~ HISTCONTROL=ignoredups
setopt HIST_IGNORE_SPACE # ~ HISTCONTROL=ignorespace
setopt HIST_REDUCE_BLANKS
setopt APPEND_HISTORY # ~ shopt -s histappend
setopt INC_APPEND_HISTORY
setopt share_history
setopt hist_verify
# vi mode
set -o vi
# Edit command in $EDITOR
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^O' edit-command-line
# =============================================================================
# Environment
# =============================================================================
export EDITOR="emacs"
export CLICOLOR=1
export TERMINAL="kitty"
# Go
export GOPATH="$HOME/.local/share/go"
export GOMODCACHE="$HOME/.local/share/go-mod-cache"
# bat
export BAT_THEME="ansi"
export BAT_THEME_DARK="ansi"
# gpg
export GPG_TTY="$(tty)"
# misc
export BULLETS_FEEDS="feeds.stevedylan.dev/feed.xml"
# pnpm
# export PNPM_HOME="$HOME/.local/share/pnpm"
# bun
export BUN_INSTALL="$HOME/.bun"
# Weather
export NWS_LAT="35.0274115"
export NWS_LON="-85.3183822"
# stops GTK apps relaunching the accessibility bridge
export NO_AT_BRIDGE=1
# fzf
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude ".git"'
export FZF_DEFAULT_OPTS='
--color=fg:8:bold,fg+:15,bg:-1,bg+:-1
--color=hl:10:bold,hl+:10:bold
--color=info:8,spinner:9,header:4
--color=prompt:2,pointer:9,marker:1
--color=border:7,label:15:bold,query:15
--border="rounded"
--border-label=""
--preview-window="border-rounded"
--prompt="> "
--marker=" "
--pointer="◆"
--separator=""
--scrollbar=""
--gutter=" "
--info=inline-right'
# =============================================================================
# PATH
# =============================================================================
# Guix manages the system/profile entries; these are for tools installed
# outside of Guix (cargo, bun, foundry, ...).
# path_add
: prepend if not already present and dir exists
path_add() {
case ":$PATH:" in
*":$1:"*) ;;
*) [ -d "$1" ] && PATH="$1:$PATH" ;;
esac
}
# path_add "$HOME/.cargo/bin"
path_add "$HOME/.local/share/go/bin"
path_add "$BUN_INSTALL/bin"
# path_add "$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin"
# path_add "$HOME/.foundry/bin"
path_add "$HOME/.local/share"
# path_add "$HOME/.local/share/solana/install/active_release/bin"
# path_add "$HOME/.local/share/fnm"
# path_add "$PNPM_HOME"
path_add "$HOME/.local/bin"
path_add "$HOME/.bun/bin/"
export PATH
# cargo
# [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# =============================================================================
# Aliases
# =============================================================================
alias ls='eza --icons=always'
alias ll='eza -l --icons=always'
alias la='eza -a --icons=always'
# alias lg='lazygit'
# alias nf='neofetch'
alias fl='fastfetch -c ~/.config/fastfetch/presets/examples/8.jsonc'
alias ff='fastfetch -c ~/.config/fastfetch/presets/examples/20.jsonc'
alias nvimrc='nvim ~/.config/nvim'
alias shitter='ssh itter'
# alias system='macchina'
# alias bonsai='cbonsai -li -t 0.4'
# alias lst='lstr --icons --color=always --size'
# alias timestamp='node -e "process.stdout.write(new Date().toISOString())"'
alias e='emacsclient -nw'
alias ghr='guix home reconfigure ~/guix-dotfiles/home.scm'
alias gsr='sudo guix system reconfigure ~/guix-dotfiles/config.scm'
# =============================================================================
# Functions
# =============================================================================
# UTC timestamp for blog frontmatter
blogdate() {
date -u +"%Y-%m-%dT%H:%M:%SZ"
}
# =============================================================================
# Completion
# =============================================================================
# Pick up completions shipped by packages in the Guix profiles
for dir in "$HOME/.guix-home/profile/share/zsh/site-functions" \
"$HOME/.guix-profile/share/zsh/site-functions"; do
[ -d "$dir" ] && fpath=("$dir" $fpath)
done
unset dir
# bun completions
# [ -s "$BUN_INSTALL/_bun" ] && fpath=("$BUN_INSTALL" $fpath)
autoload -Uz compinit
compinit
# =============================================================================
# Tooling init
# =============================================================================
command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init zsh)"
command -v starship >/dev/null 2>&1 && eval "$(starship init zsh)"
command -v fzf >/dev/null 2>&1 && eval "$(fzf --zsh)"
# zsh-autosuggestions and syntax highlighting (from the Guix Home profile).
# syntax-highlighting must be sourced last.
ZSH_PLUGINS="$HOME/.guix-home/profile/share/zsh/plugins"
[ -f "$ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh" ] &&
source "$ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh"
[ -f "$ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] &&
source "$ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
unset ZSH_PLUGINS