# If you come from bash you might have to change your $PATH.
export GOPATH="$HOME/.go"
export PATH=$HOME/.bin:$HOME/var/bin:/usr/local/bin:$PATH:$HOME/.go/bin:$HOME/.local/bin
export GIT_CU_DIR="$HOME/src"
export ZSH="$HOME/.oh-my-zsh"
export GPG_TTY=$(tty)

export SSH_ASKPASS="$HOME/.local/bin/ssh-askpass-load-keys"
export SSH_ASKPASS_REQUIRE=""

# This is a hack to make poetry not hang
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
load_keys &>/dev/null

ZSH_THEME="robbyrussell"

plugins=(git z fzf asdf direnv emacs yarn aws)

source $ZSH/oh-my-zsh.sh

create_email() {
    curl -X POST --user colin@unbl.ink:$(pass personal/colin@unbl.ink | head -n 1) -d "address=$1@unbl.ink" -d "forwards_to=colin@unbl.ink" https://box.unbl.ink/admin/mail/aliases/add
}

eosup() {
    mv ~/.asdf ~/.asdf.bak
    yay -Ss
    yay -S --noconfirm archlinux-keyring endeavouros-keyring
    yay -Syu --noconfirm
    mv ~/.asdf.bak ~/.asdf
}

# quick way to fix clock drift in UTM VM
toggle_ntp() {
    timedatectl set-ntp "$(
        timedatectl show -p NTP --value | grep -qi '^yes$' && echo false || echo true
    )"
}
alias fixtime="toggle_ntp && toggle_ntp"

local hostname="%{$fg_bold[white]%}%m"

PROMPT="${hostname} ${PROMPT}"

## [Completion]
## Completion scripts setup. Remove the following line to uninstall
[[ -f /home/powellc/.dart-cli-completion/zsh-config.zsh ]] && . /home/powellc/.dart-cli-completion/zsh-config.zsh || true
## [/Completion]

export PATH="/home/powellc/.shorebird/bin:$PATH"
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

export TERM=xterm-256color

export EDITOR=vim
export VISUAL="$EDITOR"

# SSH_AUTH_SOCK - common locations for Linux and macOS
for sock in "$SSH_AUTH_SOCK" "$XDG_RUNTIME_DIR/ssh-agent.socket" "/run/user/1000/ssh-agent.socket"; do
    [[ -S "$sock" ]] && export SSH_AUTH_SOCK="$sock" && break
done

case "$(uname -s)" in
Linux)
    [[ -d "/home/linuxbrew/.linuxbrew/bin" ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
    ;;
Darwin)
    eval "$(/opt/homebrew/bin/brew shellenv)"
    ;;
esac
[[ -d "/home/linuxbrew/.linuxbrew/bin" ]] && export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH

eval "$(direnv hook /bin/zsh)"

. ${ASDF_DATA_DIR:-$HOME/.asdf}/plugins/golang/set-env.zsh &>/dev/null

# opencode
[[ -d "$HOME/.npm-global" ]] && export PATH="$HOME/.npm-global/bin":$PATH
[[ -d "$HOME/.local/opencode/bin" ]] && export PATH="$HOME/.local/opencode/bin":$PATH
[[ -d "$HOME/.opencode/bin" ]] && export PATH="$HOME/.opencode/bin":$PATH

# See ~/.aliases for the various aliases seen in here
source "$HOME/.aliases"

# Added by LM Studio CLI (lms)
export PATH="$PATH:/home/powellc/.lmstudio/bin"
# End of LM Studio CLI section

export OLLAMA_HOST=0.0.0.0
