Skip to content

Commit 9b7605d

Browse files
feat(plugins): add Copilot and CopilotChat configurations
This commit introduces configurations for GitHub Copilot and Copilot Chat plugins in the Neovim setup. It includes the setup of keybindings for toggling Copilot and various chat functionalities, enhancing the development experience through AI-assisted programming features.
1 parent 3e168bd commit 9b7605d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

lua/custom/plugins/init.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,41 @@ return {
144144
vim.cmd.colorscheme 'gruvbox-material'
145145
end,
146146
},
147+
{
148+
'github/copilot.vim',
149+
config = function()
150+
vim.cmd [[Copilot disable]]
151+
152+
-- Keybinding to toggle Copilot
153+
vim.keymap.set('n', '<leader>cp', function()
154+
vim.cmd [[Copilot toggle]]
155+
end, { noremap = true, silent = true, desc = 'Toggle Copilot' })
156+
end,
157+
},
158+
{
159+
'CopilotC-Nvim/CopilotChat.nvim',
160+
dependencies = {
161+
{ 'github/copilot.vim' }, -- or zbirenbaum/copilot.lua
162+
{ 'nvim-lua/plenary.nvim', branch = 'master' }, -- for curl, log and async functions
163+
},
164+
build = 'make tiktoken', -- Only on MacOS or Linux
165+
opts = {
166+
-- See Configuration section for options
167+
},
168+
config = function()
169+
local chat = require 'CopilotChat'
170+
chat.setup()
171+
vim.keymap.set({ 'n' }, '<leader>aa', chat.toggle, { desc = 'AI Toggle' })
172+
vim.keymap.set({ 'v' }, '<leader>aa', chat.open, { desc = 'AI Open' })
173+
vim.keymap.set({ 'n' }, '<leader>ax', chat.reset, { desc = 'AI Reset' })
174+
vim.keymap.set({ 'n' }, '<leader>as', chat.stop, { desc = 'AI Stop' })
175+
vim.keymap.set({ 'n' }, '<leader>am', chat.select_model, { desc = 'AI Model' })
176+
vim.keymap.set('n', '<leader>ar', ':CopilotChatFix<CR>', { desc = 'AI Fix' })
177+
178+
vim.keymap.set('n', '<leader>at', ':CopilotChatTests<CR>', { desc = 'AI Tests' })
179+
vim.keymap.set('n', '<leader>ad', ':CopilotChatDocs<CR>', { desc = 'AI Docs' })
180+
vim.keymap.set('n', '<leader>ar', ':CopilotChatReview<CR>', { desc = 'AI Review' })
181+
end,
182+
-- See Commands section for default commands if you want to lazy load on them
183+
},
147184
} -- end of return

0 commit comments

Comments
 (0)