{
  enable = true;
  preConfig = ''
    vim.diagnostic.config({
      virtual_text = false,
      severity_sort = true,
      float = {
        border = 'rounded',
        source = 'always',
      },
    })

    vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
      vim.lsp.handlers.hover,
      {border = 'rounded'}
    )

    vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
      vim.lsp.handlers.signature_help,
      {border = 'rounded'}
    )
  '';

  servers = {
    sourcekit.enable = true;
    pyright.enable = true;
    html.enable = true;
    nil_ls.enable = true;
  };

  keymaps = {
    diagnostic = {
      "<leader>e" = "open_float";
      "[" = "goto_prev";
      "]" = "goto_next";
      "<leader>do" = "setloclist";
    };
    lspBuf = {
      "gD" = "declaration";
      "gd" = "definition";
      "<leader>k" = "hover";
      "gi" = "implementation";
      "<C-k>" = "signature_help";
      "<leader>wa" = "add_workspace_folder";
      "<leader>wr" = "remove_workspace_folder";
      "<leader>wl" = "list_workspace_folders";
      "<leader>D" = "type_definition";
      "<leader>rn" = "rename";
      "<leader>ca" = "code_action";
      "<leader>cf" = "format";
      "<leader>gr" = "references";
    };
  };

  postConfig = ''
    local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
    for type, icon in pairs(signs) do
      local hl = "DiagnosticSign" .. type
      vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
    end
  '';
}