hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
8.15k stars 406 forks source link

`call v:lua.cmp.utils.feedkeys.call.run(2)` is inserted if the plugin is lazy-loaded with other plugins by dein.vim #1619

Open hexium310 opened 1 year ago

hexium310 commented 1 year ago

FAQ

Announcement

Minimal reproducible full config

local dein_dir = vim.fn.expand('~/.cache/dein')
local dein_core = vim.fs.joinpath(dein_dir, 'repos/github.com/Shougo/dein.vim')

if vim.fn.isdirectory(dein_core) == 0 then
  vim.system({ 'git', 'clone', 'https://github.com/Shougo/dein.vim', dein_core }):wait()
end

vim.opt.runtimepath:append(dein_core)

local dein = require('dein')

dein.begin(dein_dir)

dein.add('hrsh7th/nvim-cmp', {
  on_event = {
    'InsertEnter',
  },
  hook_post_source = function ()
    require('cmp').setup({})
  end,
})
dein.add('tversteeg/registers.nvim', {
  on_map = {
    nv = '"',
    i = '<C-r>'
  },
  hook_post_source = function ()
    require('registers').setup({})
  end
})
dein.add('hrsh7th/cmp-buffer', {
  on_source = {
    'nvim-cmp',
  },
})
-- dein.add('hrsh7th/cmp-path', {
--   on_source = {
--     'nvim-cmp',
--   },
-- })

if dein.check_install() then
  dein.install()
end

dein.end_()

Description

I make registers.nvim load (and then its window opens) when pressing <C-r> in insert mode. When pressing <C-r>, call v:lua.cmp.utils.feedkeys.call.run(2) is inserted into a current buffer but the window isn't open. The plugin is loaded.

This issue doesn't appear using registers.nvim and nvim-cmp only. I checked to see which plugins affect this issue, it seems to be caused by using cmp-buffer or cmp-path together. In addition according to git bisect, it seems that this issue has appeared since e55033f`.

Plugins: Shougo/dein.vim tversteeg/registers.nvim

Steps to reproduce

  1. Open nvim with minimal config
  2. Start insert mode
  3. Press <C-r>

Expected behavior

Theregisteres.nvim window opens.

Actual behavior

all v:lua.cmp.utils.feedkeys.call.run(2) is inserted into a current buffer and theregisteres.nvim window doesn't open (I don't know why it is call in the config I usually use but all in the minimal config).

Additional context

Lazy-loading when entering insert mode (InsertEnter) instead of pressing <C-r> stops this issue from appearing.

aichingm commented 1 year ago

I have a similar issue I get mp.utils.feedkeys.call.run(...) inserted when scrolling the mouse wheel in insert mode on an empty buffer. With vim.o.mouse = 'nv'

Going back to a9c701fa7e12e9257b3162000e5288a75d280c28 fixes the issue, going to e55033f makes it reappear.

koct9i commented 10 months ago

I have similar issue with nvim-cmp while jumping through loclist in insert mode:

inoremap <m-up>     <c-o>:lprev<cr>
inoremap <m-down>   <c-o>:lnext<cr>

sometimes appears garbage like

(358)
(360)
.feedkeys.call.run(287)
.utils.feedkeys.call.run(289)
u.feedkeys.call.run(194)
deys.call.run(196)
ddys.call.run(199)
kdll.run(124)
deys.call.run(126)
d v:lua.cmp.utils.feedkeys.call.run(129)
lua.cmp.utils.feedkeys.call.run(61)
kddkeys.call.run(63)

More offten this happends at ends of loclist when lprev/lnext prints 'No more items'.

ljkenny commented 3 weeks ago

I found the solution here:

https://github.com/hrsh7th/nvim-cmp/issues/2033#issuecomment-2448135783