return {
  "neovim/nvim-lspconfig",
  dependencies = {
    "hrsh7th/cmp-nvim-lsp",
  },
  config = function()
    local capabilities = require('cmp_nvim_lsp').default_capabilities()

    -- 統一處理 LspAttach (當 LSP 連接到緩衝區時觸發)
    vim.api.nvim_create_autocmd('LspAttach', {
      group = vim.api.nvim_create_augroup('UserLspConfig', {}),
      callback = function(ev)
        local bufnr = ev.buf
        local client = vim.lsp.get_client_by_id(ev.data.client_id)

        -- 啟動 lsp_signature
        require('lsp_signature').on_attach({}, bufnr)

        -- 啟用 omnifunc
        vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'

        -- 按鍵對映優化
        local opts = { buffer = bufnr, noremap = true, silent = true }
        local map = vim.keymap.set

        map('n', '<leader>gd', vim.lsp.buf.definition, opts)
        map('n', '<leader>gt', '<cmd>tab split<CR><cmd>lua vim.lsp.buf.definition()<CR>', opts)
        map('n', '<leader>gv', '<cmd>vsplit<CR><cmd>lua vim.lsp.buf.definition()<CR>', opts)
        map('n', 'K', vim.lsp.buf.hover, opts)
        map('n', '<leader>gi', vim.lsp.buf.implementation, opts)
        map('n', '<C-k>', vim.lsp.buf.signature_help, opts)
        map('n', '<leader>D', vim.lsp.buf.type_definition, opts)
        map('n', '<leader>rn', vim.lsp.buf.rename, opts)
        map('n', '<leader>ca', vim.lsp.buf.code_action, opts)
        map('n', '<leader>gr', vim.lsp.buf.references, opts)
        map('n', '<leader>ge', vim.diagnostic.open_float, opts) -- 使用現代 API
        map('n', '<leader>do', vim.diagnostic.open_float, opts)
        map('n', '<leader>d[', vim.diagnostic.goto_prev, opts)
        map('n', '<leader>d]', vim.diagnostic.goto_next, opts)
        map('n', '<leader>gf', function() vim.lsp.buf.format { async = true } end, opts)
      end,
    })

    -- 伺服器列表
    local servers = {
      'gopls', 'ts_ls', 'rust_analyzer', 'bashls', 'svelte',
      'pylsp', 'zls', 'lua_ls', 'clangd', 'pyright'
    }

    -- 批量配置伺服器能力
    for _, lsp in ipairs(servers) do
      vim.lsp.config(lsp, {
        capabilities = capabilities,
      })
    end

    -- 批量啟用伺服器
    vim.lsp.enable(servers)
  end
}
