{ config, lib, ... }:
with lib;
let cfg = config.voidconf.zsh;
in {
  options.voidconf.zsh = {
    enable = mkEnableOption "Enables opinionated zsh configuration";
    skim.enable = mkEnableOption "Enables skim support for shell history";
    highlightStyle = mkOption {
      type = types.str;
      default = "fg=magenta,bg=black,bold,underline";
      description = ''
        Colors for zsh autosuggestions. Check the documentation for more info.
        '';
    };
  };
  config = mkIf cfg.enable {
    programs = {
      skim.keybindings = cfg.skim.enable;
      zsh = {
        enable = true;
        enableCompletion = true;
        autosuggestions = {
          enable = true;
          highlightStyle = cfg.highlightStyle;
          async = true;
        };
        syntaxHighlighting = {
          enable = true;
        };
        shellAliases = {
          ls = "ls --color=tty";
          l = "ls -lah";
          la = "ls -a";
          lr = "ls -rt";
          llr = "ls -lhrt";
          llar = "ls -lhArt";
          grep = "grep --color=auto";
        };
      };
    };
  };
}