# NO FUCKING BEEP
unsetopt BEEP

# Dark GTK for pwvucontrol
export GTK_THEME=Adwaita:dark

# Always run pywal (only on WSL)
if grep -qE "(Microsoft|WSL)" /proc/version &> /dev/null && [ -z "$TMUX" ]; then
    cat ~/.cache/wal/sequences
    clear
fi

# Hledger
export LEDGER_FILE=~/ExoKortex/2-Areas/Finances/finance_vault/tpouplier.hledger

# Emacs client
alias emacs="emacsclient -c -a emacs"

# Opencode
alias oc="opencode"

# Hermes Agent - SSH directly to remote server
alias hermes="ssh -t lazyworkhorse 'docker exec -it hermes /opt/hermes/.venv/bin/hermes'"

hermes-cp() { 
  if [ $# -eq 0 ]; then
    echo "Usage: hermes-cp <file_or_directory> [...]"
    echo ""
    echo "Copies files/directories from your Arch laptop into the Hermes"
    echo "agent container at /opt/data/home/ preserving directory structure."
    echo ""
    echo "Examples:"
    echo "  hermes-cp document.pdf              # single file"
    echo "  hermes-cp *.pdf                      # multiple files (glob)"
    echo "  hermes-cp manuals/                   # whole directory"
    echo "  hermes-cp manuals/ keyence-docs/     # multiple items"
    echo ""
    echo "To copy to a different destination inside the container:"
    echo "  tar -czf - . | ssh gortium@lazyworkhorse \\"
    echo "    \"docker exec -i hermes sh -c 'cd /opt/data/projects && tar -xzf -'\""
    return 1
  fi
  # tar everything into a single SSH pipe, extract inside container
  # Supports: single files, directories, glob patterns, mixed args
  tar -czf - "$@" | ssh gortium@lazyworkhorse \
    "docker exec -i hermes sh -c 'cd /opt/data/home && tar -xzf -'"
}

# Yazi
alias y="yazi"
function yy() {
    local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
    yazi "$@" --cwd-file="$tmp"
    if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
        cd -- "$cwd"
    fi
    rm -f -- "$tmp"
}

# Nvim
export LANG=en_CA.UTF-8
export LC_ALL=en_CA.UTF-8
export EDITOR="nvim"

# Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)

# Capitalization fixing in tab completion
autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

# Bat
alias cat=bat

# aichat
alias ai="aichat"
alias aido="aichat -e"
aitts() {
  paplay --raw --rate=22050 --format=s16le --channels=1 <(aichat "Answer only with speech. Your answer will be read outlound. No title, no bold or no special character. Only the short and direct answer. $*" | piper-tts --model en_US-amy-medium.onnx --output-raw)
}

# Tmux
alias t='tmux attach || tmux new'

# Docker
alias dco="docker compose"
alias dps="docker ps"
alias dpa="docker ps -a"
alias dl="docker ps -l -q"
alias dx="docker exec -it"

# Cd
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."

# Git
alias gc="git commit -m"
alias gca="git commit -a -m"
alias gp="git push origin HEAD"
alias gpu="git pull origin"
alias gst="git status"
alias glog="git log --graph --topo-order --pretty='%w(100,0,6)%C(yellow)%h%C(bold)%C(black)%d %C(cyan)%ar %C(green)%an%n%C(bold)%C(white)%s %N' --abbrev-commit"
alias gdiff="git diff"
alias gco="git checkout"
alias gb='git branch'
alias gba='git branch -a'
alias gadd='git add'
alias ga='git add -p'
alias gcoall='git checkout -- .'
alias gr='git remote'
alias gre='git reset'
alias gcl='git clone'

# Lazygit
alias lg="lazygit"

# NVIM
alias v="nvim"

# Eza
alias l="eza -l --icons --git -a"
alias lt="eza --tree --level=2  --icons --git"
alias ltree="eza --tree --level=2 --long --icons --git"

# Navigation
function cx() { cd "$@" && l; }
function fcd() { cd "$(find . -type d -not -path '' | fzf)" && l; }
#function f() { echo "$(find . -type f -not -path '*/.*' | fzf)" | pbcopy }
function fv() { nvim "$(find . -type f -not -path '*/.*' | fzf)" }

# Command history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

# Starship
eval "$(starship init zsh)"

# Zoxide
eval "$(zoxide init zsh)"

# Hyprshot
export HYPRSHOT_DIR="Images"

# Direnv
# eval "$(direnv hook zsh)"

# Atuin
#eval "$(atuin init zsh)"


# Created by `pipx` on 2026-03-03 16:51:31
export PATH="$PATH:/home/tpouplier/.local/bin"
