local on_attach = function(on_attach, name) return vim.api.nvim_create_autocmd('LspAttach', { callback = function(args) local buffer = args.buf ---@type number local client = vim.lsp.get_client_by_id(args.data.client_id) if client and (not name or client.name == name) then return on_attach(client, buffer) end end, }) end return { { 'zbirenbaum/copilot.lua', cmd = 'Copilot', -- new -- event = 'InsertEnter', build = ':Copilot auth', opts = { suggestion = { enabled = false }, panel = { enabled = false }, filetypes = { markdown = true, help = true, }, }, }, { 'zbirenbaum/copilot-cmp', dependencies = 'copilot.lua', opts = {}, config = function(_, opts) local copilot_cmp = require 'copilot_cmp' copilot_cmp.setup(opts) on_attach(function(client) copilot_cmp._on_insert_enter {} end, 'copilot') end, }, { 'olimorris/codecompanion.nvim', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter', 'hrsh7th/nvim-cmp', -- Optional: For using slash commands and variables in the chat buffer 'nvim-telescope/telescope.nvim', -- Optional: For using slash commands { 'stevearc/dressing.nvim', opts = {} }, -- Optional: Improves `vim.ui.select` }, config = true, }, }