diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 83de0aac..3d5536f2 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -144,4 +144,41 @@ return { vim.cmd.colorscheme 'gruvbox-material' end, }, + { + 'github/copilot.vim', + config = function() + vim.cmd [[Copilot disable]] + + -- Keybinding to toggle Copilot + vim.keymap.set('n', 'cp', function() + vim.cmd [[Copilot toggle]] + end, { noremap = true, silent = true, desc = 'Toggle Copilot' }) + end, + }, + { + 'CopilotC-Nvim/CopilotChat.nvim', + dependencies = { + { 'github/copilot.vim' }, -- or zbirenbaum/copilot.lua + { 'nvim-lua/plenary.nvim', branch = 'master' }, -- for curl, log and async functions + }, + build = 'make tiktoken', -- Only on MacOS or Linux + opts = { + -- See Configuration section for options + }, + config = function() + local chat = require 'CopilotChat' + chat.setup() + vim.keymap.set({ 'n' }, 'aa', chat.toggle, { desc = 'AI Toggle' }) + vim.keymap.set({ 'v' }, 'aa', chat.open, { desc = 'AI Open' }) + vim.keymap.set({ 'n' }, 'ax', chat.reset, { desc = 'AI Reset' }) + vim.keymap.set({ 'n' }, 'as', chat.stop, { desc = 'AI Stop' }) + vim.keymap.set({ 'n' }, 'am', chat.select_model, { desc = 'AI Model' }) + vim.keymap.set('n', 'ar', ':CopilotChatFix', { desc = 'AI Fix' }) + + vim.keymap.set('n', 'at', ':CopilotChatTests', { desc = 'AI Tests' }) + vim.keymap.set('n', 'ad', ':CopilotChatDocs', { desc = 'AI Docs' }) + vim.keymap.set('n', 'ar', ':CopilotChatReview', { desc = 'AI Review' }) + end, + -- See Commands section for default commands if you want to lazy load on them + }, } -- end of return