{ pkgs, theme, ... }:

{
  programs.zed-editor = {
    enable = true;
    package = pkgs.unstable.zed-editor;
    extensions = [
      "html"
      "catppuccin"
      "catppuccin-icons"
      "toml"
      "nix"
      "git-firefly"
      "just"
    ];
    userSettings =
      let
        font = "${theme.nerdFont} Nerd Font";
        fontSize = 14;
      in
      {
        assistant = {
          default_model = {
            provider = "ollama";
            model = "deepseek-r1:8b";
          };
          version = "2";
        };
        autosave = "on_focus_change";
        base_keymap = "JetBrains";
        buffer_font_family = font;
        features = {
          edit_completion_provider = "zed";
        };
        icon_theme = "Catppuccin Mocha";
        # icon_theme = { TODO replace icon theme above with below
        #   mode = theme.mode;
        #   light = "Catppuccin Mocha";
        #   dark = "Catppuccin Mocha";
        # };
        ui_font_family = font;
        ui_font_size = fontSize;
        buffer_font_size = fontSize;
        tabs = {
          file_icons = true;
          git_status = true;
        };
        theme = {
          mode = theme.mode;
          light = "Catppuccin Latte";
          dark = "Catppuccin Mocha";
        };
        lsp.nil.initialization_options.formatting.command = [ "nixfmt" ];
      };
  };
}
