Closed Aur0nd closed 1 year ago
Q.1: How do you accept the suggestions? I see that in your default settings you're suggesting CR, which I think it's enter? - which doesn't do anything other than newline.
That's for Copilot Panel. Panel is opened by pressing <M-CR>
(i.e. Alt+Enter or Option+Enter).
For suggestion keymaps, check suggestion.keymap
config (it's commented out in your screenshot).
Q.2: :help copilot and a few other options are not working, is this intentional - is there a problem with my packages?
This plugin doesn't have any helpfile. Check the README.md file on this repo for all the info: https://github.com/zbirenbaum/copilot.lua/blob/master/README.md
Thank you @MunifTanjim ! What I cannot figure out is how the autocompletion works, if I type the resource halfway I can do tab and it will autocomplete (I think that's because of lsp) - I've seen youtube videos pulling this trick but no luck for me ^^
Okay, so here's a more complete guide:
Install zbirenbaum/copilot.lua
with your plugin manager of choice (vim-plug
or packer.nvim
or lazy.nvim
or something else).
Setup copilot.lua
.
require("copilot").setup({
panel = {
auto_refresh = false,
keymap = {
accept = "<CR>",
jump_prev = "[[",
jump_next = "]]",
refresh = "gr",
open = "<M-CR>",
},
},
suggestion = {
auto_trigger = true,
keymap = {
accept = "<M-l>",
prev = "<M-[>",
next = "<M-]>",
dismiss = "<C-]>",
},
},
})
Restart Neovim.
Run :Copilot auth
and complete the authentication process (if it's not done already).
Run :Copilot status
to make sure copilot is running and enabled.
Now open a file and start writing codes/comments. Copilot will autmatically show suggestions.
You can accept the suggestion by pressing the suggestion.keymap.accept
key (as set in Step 2). Or request the prev/next suggestion by pressing suggestion.keymap.prev
/suggestion.keymap.next
key (as set in Step 2).
Note: <M-l>
means Alt+l
(or Option+l
for Mac). If for some reason Alt+l
does not work on the terminal you're using, try using different keymap in Step 2.
If you want to use <Tab>
for accepting suggestion, check the code snippets in this comment: https://github.com/zbirenbaum/copilot.lua/issues/91#issuecomment-1345190310
Bless you @MunifTanjim that actually did the trick man. - Thank you so much!!!! Adding the keymap / Alt+ l works like a charm now.
Hi there,
I've been trying to figure out the very basics for hours and I've got a point where I'm not sure if I'm missing something or if there's a misconfig with my lunarvim setup.
I'm sure this is going to help a lot of newbies like myself looking for answers.
Q.1: How do you accept the suggestions? I see that in your default settings you're suggesting CR, which I think it's enter? - which doesn't do anything other than newline.
Q.2: :help copilot and a few other options are not working, is this intentional - is there a problem with my packages?