Giter Club home page Giter Club logo

Comments (2)

VonHeikemen avatar VonHeikemen commented on May 25, 2024 8

If I understood correctly the instructions:

  • First install the plugins. Here is the example with packer.
use {
  'zbirenbaum/copilot.lua',
  event = 'VimEnter',
  config = function()
    vim.defer_fn(function()
      require('copilot').setup()
    end, 100)
  end,
}

use {
  'zbirenbaum/copilot-cmp',
  after = {'copilot.lua'},
  config = function ()
    require('copilot_cmp').setup()
  end
}
  • Once copilot is started, run :Copilot auth to start the authentication process. (I assume this is a one time thing).

  • Next, add the source to nvim_cmp.

local cmp = require('cmp') 
local lsp = require('lsp-zero')
lsp.preset('recommended')

lsp.setup_nvim_cmp({
  sources = {
    -- This one provides the data from copilot.
    {name = 'copilot'},

    --- These are the default sources for lsp-zero
    {name = 'path'},
    {name = 'nvim_lsp', keyword_length = 3},
    {name = 'buffer', keyword_length = 3},
    {name = 'luasnip', keyword_length = 2},
  },
  mapping = lsp.defaults.cmp_mappings({
    ['<CR>'] = cmp.mapping.confirm({
      -- documentation says this is important.
      -- I don't know why.
      behavior = cmp.ConfirmBehavior.Replace,
      select = false,
    })
  })
})

lsp.setup()

The order of the sources determines the "priority" in the completion list. Most important go at the top. You can change the order any way you like.

from lsp-zero.nvim.

TechDufus avatar TechDufus commented on May 25, 2024

Wow! This is working now.... THANK YOU

from lsp-zero.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.