Make copilot work with cmp
This commit is contained in:
parent
eac04f8fca
commit
e6d978fc38
2 changed files with 30 additions and 2 deletions
5
init.lua
5
init.lua
|
@ -1,3 +1,6 @@
|
|||
local cmp = require('cmp')
|
||||
-- Never gonna give you up
|
||||
-- Never gonna
|
||||
-- AstroNvim Configuration Table
|
||||
-- All configuration changes should go inside of the table below
|
||||
|
||||
|
@ -271,7 +274,7 @@ local config = {
|
|||
-- ["<esc>"] = false,
|
||||
},
|
||||
i = {
|
||||
["<C-e>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
|
||||
-- ["<Tab>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
|
||||
}
|
||||
},
|
||||
|
||||
|
|
25
plugins/cmp.lua
Normal file
25
plugins/cmp.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local cmp = require "cmp"
|
||||
local luasnip = require "luasnip"
|
||||
return {
|
||||
preselect = cmp.PreselectMode.None,
|
||||
mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('<Tab>', true, true, true)), 'n',
|
||||
true)
|
||||
end)
|
||||
-- if luasnip.expandable() then
|
||||
-- luasnip.expand()
|
||||
-- elseif luasnip.expand_or_jumpable() then
|
||||
-- luasnip.expand_or_jump()
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, {
|
||||
-- "i",
|
||||
-- "s",
|
||||
-- }),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false -- this feature conflict with copilot.vim's preview.
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue