vim.g.copilot_no_tab_map = true
vim.g.copilot_assume_mapped = true
vim.g.copilot_tab_fallback = ""
local cmp = require "cmp"
-- lvim.builtin.cmp.mapping["<C-e>"] = function(fallback)
-- cmp.mapping.abort()
-- local copilot_keys = vim.fn["copilot#Accept"]()
-- if copilot_keys ~= "" then
-- vim.api.nvim_feedkeys(copilot_keys, "i", true)
-- else
-- fallback()
-- end
-- end
lvim.builtin.cmp.mapping["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
local copilot_keys = vim.fn["copilot#Accept"]()
if copilot_keys ~= "" then
vim.api.nvim_feedkeys(copilot_keys, "i", true)
else
fallback()
end
end
end
默认安装copilot由于tab键冲突,会导致使用lunarvim不生效。这里需要修改下配置, 先禁用copilot插件里面的tab键映射。再起一个回调处理tab键