From 4917cc23db69a7c0b59573998a52811276e1ddb9 Mon Sep 17 00:00:00 2001 From: ralvescosta Date: Sat, 19 Apr 2025 09:07:20 -0300 Subject: [PATCH] feat: toggle copilot --- lua/custom/plugins/copilot.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua index 88cb3b9a..fbab5ab9 100644 --- a/lua/custom/plugins/copilot.lua +++ b/lua/custom/plugins/copilot.lua @@ -1,5 +1,20 @@ return { { 'github/copilot.vim', + config = function() + vim.g.copilot_enabled = false + + vim.api.nvim_create_user_command('CopilotToggle', function() + if vim.g.copilot_enabled == 1 then + vim.g.copilot_enabled = 0 + print 'Copilot: OFF' + else + vim.g.copilot_enabled = 1 + print 'Copilot: ON' + end + end, {}) + + vim.keymap.set('n', 'tc', ':CopilotToggle', { desc = '[T]oggle [C]opilot', silent = true }) + end, }, }