#!/bin/sh

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

# Use $XINITRC variable if file exists.
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"

for command in mount umount apt dnf xbps-install pacman updatedb init systemctl service openrc-shutdown reboot ; do
	alias $command="doas $command"
done; unset command


if command -v doas > /dev/null
then
    alias \
        sudo="doas" \
        usod="doas" \
        suod="doas" \
        duso="doas" \
        osud="doas" \
        duso="doas" \
        daos="doas" \
        daso="doas" \
        ados="doas" \
        odas="doas";
else
    alias \
        doas="sudo" \
        usod="sudo" \
        suod="sudo" \
        duso="sudo" \
        osud="sudo" \
        duso="sudo" \
        daos="sudo" \
        daso="sudo" \
        ados="sudo" \
        odas="sudo";
fi

alias \
	sl="ls" \
	ls="ls -hN --color=auto" \
	la="ls -ahN --color=auto" \
	ll="ls -ahlN --color=auto"

alias \
	lsb="lsblk -a" \
	lsu="lsusb"

alias \
	:q="exit" \
	ZZ="exit" \
	ZQ="exit" \
	quit="exit"

alias \
	cp="cp -iv" \
	mk="mkdir -pv" \
	rm="rm -rI" \
	mv="mv -iv"

alias \
	rsync="rsync -rtvzP"

alias \
	t="tmux" \
	ta="tmux new -A -s" \
	v="$EDITOR" \
	e="$EDITOR" \
	z="zathura" \
	p="pacman" \
	syu="pacman -Syu" \
	ka="killall" \
	n="nnn"

alias \
	info="info --vi-keys" \
 	backup='doas rsync -aAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","swapfile","/var/lib/dhcpcd/*","/home/*/Media/*","/home/*/.cache/BraveSoftware/*","/home/*/.cache/thumbnails/*","/home/*/.cache/spotify/*","/home/*/Downloads/*","home/*/.cache/mozilla/*","/home/*/.config/BraveSoftware/*","/home/*/.config/Signal/*","/home/*/.config/spotify/*","/home/*/.config/libreoffice/*","/home/*/.config/GeoGebra/*","/home/*/.config/blender/*","/home/*/.local/share/torbrowser/*","/home/*/.mozilla/*"} / /home/pr073c70r/Media/USB0'

if [ -f "${HOME}/.config/extraalias" ]; then
    source "${HOME}/.config/extraaliasrc"
fi
