Skip to content

Commit

Permalink
feat: add github copilot support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreytse committed Jul 26, 2024
1 parent 50b363c commit 2208c2f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Plugin copilot-chat settings.

require("CopilotChat").setup {
debug = true, -- Enable debugging
-- See Configuration section for rest
window = {
layout = 'vertical', -- 'vertical', 'horizontal', 'float', 'replace'
width = 0.4, -- fractional width of parent, or absolute width in columns when > 1
height = 0.5, -- fractional height of parent, or absolute height in rows when > 1
},
mappings = {
-- Fix a conflict between CopilotChat and how it takes control of the <TAB>
-- key from coc.nvim & cmp-nvim.
complete = {
detail = 'Use @<Tab> or /<Tab> for options.',
insert = '<C-Tab>',
}
}
}
20 changes: 20 additions & 0 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ Plug 'honza/vim-snippets'
Plug 'tpope/vim-repeat'
Plug 'machakann/vim-sandwich'

"-- Copilot ---
Plug 'github/copilot.vim'
Plug 'zbirenbaum/copilot.lua'
Plug 'nvim-lua/plenary.nvim'
Plug 'CopilotC-Nvim/CopilotChat.nvim', { 'branch': 'canary' }

" --- Markdown / Writting ---
Plug 'iamcco/markdown-preview.nvim', {'do': 'cd app && yarn install'}
Plug 'dhruvasagar/vim-table-mode'
Expand Down Expand Up @@ -636,6 +642,20 @@ nmap <silent> <leader>tv :TestVisit<CR>
let g:leetcode_browser = 'chrome'
let g:leetcode_solution_filetype = 'python3'

" Plugin copilot-chat settings.
nmap <silent> <leader><leader>p :CopilotChatToggle<CR>
nmap <silent> <leader><leader>x :CopilotChatClose<CR>
nmap <silent> <leader><leader>s :CopilotChatStop<CR>
nmap <silent> <leader><leader>r :CopilotChatReset<CR>
nmap <silent> <leader><leader>f :CopilotChatFix<CR>
nmap <silent> <leader><leader>F :CopilotChatFixDiagnostic<CR>
nmap <silent> <leader><leader>e :CopilotChatExplain<CR>
nmap <silent> <leader><leader>v :CopilotChatReview<CR>
nmap <silent> <leader><leader>o :CopilotChatOptimize<CR>
nmap <silent> <leader><leader>c :CopilotChatCommit<CR>
nmap <silent> <leader><leader>d :CopilotChatDocs<CR>
nmap <silent> <leader><leader>t :CopilotChatTests<CR>
" syntax highlight
syntax enable

Expand Down

0 comments on commit 2208c2f

Please sign in to comment.