@@ -33,4 +33,59 @@ return {
3333 -- stylua: ignore end
3434 },
3535 },
36+
37+ {
38+ {
39+ " CopilotC-Nvim/CopilotChat.nvim" ,
40+ dependencies = {
41+ { " nvim-lua/plenary.nvim" , branch = " master" },
42+ },
43+ build = " make tiktoken" ,
44+ opts = function ()
45+ local model = " claude-sonnet-4.5"
46+ return {
47+ prompts = {
48+ Concise = { prompt = " Please rewrite the following text to make it more concise." },
49+ Naming = { prompt = " Please provide better names for the following variables and functions." },
50+ Wording = { prompt = " Please improve the grammar and wording of the following text." },
51+ },
52+ model = model ,
53+ sticky = " buffer" ,
54+ auto_insert_mode = true , -- Enter insert mode when opening
55+ chat_autocomplete = true ,
56+ show_help = true ,
57+ }
58+ end ,
59+ keys = {
60+ { " <Leader>cc" , " <cmd>CopilotChatToggle<CR>" , desc = " Toggle [copilot chat]" , mode = { " n" , " v" } },
61+ { " <Leader>cf" , " <cmd>CopilotChatFix<cr>" , desc = " Fix Diagnostic [copilot chat]" , mode = { " n" , " v" } },
62+ { " <Leader>cp" , " <cmd>CopilotChatPrompts<CR>" , desc = " Prompt [copilot chat]" , mode = { " n" , " v" } },
63+ { " <Leader>cs" , " <cmd>CopilotChatStop<CR>" , desc = " Stop [copilot chat]" , mode = { " n" , " v" } },
64+ { " <Leader>cx" , " <cmd>CopilotChatReset<CR>" , desc = " Clear [copilot chat]" , mode = { " n" , " v" } },
65+ },
66+ config = function (_ , opts )
67+ local select = require (" CopilotChat.select" )
68+ require (" CopilotChat" ).setup (vim .tbl_extend (" force" , opts , {
69+ -- Use buffer selection, fallback visual
70+ selection = function (source ) return select .buffer (source ) or select .visual (source ) end ,
71+ }))
72+ end ,
73+ init = function ()
74+ local group = vim .api .nvim_create_augroup (" copilot_chat" , { clear = true })
75+ vim .api .nvim_create_autocmd (" BufEnter" , {
76+ group = group ,
77+ pattern = " copilot-chat" ,
78+ callback = function ()
79+ vim .opt_local .number = false
80+ vim .opt_local .relativenumber = false
81+ end ,
82+ })
83+ vim .api .nvim_create_autocmd (" VimLeavePre" , {
84+ group = group ,
85+ desc = " Close chat before closing editor" ,
86+ command = " CopilotChatClose" ,
87+ })
88+ end ,
89+ },
90+ },
3691}
0 commit comments