Skip to content

Commit a6dc357

Browse files
committed
final 0.6 fix
1 parent f2b45fe commit a6dc357

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,21 @@ After the setup steps are complete for copilot.vim, ensure that ~/.config/github
2424

2525
You have to run the `require("copilot").setup(options)` function in order to start Copilot. If no options are provided, the defaults are used.
2626

27-
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:
28-
29-
1. On 'InsertEnter': (My preferred way)
27+
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:
3028

29+
1. On 'VimEnter' + Defer: (My preferred method, works well with fast configs)
3130
```
32-
use {
31+
use{
3332
"zbirenbaum/copilot.lua",
34-
event = "InsertEnter",
35-
config = function ()
36-
vim.schedule(function() require("copilot").setup() end)
33+
event = {"VimEnter"},
34+
config = function()
35+
vim.defer_fn(function()
36+
require("copilot").setup()
37+
end, 100)
3738
end,
38-
},
39+
}
3940
```
40-
41-
2. Load After Statusline + defer:
42-
41+
2. Load After Statusline + defer: (If option (1) causes statusline to flicker, try this)
4342
```
4443
["zbirenbaum/copilot.lua"] = {
4544
"zbirenbaum/copilot.lua",
@@ -49,6 +48,18 @@ use {
4948
end,
5049
},
5150
```
51+
3. On 'InsertEnter': (The safest way to avoid statup lag. Note: Your copilot completions may take a moment to start showing up)
52+
53+
```
54+
use {
55+
"zbirenbaum/copilot.lua",
56+
event = "InsertEnter",
57+
config = function ()
58+
vim.schedule(function() require("copilot").setup() end)
59+
end,
60+
},
61+
```
62+
5263

5364
#### Configuration
5465

lua/copilot/copilot_handler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ M.start = function(params)
2727
autostart = true,
2828
on_init = function(client, _)
2929
vim.lsp.buf_attach_client(0, client.id)
30-
if vim.fn.has("nvim-0.7") then
30+
if vim.fn.has("nvim-0.7") > 0 then
3131
vim.api.nvim_create_autocmd({ "BufEnter" }, {
3232
callback = function()
3333
util.attach_copilot()

0 commit comments

Comments
 (0)