Skip to content

How to do the very basics. #98

Closed
Closed

Description

@Aur0nd

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.
Screenshot_20221222_152719

Q.2:
:help copilot and a few other options are not working, is this intentional - is there a problem with my packages?

Activity

  1. MunifTanjim commented on Dec 22, 2022

    @MunifTanjim
    Collaborator

    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.
    Screenshot_20221222_152719

    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

  2. Aur0nd commented on Dec 22, 2022

    @Aur0nd
    Author

    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 ^^

    https://youtu.be/FL70Locz6oY?t=259

  3. MunifTanjim commented on Dec 22, 2022

    @MunifTanjim
    Collaborator

    Okay, so here's a more complete guide:

    1. Install zbirenbaum/copilot.lua with your plugin manager of choice (vim-plug or packer.nvim or lazy.nvim or something else).

    2. 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-]>",
        },
      },
    })
    1. Restart Neovim.

    2. Run :Copilot auth and complete the authentication process (if it's not done already).

    3. Run :Copilot status to make sure copilot is running and enabled.

    4. 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: #91 (comment)

  4. Aur0nd commented on Dec 23, 2022

    @Aur0nd
    Author

    Bless you @MunifTanjim that actually did the trick man. - Thank you so much!!!!
    Adding the keymap / Alt+ l works like a charm now.

  5. Repository owner locked and limited conversation to collaborators on Dec 23, 2022
  6. converted this issue into a discussion #99 on Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions