-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab does not work correctly in cmdline-completion #875
Comments
Please do NOT use packer.nvim for reproduction. |
Reproduced. I'll check it. |
Thank you, here's the reproduction with vim-plug
|
I'm affected by this as well. I think it has something to do with attaching a cmp.mapping to |
@wookayin is the only workaround to disable the tab mapping completely? Although this fixes the EDIT: note this still doesn't work despite the new breaking changes #231 (comment) (separating my config for cmdline mode with only preset command line mappings -> pressing |
This bug still exists even with the latest changes. |
This bug still seems to exist for me too, can this issue be reopened? |
I confirm, I still have this bug too. I use the following setup:
Edit Im able to fix the bug using the following changes
|
Ended up here as well as cmdline command mode completion doesn't seem to work for me. |
I'm experiencing this, too. Btw I'm not using cmp's For me, the issue only shows up after a while. When starting a new neovim instance, it always works as expected, but at some point the issue appears. I'm not able to find what exactly triggers it... Can this issue be re-opened, please? |
Please creaye new issue with reproduction config. I can't do anything without new indormation. I'll ignore this thread if anyone does not provide reproduction full config. |
Hi all! I don't have any deep understanding of why this bug (?) occurs, so I'm not 100% sure whether the following would not break something else in your setup, but it worked for me! My initial config (broken): local lsp = require('lsp-zero')
local cmp = require('cmp')
local luasnip = require('luasnip')
local keymap = require('cmp.utils.keymap')
lsp.setup_nvim_cmp({
mapping = {
-- from: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#intellij-like-mapping
["<Tab>"] = cmp.mapping(
function(fallback)
-- This little snippet will confirm with tab, and if no entry is selected, will confirm the first item
if cmp.visible() then
local entry = cmp.get_selected_entry()
if not entry then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
cmp.confirm()
end
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, {"i","s","c",}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {"i", "s"}),
['<CR>'] = cmp.mapping.confirm(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
}
}) Fixed version: lsp.setup_nvim_cmp({
mapping = {
-- from: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#intellij-like-mapping
["<Tab>"] = cmp.mapping(
function(fallback)
-- This little snippet will confirm with tab, and if no entry is selected, will confirm the first item
if cmp.visible() then
print("cmp visible");
local entry = cmp.get_selected_entry()
if not entry then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
cmp.confirm()
end
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
if vim.fn.pumvisible() == 0 then
vim.api.nvim_feedkeys(keymap.t('<C-z>'), 'in', true)
else
vim.api.nvim_feedkeys(keymap.t('<C-n>'), 'in', true)
end
end
end, {"i","s","c",}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
if vim.fn.pumvisible() == 0 then
vim.api.nvim_feedkeys(keymap.t('<C-z><C-p><C-p>'), 'in', true)
else
vim.api.nvim_feedkeys(keymap.t('<C-p>'), 'in', true)
end
end
end, {"i", "s"}),
['<CR>'] = cmp.mapping.confirm(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
}
}) It's taken from the fix commit here 3192a0c |
I'm still experiencing this issue randomly. When I type commands like EDIT: Sorry it was me. As this Reddit comment suggests, as well as README, I have to enable I still wonder why the bug was kinda randomly occuring though. |
FAQ
Issues
Neovim Version
6.1
Minimal reproducible full config
Description
Hello,
When I open a file and do
:e <Tab>
I see aI^
char inserted. No completion.I'll upload a video to showcase as well.
Steps to reproduce
Expected behavior
See autocompletion of commands and paths
Actual behavior
^I
inserted and no autocompletionAdditional context
No response
The text was updated successfully, but these errors were encountered: