Open drazil100 opened 2 months ago
Looking at the code this is probably the output I'm seeing in my file https://github.com/hrsh7th/nvim-cmp/blob/ae644feb7b67bf1ce4260c231d1d4300b19c6f30/lua/cmp/utils/feedkeys.lua#L27
While I haven't looked too very deeply into this code base my assumption is that this is a race condition where if command mode is exited before it finishes executing this line it instead inserts the rest of the line into the buffer. I have no clue what's interfering with this line though.
By the way, I just want to throw it out there that I am more than willing to help test patches and stuff. This isn't a case of report and leave. Just let me know what you need from me and I'll happily help you out in trying to get this resolved.
I had posted on the other issue about this. That was quite a long time ago and I can't repro it anymore.
I also noticed I had altered my mappings at some point to use norm!
instead of <c-o>
.
Does this help at all?
vim.keymap.set('i', '<up>', '<cmd>norm! gk<cr>', { silent = true })
vim.keymap.set('i', '<down>', '<cmd>norm! gj<cr>', { silent = true })
@vurentjie that fixed the issue for me. Thank you!
FAQ
Announcement
Minimal reproducible full config
Description
When holding up or down at the edge of a buffer it spams the tail end of
lua require"cmp.utils.feedkeys".run(...)
repeatedly into the buffer.I am pretty sure it has triggered in the middle of the file before but it is much less likely than at the edges of the buffer and I don't really have any proof.
Steps to reproduce
This issue is EXTREMELY difficult to reproduce on a minimum config and likely will not show if your machine is at all performant. (I only experience this on my laptop with an Intel Celeron N4000 processor, 4GB of ram, and emmc memory)
Expected behavior
No input whatsoever
Actual behavior
It spams varying amount of the tail end of
lua require"cmp.utils.feedkeys".run(...)
into the buffer. It can spam as little as a ) or as much as the full line though usually it only a couple of the characters unless you hold it long enough that nvim starts slowing down.Additional context
Reproduction with provided minimum config:
https://youtu.be/HmgRijZhuZ4 Note: Half the video is me copying and spam pasting the config to make the file super large. Even after pasting thousands of lines of code this only cropped up once. I was holding down pretty much the entire time after I hit the bottom of the file.
Reproduction with my normal config:
https://youtu.be/b0N2umon8pQ This it shows up super easily but I only have issues with it on my low powered machine. My regular desktop does not trigger this issue. (I haven't tried super hard though)
For all I know this could be an issue with nvim itself but since the line that gets pasted is a call to this plugin's function I figured you would have the best shot at figuring out what's going on.
I'll include a copy of my full nvim config as well in the event it helps you reproduce (the .txt is cause apparently github doesn't allow uploading of lua files) init.lua
Also I don't know if the 2 insert mode mappings are contributing to the error but it didn't trigger in any of the tests without them. That could however just be because of how hard it is to trigger on the provided minimum config.