{
  config,
  lib,
  pkgs,
  ...
}:
with lib; let
  cfg = config.local.apps.zed;
in {
  options.local.apps.zed.enable = mkEnableOption "zed editor settings";
  config = mkIf cfg.enable {
    programs.zed-editor = {
      enable = true;
      extensions = [
        "nix"
        "codebook"
        "vscode-dark-high-contrast"
        "catppuccin-icons"
      ];
      extraPackages = with pkgs; [
        nixd
      ];
      userSettings = {
        disable_ai = true;
        theme = {
          dark = "VSCode Dark High Contrast";
          light = "VSCode Dark High Contrast";
        };
        icon_theme = {
          dark = "Catppuccin Latte";
          light = "Catppuccin Latte";
        };
        file_icons = true;
        rulers = [80 120];
        preferred_line_length = 120;
        scroll_past_end = true;
        cursor = {
          blink_interval = 600;
          smooth_scroll = true;
        };
        autosave = "on_focus_change";
        auto_update = false;
        buffer_font_family = "JetBrains Mono";
        buffer_font_size = 22;
        hide_mouse = "never";
        minimap.show = "auto";
        tabs = {
          file_icons = true;
          git_status = true;
          activate_on_close = "neighbour";
          show_close_button = "always";
        };
        toolbar = {
          breadcrumbs = true;
          quick_actions = true;
          selections_menu = true;
          agent_review = false;
          code_actions = false;
        };
        format_on_save = "off";
        use_autoclose = false;
        git = {
          git_gutter = "tracked_files";
          inline_blame = {
            enabled = true;
            delay_ms = 5000;
          };
        };
        indent_guides = {
          enabled = true;
          line_width = 1;
          active_line_width = 1;
          coloring = "fixed";
          background_coloring = "disabled";
        };
        hour_format = "hour24";
        remove_trailing_whitespace_on_save = false;
        use_smartcase_search = true;
        soft_wrap = "editor_width";
        tab_size = 2;
        telemetry = {
          diagnostics = false;
          metrics = false;
        };
        auto_fold_dirs = false;
        scrollbar = {
          show = "always";
        };
        unnecessary_code_fade = 0.0;
      };
    };
  };
}
