{
  pkgs,
  lib,
  ...
}: {
  programs.helix = {
    enable = true;
    settings = {
      editor = {
        line-number = "relative";
        mouse = false;
        cursorline = true;
        cursor-shape = {
          insert = "bar";
          normal = "block";
          select = "underline";
        };
        file-picker = {hidden = false;};
        statusline = {
          left = ["mode" "spinner"];
          center = ["file-name" "read-only-indicator" "file-modification-indicator"];
          right = [
            "version-control"
            "diagnostics"
            "selections"
            "register"
            "position"
            "position-percentage"
            "file-encoding"
            "file-line-ending"
            "file-type"
          ];
          separator = "|";
        };
        inline-diagnostics = {
          cursor-line = "hint";
          other-lines = "warning";
        };
        lsp = {
          display-messages = true;
          display-inlay-hints = true;
        };
        indent-guides = {render = true;};
        idle-timeout = 0;
        bufferline = "always";
        soft-wrap = {
          enable = true;
        };
      };
      keys = {
        insert = {
          "C-space" = "completion";
        };
      };
    };

    languages = {
      language-server = {
        rust-analyzer = {
          config = {
            checkOnSave.command = "clippy";
            cargo.features = "all";
            cargo.unsetTest = [];
          };
        };
        pyright = {
          command = "${pkgs.pyright}/bin/pyright-langserver";
          args = ["--stdio"];
          config = {};
        };
        nil.command = "${pkgs.nil}/bin/nil";
        bash-language-server = {
          command = "${pkgs.bash-language-server}/bin/bash-language-server";
          args = ["start"];
        };
      };

      language = [
        {
          name = "python";
          auto-format = true;
          language-servers = [{name = "pyright";}];
          formatter = {
            command = "/bin/sh";
            args = [
              "-c"
              "${pkgs.isort}/bin/isort - | ${pkgs.black}/bin/black -q -l 120 -C -"
            ];
          };
        }
        {
          name = "nix";
          auto-format = true;
          language-servers = [{name = "nil";}];
          formatter = {
            command = lib.getExe pkgs.nixfmt-rfc-style;
            args = ["-s"];
          };
        }
      ];
    };
  };
}
