copilot-cmp is making suggestions for empty lines, but when I try to accept them using tab I get the following error:
E5108: Error executing lua ....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:154: Vim:E5108: Error executing lua [string "v:lua"]:1: attempt to call global 'tab_complete' (a nil value)
stack traceback:
[string "v:lua"]:1: in main chunk
[C]: in function 'nvim_eval'
....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:154: in function 'solve'
....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:132>
....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:248: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:247>
stack traceback:
[C]: in function 'nvim_eval'
....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:154: in function 'solve'
....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:132>
....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:248: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:247>
cmp config is pretty much just from the docs:
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
end
return {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
completeopt = "menu,menuone,noinsert",
mapping = {
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}),
["<Tab>"] = vim.schedule_wrap(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = vim.schedule_wrap(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
else
fallback()
end
end, { "i", "s" }),
},
[...]
keymap("i", "<tab>", "v:lua.tab_complete()", {expr = true, noremap = true})
copilot-cmp is making suggestions for empty lines, but when I try to accept them using tab I get the following error:
cmp config is pretty much just from the docs: