You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin is the pure lua replacement for https://github.com/github/copilot.vim
3
+
This plugin is the pure lua replacement for [github/copilot.vim](https://github.com/github/copilot.vim).
4
4
5
-
While using copilot.vim, for the first time since I started using neovim my laptop began to overheat. Additionally, I found the large chunks of ghost text moving around my code, and interfering with my existing cmp ghost text disturbing. As lua is far more efficient and makes things easier to integrate with modern plugins, this repository was created.
While using `copilot.vim`, for the first time since I started using neovim my laptop began to overheat. Additionally,
9
+
I found the large chunks of ghost text moving around my code, and interfering with my existing cmp ghost text disturbing.
10
+
As lua is far more efficient and makes things easier to integrate with modern plugins, this repository was created.
11
+
</details>
8
12
9
-
Note that this plugin will only start up the copilot server. The current usage of this is via https://github.com/zbirenbaum/copilot-cmp, which turns copilot suggestions into menu entries for cmp, and displays the full text body in a float, similar to how documentation would appear, off to the side.
13
+
## Install
10
14
11
-
On its own, this plugin will do nothing. You must either use https://github.com/zbirenbaum/copilot-cmp to make the server into a cmp source, or write your own plugin to interface with it, via the request and handler methods located in copilot.utils.lua
15
+
Install the plugin with your preferred plugin manager.
16
+
For example, with [packer.nvim](https://github.com/wbthomason/packer.nvim):
12
17
13
-
## Install
18
+
```lua
19
+
use { "zbirenbaum/copilot.lua" }
20
+
```
14
21
15
22
### Authentication
16
23
17
-
Once copilot is started, run `:CopilotAuth` to start the authentication process.
24
+
Once copilot is started, run `:Copilot auth` to start the authentication process.
18
25
19
-
###Setup
26
+
## Setup and Configuration
20
27
21
-
You have to run the `require("copilot").setup(options)` function in order to start Copilot. If no options are provided, the defaults are used.
28
+
You have to run the `require("copilot").setup(options)` function in order to start Copilot.
29
+
If no options are provided, the defaults are used.
22
30
23
-
Because the copilot server takes some time to start up, I HIGHLY recommend that you load copilot after startup. This can be done in multiple ways, the best one will depend on your existing config and the speed of your machine:
31
+
Because the copilot server takes some time to start up, It is recommend that you lazy load copilot.
32
+
This can be done in multiple ways, the best one will depend on your existing config and the speed of your machine:
24
33
25
-
1. On 'VimEnter' + Defer: (My preferred method, works well with fast configs)
34
+
1. On `VimEnter` event + defer (preferred method, works well with fast configs):
26
35
```lua
27
36
use {
28
37
"zbirenbaum/copilot.lua",
29
-
event={"VimEnter"},
38
+
event="VimEnter",
30
39
config=function()
31
40
vim.defer_fn(function()
32
41
require("copilot").setup()
33
42
end, 100)
34
43
end,
35
44
}
36
45
```
37
-
2. Load After Statusline + defer: (If option (1) causes statusline to flicker, try this)
46
+
47
+
2. Load after statusline + defer (if option 1 causes statusline to flicker, try this):
38
48
```lua
39
49
use {
40
50
"zbirenbaum/copilot.lua",
41
-
after='feline.nvim', --whichever statusline plugin you use here
51
+
after="feline.nvim", --whichever statusline plugin you use here
Use this field to provide the path to a specific node version such as one installed by nvm. Node version must be < 18. The LTS version of node (16.17.0) is recommended.
163
197
@@ -167,9 +201,9 @@ Example:
167
201
copilot_node_command=vim.fn.expand("$HOME") .."/.config/nvm/versions/node/v16.14.2/bin/node", -- Node version must be < 18
168
202
```
169
203
170
-
#####plugin_manager_path
204
+
### plugin_manager_path
171
205
172
-
This is installation path of Packer, change this to the plugin manager installation path of your choice
206
+
This is installation path of Packer, change this to the plugin manager installation path of your choice.
173
207
174
208
Example:
175
209
@@ -179,9 +213,11 @@ require("copilot").setup {
179
213
}
180
214
```
181
215
182
-
#####server_opts_overrides
216
+
### server_opts_overrides
183
217
184
-
Override copilot lsp client settings. The `settings` field is where you can set the values of the options defined in SettingsOpts.md. These options are specific to the copilot lsp and can be used to customize its behavior. Ensure that the name field is not overriden as is is used for efficiency reasons in numerous checks to verify copilot is actually running. See `:h vim.lsp.start_client` for list of options.
218
+
Override copilot lsp client settings. The `settings` field is where you can set the values of the options defined in [SettingsOpts.md](./SettingsOpts.md).
219
+
These options are specific to the copilot lsp and can be used to customize its behavior. Ensure that the name field is not overriden as is is used for
220
+
efficiency reasons in numerous checks to verify copilot is actually running. See `:h vim.lsp.start_client` for list of options.
185
221
186
222
Example:
187
223
@@ -196,5 +232,15 @@ require("copilot").setup {
196
232
}
197
233
},
198
234
}
199
-
},
235
+
}
200
236
```
237
+
238
+
## Commands
239
+
240
+
`copilot.lua` defines the `:Copilot` command that can perform various actions. It has completion support, so try it out.
241
+
242
+
## Integrations
243
+
244
+
The `copilot.api` module can be used to build integrations on top of `copilot.lua`.
245
+
246
+
-[zbirenbaum/copilot-cmp](https://github.com/zbirenbaum/copilot-cmp): Integration with [`nvim-cmp`](https://github.com/hrsh7th/nvim-cmp).
0 commit comments