{ config, pkgs, ... }:
{
  imports = [
    ./binds.nix
    ./settings.nix
  ];
  home = {
    sessionVariables.EDITOR = "hx";
    packages = [
      pkgs.wl-clipboard-rs
      pkgs.nil
      pkgs.vscode-langservers-extracted
      pkgs.nodePackages.typescript-language-server
      pkgs.emmet-language-server
      pkgs.jdt-language-server
      pkgs.tinymist
      pkgs.typstyle
    ];
  };
  programs.helix = {
    enable = true;
    defaultEditor = true;
    languages = {
      language-server = {
        "nu-builtin-lsp" = {
          command = "${pkgs.nushell}/bin/nu";
          args = [ "--lsp" ];
        };
        "discord-presence-lsp" = {
          command = "discord-presence-lsp";
          config = {
            application_id = "1376167046974279731";
            base_icons_url = "https://raw.githubusercontent.com/xhyrom/zed-discord-presence/main/assets/icons/";
            state = "Working on {filename}";
            details = "In {workspace}";
            large_image = "{language}";
            large_text = "{language:u}";
            small_image = "logo";
            small_text = "Helix";
            # idle = {
            #   timeout = 999999999999999999;
            #   action = "change_activity";
            #   state = "Idling";
            #   details = "In Helix";
            #   large_image = "logo";
            #   large_text = "Helix";
            #   small_image = "idle";
            #   small_text = "Idle";
            # };
            rules = {
              mode = "blacklist";
              paths = [ "absolute path" ];
            };
            git_integration = true;
          };
        };
        "rust-analyzer" = {
          config = {
            check.command = "check";
            completion.snippets.custom = {
              "pub fn" = {
                prefix = [
                  "pfn"
                  "pubfn"
                ];
                postfix = [ "pfn" ];
                body = [
                  "pub fn $\{receiver\}() {"
                  "\\t$1"
                  "}"
                ];
                scope = "type";
              };
            };
            completion.termSearch.enable = true;
            diagnostics.enable = true;
            inlayHints = {
              bindingModeHints.enable = true;
              closureCaptureHints.enable = true;
              closureReturnTypeHints.enable = true;
              discriminantHints.enable = true;
              expressionAdjustmentHints = {
                hideOutsideUnsafe = true;
              };
              lifetimeElisionHints.enable = "skip_trivial";
            };
            interpret.tests = true;
            lens = {
              references = {
                adt.enable = true;
                trait.enable = true;
              };
            };
            typing.autoClosingAngleBrackets.enable = true;
          };
        };
        "emmet-language-server" = {
          command = "emmet-language-server";
          args = [ "--stdio" ];
        };
        "psalm" = {
          command = "psalm";
          args = [ "--language-server" ];
        };
        "tinymist" = {
          config = {
            exportPdf = "onType";
            formatterMode = "typstyle";
          };
        };
      };
      language = [
        {
          name = "nu";
          language-servers = [
            "nu-builtin-lsp"
            "discord-presence-lsp"
          ];
        }
        {
          name = "php";
          language-servers = [ "psalm" ];
        }
        {
          name = "nix";
          # language-servers = [""]
          formatter = {
            command = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
            args = [ "--quiet" ];
          };
          auto-format = true;
        }
        {
          name = "rust";
          language-servers = [
            # "rust-analyzer"
            "discord-presence-lsp"
          ];
        }
        {
          name = "html";
          roots = [ ".git" ];
          language-servers = [
            "vscode-html-language-server"
            "emmet-language-server"
          ];
          auto-format = false;
        }
      ];
    };
  };
}
