alias ga='git add .; git commit --no-edit --amend; git push --force-with-lease'
alias gae='git add .; git commit --amend; git push --force-with-lease'
alias less='less -R'
alias startx='xinit ~/.config/xinitrc -- /etc/X11/xinit/xserverrc :0 -ardelay 280 -arinterval 30'

if [[ $(command -v bat) ]]; then
  alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
fi

if [[ $(command -v exa) ]]; then
  alias ls='exa --git --octal-permissions --no-permissions --group-directories-first'
  alias ll='exa --git --octal-permissions --no-permissions --group-directories-first -l'
else
  case $(uname -s) in;
    Darwin) alias ls='ls -G';;
    Linux)  alias ls='ls --color';;
  esac
  alias ll='ls -l'
fi

if [[ $(command -v fd) ]]; then
  if [[ -f ~/.local/config/fd ]]; then
    alias fd='fd -H -L --ignore-file ~/.local/config/fd'
  else
    alias fd='fd -H -L'
  fi
fi

if [ $(command -v nvim) ]; then
  export EDITOR=nvim
  export MANPAGER="nvim +Man!"
  alias vim=nvim
  alias vimdiff="nvim -d"
elif [ $(command -v vim) ] ; then
  export EDITOR=vim
else
  export EDITOR=vi
fi

if [[ $(command -v rg) ]]; then
  alias grep='rg -i'
else
  alias grep='grep --color'
fi

function ud() {
  wd dots && git pull
  for i in $XDG_DATA_HOME/repos/zsh_modules/*; do sh -c "cd $i && git pull"; done
  nvim --headless -c "Lazy sync" -c "q"
  rm -rf ~/go
  cd
}
function upgrade() {
  case $(lsb_release -si) in
    Gentoo) eix-sync && eix-update && emerge -avuNDU @world ;;
    VoidLinux) xbps-install -Su && xbps-remove -RoO ;;
  esac
}
