Skip to content

Commit

Permalink
feat(nvim): add copilot-chat plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kutsan committed Sep 16, 2024
1 parent b7e2228 commit 312294d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .config/nvim/lua/specs/copilot-chat.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local Plugin = { 'CopilotC-Nvim/CopilotChat.nvim' }

Plugin.name = 'copilot-chat'

Plugin.opts = {
model = 'gpt-4o',
question_header = '# ',
answer_header = '# ',
error_header = '# ',
separator = ' ',
show_folds = false,
show_help = false,
window = {
layout = 'float',
width = 0.7,
height = 0.8,
},
mappings = {
complete = {
insert = '',
},
},
}

Plugin.config = function(_, opts)
local copilot = require('CopilotChat')
local copilot_select = require('CopilotChat.select')

copilot.setup(opts)

local keymap = vim.keymap

keymap.set({ 'n', 'x' }, '<Space>cn', function()
local input = vim.fn.input('Quick Chat: ')

if input ~= '' then
copilot.ask(input, { selection = copilot_select.buffer })
end
end)

keymap.set('n', '<Space>cf', vim.cmd.CopilotChatToggle)
end

return Plugin

0 comments on commit 312294d

Please sign in to comment.