feat: fix copilot completion

pull/546/head
Thomas Alcala Schneider 2 years ago
parent 4f2ff11da7
commit dfc3c98bf6
No known key found for this signature in database
GPG Key ID: 24BE5CF48622091B

@ -20,9 +20,12 @@ return {
-- nnoremap <silent> <leader>ct :CopilotToggle<CR>
-- ]]
-- vim.g.copilot_no_tab_map = true
vim.g.copilot_assume_mapped = true
vim.keymap.set('i', '<C-J>', 'copilot#Accept("<CR>")', { silent = true, expr = true })
-- vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', { silent = true, expr = true })
-- vim.keymap.set('i', '(vimrc:copilot-dummy-map)', 'copilot#Accept("<Tab>")', { silent = true, expr = true })
vim.g.copilot_no_tab_map = true
-- vim.keymap.set('i', '<Plug>(vimrc:copilot-dummy-map)', 'copilot#Accept("")', { silent = true, expr = true, desc = 'Copilot dummy accept' })
require('copilot').setup()
end,
}

@ -21,10 +21,35 @@ end
-- })
-- cmp.setup(config)
local cmp = require 'cmp'
-- Define additional mappings
-- local additional_mappings = {
-- ['<C-g>'] = cmp.mapping(function(fallback)
-- vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('<Tab>', true, true, true)), 'n', true)
-- end),
-- }
--
local additional_mappings = {
['<M-;>'] = cmp.mapping(function(fallback)
vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('<Tab>', true, true, true)), 'n', true)
end),
}
-- Merge the new mappings with the existing mappings
-- local merged_mappings = vim.tbl_extend('force', cmp.mapping, additional_mappings)
-- local merged_mappings = vim.tbl_extend('force', cmp.mapping, additional_mappings)
vim.list_extend(additional_mappings, cmp.mapping)
require('cmp').setup {
formatting = {
format = format_item,
},
mapping = additional_mappings,
-- mapping = additional_mappings,
experimental = {
ghost_text = false, -- this feature conflict with copilot.vim's preview.
},
}
return {}

Loading…
Cancel
Save