feat: fix copilot completion
This commit is contained in:
parent
4f2ff11da7
commit
dfc3c98bf6
|
@ -20,9 +20,12 @@ return {
|
||||||
-- nnoremap <silent> <leader>ct :CopilotToggle<CR>
|
-- nnoremap <silent> <leader>ct :CopilotToggle<CR>
|
||||||
-- ]]
|
-- ]]
|
||||||
|
|
||||||
-- vim.g.copilot_no_tab_map = true
|
-- vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', { silent = true, expr = true })
|
||||||
vim.g.copilot_assume_mapped = true
|
-- vim.keymap.set('i', '(vimrc:copilot-dummy-map)', 'copilot#Accept("<Tab>")', { silent = true, expr = true })
|
||||||
vim.keymap.set('i', '<C-J>', 'copilot#Accept("<CR>")', { 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()
|
require('copilot').setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,35 @@ end
|
||||||
-- })
|
-- })
|
||||||
-- cmp.setup(config)
|
-- 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 {
|
require('cmp').setup {
|
||||||
formatting = {
|
formatting = {
|
||||||
format = format_item,
|
format = format_item,
|
||||||
},
|
},
|
||||||
|
mapping = additional_mappings,
|
||||||
|
-- mapping = additional_mappings,
|
||||||
|
experimental = {
|
||||||
|
ghost_text = false, -- this feature conflict with copilot.vim's preview.
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
Loading…
Reference in New Issue