Skip to content

Commit bb8540f

Browse files
committed
docs: simplify lazy loading instructions
1 parent 6ca9b4b commit bb8540f

1 file changed

Lines changed: 5 additions & 37 deletions

File tree

README.md

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,23 @@ use { "zbirenbaum/copilot.lua" }
2121

2222
### Authentication
2323

24-
Once copilot is started, run `:Copilot auth` to start the authentication process.
24+
Once copilot is running, run `:Copilot auth` to start the authentication process.
2525

2626
## Setup and Configuration
2727

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

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:
31+
Because the copilot server takes some time to start up, it is recommend that you lazy load copilot.
32+
For example:
3333

34-
1. On `VimEnter` event + defer (preferred method, works well with fast configs):
35-
```lua
36-
use {
37-
"zbirenbaum/copilot.lua",
38-
cmd = "Copilot",
39-
event = "VimEnter",
40-
config = function()
41-
vim.defer_fn(function()
42-
require("copilot").setup()
43-
end, 100)
44-
end,
45-
}
46-
```
47-
48-
2. Load after statusline + defer (if option 1 causes statusline to flicker, try this):
49-
```lua
50-
use {
51-
"zbirenbaum/copilot.lua",
52-
cmd = "Copilot",
53-
after = "feline.nvim", -- whichever statusline plugin you use here
54-
config = function ()
55-
vim.defer_fn(function()
56-
require("copilot").setup()
57-
end, 100)
58-
end,
59-
}
60-
```
61-
62-
3. On `InsertEnter` event (safest way to avoid startup lag):
63-
Note: suggestions may take a moment to start showing up.
6434
```lua
6535
use {
6636
"zbirenbaum/copilot.lua",
6737
cmd = "Copilot",
6838
event = "InsertEnter",
69-
config = function ()
70-
vim.schedule(function()
71-
require("copilot").setup()
72-
end)
39+
config = function()
40+
require("copilot").setup({})
7341
end,
7442
}
7543
```

0 commit comments

Comments
 (0)