cmp-cmdline
cmp-cmdline copied to clipboard
modifier cleanup breaks custom completion for command
$ vim --version
NVIM v0.7.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -ffile-prefix-map=/build/neovim-TaFwuh/neovim-0.7.0~ubuntu1+git202203110047-6170574d2-dd05b3569=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-TaFwuh/neovim-0.7.0~ubuntu1+git202203110047-6170574d2-dd05b3569/build/config -I/build/neovim-TaFwuh/neovim-0.7.0~ubuntu1+git202203110047-6170574d2-dd05b3569/src -I/build/neovim-TaFwuh/neovim-0.7.0~ubuntu1+git202203110047-6170574d2-dd05b3569/.deps/usr/include -I/usr/include -I/build/neovim-TaFwuh/neovim-0.7.0~ubuntu1+git202203110047-6170574d2-dd05b3569/build/src/nvim/auto -I/build/neovim-TaFwuh/neovim-0.7.0~ubuntu1+git202203110047-6170574d2-dd05b3569/build/include
Compiled by buildd@lcy02-amd64-015
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Given:
function! CompleteThis(A,L,P) abort
[...]
endfunction
command! -nargs=1 -complete=custom,CompleteThis RestoreThing call Something()
when cmp-cmdline is configured like so:
cmp.setup.cmdline(':', {
sources = {
{ name = 'cmdline', keyword_length = 2 },
{ name = 'nvim_lua' },
{ name = 'path' },
},
})
The custom completion function fails to run. The reason appears to be this code in cmp-cmdline. The regex processing ends up mangling the command name (in this specific instance it is this regex that causes the problem).
If I comment out the code linked above everything works as expected. if I comment out the referenced regex everything works as expected. At least with my configuration, if I change the name of the command to ResToreThing or RestOreThing everything works as expected.