#!/bin/bash

# Use neovim for vim if present
[ -x "$(command -v nvim)" ] && vimdiff="nvim -d"

# Vervosity and settings that you pretty much just always are going to wand
alias \
    bc="bc -ql" \
    cp="cp -vi" \
    df="df -h" \
    mkdir="mkdir -pv" \
    mv="mv -iv" \
    nsxiv="nsxiv -a" \
    img="oculante" \
    rm="rm -vI" \
    wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts" \
    keychain="keychain --dir $XDG_RUNTIME_DIR/keychain"

# Colorize commands when possible
alias \
    diff="diff --color=auto" \
    grep="rg --color=auto" \
    ip="ip -color=auto" \
    less="moor" \
    ls="eza -a --icons --group-directories-first"

# These common commands ate just too long! Abbreviate them
alias \
    battery="acpi" \
    code="vscodium" \
    day="redshift -PO 6500" \
    dv="doasedit" \
    e="$EDITOR" \
    fetch="fastfetch" \
    j="joshutoub" \
    lf="lfub" \
    lg="lazygit" \
    lock="swaylock" \
    lzd="lazydocker" \
    night="redshift -PO 4500" \
    py="python" \
    sv="rsv" \
    v="$EDITOR" \
    weather="curl wttr.in/" \
    wg-down="wg-quick down wg0" \
    wg-up="wg-quick up wg0" \
    ww="$EDITOR ~/neorg/" \
    yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config" \
    va="source .venv/bin/activate" \
    yy="yazi"

alias \
    gP="git push" \
    ga="git add" \
    gap="git add --patch" \
    gc="git commit" \
    gd="git diff --output-indicator-new=' ' --output-indicator-old=' '" \
    gds="git diff --staged" \
    gl="git log --all --graph --pretty=format:'%C(magenta)%h %C(white) %an  %ar%C(auto)  %D%n%s%n'" \
    gp="git pull" \
    gC="git clone" \
    gs="git status --short"

# doas not required for some system commands
for command in mount umount rsv sv pacman updatedb su shutdown poweroff reboot zzz systemctl wg wg-quick; do
    alias "$command=doas $command"
done
unset command
