forked from CopilotC-Nvim/CopilotChat.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopilotChat.txt
More file actions
165 lines (119 loc) · 5.22 KB
/
Copy pathCopilotChat.txt
File metadata and controls
165 lines (119 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
*CopilotChat.txt* For NVIM v0.8.0 Last change: 2024 January 24
==============================================================================
Table of Contents *CopilotChat-table-of-contents*
1. Copilot Chat for Neovim |CopilotChat-copilot-chat-for-neovim|
- Authentication |CopilotChat-copilot-chat-for-neovim-authentication|
- Installation |CopilotChat-copilot-chat-for-neovim-installation|
- Usage |CopilotChat-copilot-chat-for-neovim-usage|
- Roadmap |CopilotChat-copilot-chat-for-neovim-roadmap|
==============================================================================
1. Copilot Chat for Neovim *CopilotChat-copilot-chat-for-neovim*
AUTHENTICATION *CopilotChat-copilot-chat-for-neovim-authentication*
It will prompt you with instructions on your first start. If you already have
`Copilot.vim` or `Copilot.lua`, it will work automatically.
INSTALLATION *CopilotChat-copilot-chat-for-neovim-installation*
LAZY.NVIM ~
1. `pip install python-dotenv requests pynvim==0.5.0 prompt-toolkit`
2. Put it in your lazy setup
>lua
return {
{
"jellydn/CopilotChat.nvim",
opts = {
mode = "split", -- newbuffer or split , default: newbuffer
},
build = function()
vim.defer_fn(function()
vim.cmd("UpdateRemotePlugins")
vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.")
end, 3000)
end,
event = "VeryLazy",
keys = {
{ "<leader>cce", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" },
{ "<leader>cct", "<cmd>CopilotChatTests<cr>", desc = "CopilotChat - Generate tests" },
},
},
}
<
1. Run `:UpdateRemotePlugins`
2. Restart `neovim`
MANUAL ~
1. Put the files in the right place
>
$ git clone https://github.com/gptlang/CopilotChat.nvim
$ cd CopilotChat.nvim
$ cp -r --backup=nil rplugin ~/.config/nvim/
<
1. Install dependencies
>
$ pip install -r requirements.txt
<
1. Open up Neovim and run `:UpdateRemotePlugins`
2. Restart Neovim
USAGE *CopilotChat-copilot-chat-for-neovim-usage*
CONFIGURATION ~
You have the ability to tailor this plugin to your specific needs using the
configuration options outlined below:
>lua
{
debug = false, -- Enable or disable debug mode
prompts = { -- Set dynamic prompts for CopilotChat commands
Explain = 'Explain how it works.',
Tests = 'Briefly explain how the selected code works, then generate unit tests.',
}
}
<
You have the capability to expand the prompts to create more versatile
commands:
>lua
return {
"jellydn/CopilotChat.nvim",
opts = {
mode = "split",
prompts = {
Explain = "Explain how it works.",
Review = "Review the following code and provide concise suggestions.",
Tests = "Briefly explain how the selected code works, then generate unit tests.",
Refactor = "Refactor the code to improve clarity and readability.",
},
},
build = function()
vim.defer_fn(function()
vim.cmd("UpdateRemotePlugins")
vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.")
end, 3000)
end,
event = "VeryLazy",
keys = {
{ "<leader>cce", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" },
{ "<leader>cct", "<cmd>CopilotChatTests<cr>", desc = "CopilotChat - Generate tests" },
{ "<leader>ccr", "<cmd>CopilotChatReview<cr>", desc = "CopilotChat - Review code" },
{ "<leader>ccR", "<cmd>CopilotChatRefactor<cr>", desc = "CopilotChat - Refactor code" },
}
}
<
For further reference, you can view my configuration
<https://github.com/jellydn/lazy-nvim-ide/blob/main/lua/plugins/extras/copilot-chat.lua>.
CHAT WITH GITHUB COPILOT ~
1. Copy some code into the unnamed register using the `y` command.
2. Run the command `:CopilotChat` followed by your question. For example, `:CopilotChat What does this code do?`
CODE EXPLANATION ~
1. Copy some code into the unnamed register using the `y` command.
2. Run the command `:CopilotChatExplain`.
GENERATE TESTS ~
1. Copy some code into the unnamed register using the `y` command.
2. Run the command `:CopilotChatTests`.
<https://gyazo.com/f285467d4b8d8f8fd36aa777305312ae>
ROADMAP *CopilotChat-copilot-chat-for-neovim-roadmap*
- Translation to pure Lua
- Tokenizer
- Use vector encodings to automatically select code
- Sub commands - See issue #5 <https://github.com/gptlang/CopilotChat.nvim/issues/5>
==============================================================================
2. Links *CopilotChat-links*
1. *Chat Demo*: https://i.gyazo.com/10fbd1543380d15551791c1a6dcbcd46.gif
2. *Explain Code Demo*: https://i.gyazo.com/e5031f402536a1a9d6c82b2c38d469e3.gif
3. *Generate tests*: https://i.gyazo.com/f285467d4b8d8f8fd36aa777305312ae.gif
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl: