return {
  { -- Autocompletion
    "hrsh7th/nvim-cmp",
    event = "InsertEnter",
    dependencies = {
      -- Snippet Engine & su integración con nvim-cmp
      { "L3MON4D3/LuaSnip" },
      "saadparwaiz1/cmp_luasnip",

      -- Soporte para LSP, rutas y buffers
      "hrsh7th/cmp-nvim-lsp",
      "hrsh7th/cmp-path",
      "hrsh7th/cmp-buffer",

      -- Copilot
      {
        "zbirenbaum/copilot-cmp",
        after = { "copilot.lua" },
      },
    },

    config = function()
      local cmp = require("cmp")
      local luasnip = require("luasnip")
      luasnip.config.setup({})

      -- Mapeos para moverse en los snippets
      vim.keymap.set({ "i", "s" }, "<C-k>", function()
        if luasnip.expand_or_jumpable() then
          luasnip.expand_or_jump()
        end
      end, { silent = true })

      cmp.setup({
        snippet = {
          expand = function(args)
            luasnip.lsp_expand(args.body)
          end,
        },
        completion = { completeopt = "menu,menuone,noinsert" },

        mapping = cmp.mapping.preset.insert({
          ["<C-n>"] = cmp.mapping.select_next_item(),
          ["<C-p>"] = cmp.mapping.select_prev_item(),
          ["<C-y>"] = cmp.mapping.confirm({ select = true }),
          ["<C-Space>"] = cmp.mapping.complete(),
        }),

        sources = cmp.config.sources({
          { name = "copilot",  group_index = 1 }, -- Prioridad 1
          { name = "nvim_lsp", group_index = 2 }, -- Prioridad 2
          { name = "luasnip",  group_index = 3 }, -- Prioridad 3
          { name = "buffer",   group_index = 4 }, -- Prioridad 4
          { name = "path",     group_index = 5 }, -- Prioridad 5
        }),

        formatting = {
          format = function(entry, vim_item)
            local icons = {
              copilot = " [Copilot]",
              nvim_lsp = " [LSP]",
              luasnip = " [Snippet]",
              buffer = " [Buffer]",
              path = " [Path]",
            }
            vim_item.kind = icons[entry.source.name] or vim_item.kind
            return vim_item
          end,
        },
      })
    end,
  },

  -- Copilot.lua (Para integrar Copilot con nvim-cmp)
  {
    "zbirenbaum/copilot.lua",
    cmd = "Copilot",
    event = "InsertEnter",
    config = function()
      require("copilot").setup({
        suggestion = { enabled = false }, -- Usa `nvim-cmp` en lugar de la ventana flotante de Copilot
        panel = { enabled = false },
      })
    end,
  },

  -- Soporte para autocompletado de rutas
  {
    "hrsh7th/cmp-path",
    event = "InsertEnter",
  },
}
