nvim-cmp
nvim-cmp copied to clipboard
Error when searching inside command window
FAQ
- [X] I have checked the FAQ and it didn't resolve my problem.
Announcement
- [X] I have checked Breaking change announcement.
Minimal reproducible full config
if has('vim_starting')
set encoding=utf-8
endif
scriptencoding utf-8
if &compatible
set nocompatible
endif
let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end
execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit
" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = true })
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "buffer" },
}),
}
cmp.setup.cmdline('/', {
enabled = true,
sources = { { name = 'buffer' } },
})
EOF
Description
When the cursor is inside the command window (opened via q:
), searching inside command window will cause nvim-cmp to throw error if autocompletion in cmdline /
is enabled.
Steps to reproduce
- Save the minimal config as
cmp-repro.vim
-
nvim -u cmp-repro.vim
-
q:
to open the command window - Press
/
and search for some patterns - See the error
Expected behavior
Should not error
Actual behavior
Get error
/tmp/plugged/vim-plug/nvim-cmp/lua/cmp/utils/window.lua:125: E11: Invalid in command-line wind
ow; <CR> executes, CTRL-C quits
Additional context
Here's a screen recording of the bug:
https://github.com/hrsh7th/nvim-cmp/assets/76579810/87be2723-ea19-46f6-abff-32659b77f669
In addition, I'm on nvim nightly NVIM v0.10.0-dev-653+gfbeef0d4ef, if that is related
Seems that the bug was once solved in #299 but it appears again lately.
Also seeing this issue. The original/linked one was fixed here, but obviously this new one seems to be more with opening a window from the command window and less to do with cursor movement inside it. Not sure either way though.
@hrsh7th do you have any suggestions?