@@ -57,9 +57,51 @@ $ pip install -r requirements.txt
5757
5858## Usage
5959
60- ### Chat
60+ ### Configuration
6161
62- To chat with Copilot, follow these steps:
62+ You can customize the CopilotChat plugin using the following configuration options:
63+
64+ ``` lua
65+ {
66+ debug = false , -- Enable or disable debug mode
67+ prompts = { -- Set dynamic prompts for CopilotChat commands
68+ Explain = ' Explain how it works.' ,
69+ Tests = ' Briefly explain how the selected code works, then generate unit tests.' ,
70+ }
71+ }
72+ ```
73+
74+ You can extend the prompts to generate more flexible commands:
75+
76+ ``` lua
77+ return {
78+ " jellydn/CopilotChat.nvim" ,
79+ opts = {
80+ mode = " split" ,
81+ prompts = {
82+ Explain = " Explain how it works." ,
83+ Review = " Review the following code and provide concise suggestions." ,
84+ Tests = " Briefly explain how the selected code works, then generate unit tests." ,
85+ Refactor = " Refactor the code to improve clarity and readability." ,
86+ },
87+ },
88+ build = function ()
89+ vim .defer_fn (function ()
90+ vim .cmd (" UpdateRemotePlugins" )
91+ vim .notify (" CopilotChat - Updated remote plugins. Please restart Neovim." )
92+ end , 3000 )
93+ end ,
94+ event = " VeryLazy" ,
95+ keys = {
96+ { " <leader>cce" , " <cmd>CopilotChatExplain<cr>" , desc = " CopilotChat - Explain code" },
97+ { " <leader>cct" , " <cmd>CopilotChatTests<cr>" , desc = " CopilotChat - Generate tests" },
98+ { " <leader>ccr" , " <cmd>CopilotChatReview<cr>" , desc = " CopilotChat - Review code" },
99+ { " <leader>ccR" , " <cmd>CopilotChatRefactor<cr>" , desc = " CopilotChat - Refactor code" },
100+ }
101+ }
102+ ```
103+
104+ ### Chat with Github Copilot
63105
641061 . Copy some code into the unnamed register using the ` y ` command.
651072 . Run the command ` :CopilotChat ` followed by your question. For example, ` :CopilotChat What does this code do? `
@@ -68,17 +110,13 @@ To chat with Copilot, follow these steps:
68110
69111### Code Explanation
70112
71- To get an explanation of your code, follow these steps:
72-
731131 . Copy some code into the unnamed register using the ` y ` command.
741142 . Run the command ` :CopilotChatExplain ` .
75115
76116![ Explain Code Demo] ( https://i.gyazo.com/e5031f402536a1a9d6c82b2c38d469e3.gif )
77117
78118### Generate Tests
79119
80- To generate tests for your code, follow these steps:
81-
821201 . Copy some code into the unnamed register using the ` y ` command.
831212 . Run the command ` :CopilotChatTests ` .
84122
0 commit comments