-- nvimcmp.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
"hrsh7th/nvim-cmp",
event = { "InsertEnter" },
enabled = true,
dependencies = {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-emoji",
},
config = function()
local luasnip = require "luasnip"
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
local cmp = require "cmp"
local select = { behavior = cmp.SelectBehavior.Select }
local mapping = {
["<C-n>"] = cmp.select_next_item(select),
["<C-p>"] = cmp.select_prev_item(select),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = false }),
["<C-Space>"] = cmp.mapping.complete(),
}
cmp.setup({
completion = {
completeopt = "menu,menuone,noinsert,noselect",
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = mapping,
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "emoji" },
},
})
end
})
Description
I currently in middle of nuke and reconfig my neovim migrate from packer to lazy. then setup nvim-cmp first time is no error as expected, but after config further and restart go in command line or insert mode I got this error.
E5108: Error executing lua /home/kia/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:143: bad argument #1 to 'pairs' (table expect
ed, got boolean)
stack traceback:
[C]: in function 'pairs'
/home/kia/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:143: in function 'prepare'
/home/kia/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:328: in function </home/kia/.local/share/nvim/lazy/nvim-cmp/lua/
cmp/init.lua:324>
...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/utils/feedkeys.lua:47: in function <...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/utils
/feedkeys.lua:45>
Steps to reproduce
make minimal config form my plugin module nvimcmp.lua
open with nvim -u nvimcmp.lua
enter insert or command mode
got error
Expected behavior
no error. running normal as 2 hour ago.
Actual behavior
E5108: Error executing lua /home/kia/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:143: bad argument #1 to 'pairs' (table expect
ed, got boolean)
stack traceback:
[C]: in function 'pairs'
/home/kia/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:143: in function 'prepare'
/home/kia/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:328: in function </home/kia/.local/share/nvim/lazy/nvim-cmp/lua/
cmp/init.lua:324>
...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/utils/feedkeys.lua:47: in function <...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/utils
/feedkeys.lua:45>
I have Nuke my neovim and it fix now. for what make it happened I'm not sure but I think it maybe name collusion or something like that I can't find what collide with so I just wipe it all.
FAQ
Announcement
Minimal reproducible full config
Description
I currently in middle of nuke and reconfig my neovim migrate from packer to lazy. then setup nvim-cmp first time is no error as expected, but after config further and restart go in command line or insert mode I got this error.
Steps to reproduce
nvimcmp.lua
nvim -u nvimcmp.lua
Expected behavior
no error. running normal as 2 hour ago.
Actual behavior
Additional context
NVIM v0.10.0-dev-1295+g1f864139b
I have try nuke my config and it still happen.