Open mmirus opened 1 year ago
I'm having the same issue. I can get the <C-n>
and <C-p>
to work in the main window (in insert mode), as well as in the command window using /
, but not :
. What I do get with the latter (perhaps to help inform the issue):
<C-p>
takes me to the previous command in my command history
<C-n>
E464: Ambiguous use of user-defined command
The bindings reported by neovim:
:verbose cmap <C-n>
... points to ~/.config/nvim/bundle/nvim-cmp/lua/cmp/utils/keymap.lua:127
. This does not seem like a conflict because there is only one entry.
In neovim's default cmap
bindings for <C-n>
and <C-p>
it's clear that in the event it does "see" an auto-completion option, it will default to the behavior I'm getting with <C-p>
(moving to the previous item in my command history, instead of completion options).
|c_CTRL-N| CTRL-N after using 'wildchar' with multiple matches:
go to next match, otherwise: recall older
command-line from history.
CTRL-O not used
|c_CTRL-P| CTRL-P after using 'wildchar' with multiple matches:
go to previous match, otherwise: recall older
command-line from history.
I vaguely recall in vimscript options for setting a value with the first item in the popup list... it may be a need to review this behavior in the command window mode.
The conflict with <C-n>
remains unexplained (I also looked at bindings "for all" modes).
I resolved the conflicting use of <C-n>
. There was a plugin that set the binding for all modes.
Same problem here
I filed https://github.com/hrsh7th/cmp-cmdline/issues/108 yesterday; could be related to this.
Same issues here
Following a minimal config to reproduce the defect :
--------------------------------------------------------------------------------
-- Plug-in Installation
--------------------------------------------------------------------------------
local vim = vim
local Plug = vim.fn["plug#"]
vim.call("plug#begin")
-- {{{
-- Completion
Plug("hrsh7th/nvim-cmp")
Plug("f3fora/cmp-spell")
Plug("hrsh7th/cmp-buffer")
Plug("hrsh7th/cmp-cmdline")
Plug("hrsh7th/cmp-nvim-lsp")
Plug("hrsh7th/cmp-path")
-- }}}
vim.call("plug#end")
--------------------------------------------------------------------------------
-- Cmp-Nvim
--------------------------------------------------------------------------------
--{{
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "spell" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
}),
enabled = function()
local context = require("cmp.config.context")
if vim.api.nvim_get_mode().mode == "c" then
return true
else
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
end
end,
})
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "buffer" },
{ name = "cmdline" },
}),
})
--}}}
The workaround provided by EdmundsEcho does not work for my config.
This is not related 108. This one work well with the minimal config provided.
Hey there!
If I do the following in the command line:
:Lsp
, cmp offers to complete the commands and<C-n>
and<C-p>
successfully let me navigate up and down.Likewise, if I do
/thing
, cmp offers to complete the search term and the mappings work.However, if I do
:s/thing
or:%s/thing
, cmp offers to complete the search term, but the mappings do not work.Here's a demonstration:
https://user-images.githubusercontent.com/524994/234080224-9ceb14c3-da73-49e5-9789-f82fbe7321f0.mp4
You can't see that I'm pressing
<C-n>
and<C-p>
at then end when the substitute completion pops up (because it doesn't work), but I was. :joy:Here is my config (using lazy.nvim). Please let me know if you would like me to try to make one that's a more minimal reproduction.