Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970local function toggle_copilot() local disabled = require('copilot.client').is_disabled()
if disabled then require('copilot.command').enable() vim.notify('Copilot enabled', vim.log.levels.INFO, { title = 'Copilot' }) else require('copilot.command').disable()
-- Rebind <M-y> to <C-y>, so that auto-complete falls back to nvim-cmp vim.api.nvim_set_keymap('i', '<M-y>', '<C-y>', { silent = true })
vim.notify('Copilot disabled', vim.log.levels.INFO, { title = 'Copilot' }) endend
--- @type LazySpec | LazySpec[]return { { 'zbirenbaum/copilot.lua', cmd = 'Copilot', dependencies = { 'copilotlsp-nvim/copilot-lsp' }, event = { 'InsertEnter', 'VeryLazy' }, config = function() require('copilot').setup { suggestion = { enabled = true, auto_trigger = true, keymap = { accept = '<M-y>', -- You can add additional keymaps below if needed accept_word = false, accept_line = false, next = '<M-n>', prev = '<M-p>', dismiss = false, }, }, panel = { enabled = false }, filetypes = { ['*'] = true, }, }
-- Hide Copilot suggestions when the completion menu is open -- local cmp_ok, cmp = pcall(require, 'cmp') -- if cmp_ok then -- cmp.event:on('menu_opened', function() -- vim.b.copilot_suggestion_hidden = true -- end) -- -- cmp.event:on('menu_closed', function() -- vim.b.copilot_suggestion_hidden = false -- end) -- end end, keys = { { '<M-y>', desc = 'Accept Copilot suggestion', }, { '<leader>ec', toggle_copilot, desc = '[C]opilot', }, }, },}