
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=10000
setopt autocd extendedglob nomatch notify
unsetopt beep
bindkey -v

zstyle :compinstall filename '/home/poslop/.zshrc'

autoload -Uz compinit
compinit

alias gc='git commit'
alias gp='git push'
alias gs='git status'

ga() {
  if [[ -z "$1" ]]; then
    git add -u
  else
    git add "$1"
  fi
}

rerice() {
  local flake_dir="/etc/rice-flakes"
  local host="$(hostname -s)"
  local OPTIND=1

  while getopts ":h:" opt; do
    case $opt in
      h) host="$OPTARG" ;;
      :) echo "Option -$OPTARG requires an argument." >&2; return 1 ;;
      \?) echo "Unknown option: -$OPTARG" >&2; return 1 ;;
    esac
  done

  sudo nixos-rebuild switch --flake "${flake_dir}#${host}"
}
