Steps to reproduce
-
Create the following 'init.vim':
set nocompatible
let g:n = 0
inoremap <C-r> <Cmd>let g:n += 1<CR>
nnoremap <M-m> <Cmd>startinsert<CR><Cmd>call complete(col("."), [])<CR>
-
vim --clean -u init.vim
-
Press <M-m>. It starts Insert mode with empty+hidden completion menu.
-
Press <C-r>. It indicates that it waits for a register id. Press a and <Esc> to finish it. Executing :echo g:n shows 0, which means that custom mapping was never used.
-
Start Insert mode with i, press <C-r>, and go back to Normal mode. Executing :echo g:n shows 1, which means that custom mapping was used.
Notes:
- The same behavior is observed if
complete() is used with one or more string candidates.
- Custom mapping works as expected if Insert mode completion is started with a built-in mapping. In Insert mode type
ab abc a, press <C-n>. This shows a pmenu. Pressing <C-r> does not ask for register and executing :echo g:n later shows increase in g:n value.
Expected behaviour
Custom <C-r> mapping in Insert mode should be executed regardless of whether there is a completion menu shown with complete().
Version of Vim
9.2.316
Environment
OS: EndeavourOS Linux x86_64, 6.19.11-arch1-1
Terminal: Ghostty 1.3.1-arch2
$TERM: xterm-ghostty
Shell: Nu 0.111.0
Logs and stack traces
Steps to reproduce
Create the following 'init.vim':
vim --clean -u init.vimPress
<M-m>. It starts Insert mode with empty+hidden completion menu.Press
<C-r>. It indicates that it waits for a register id. Pressaand<Esc>to finish it. Executing:echo g:nshows 0, which means that custom mapping was never used.Start Insert mode with
i, press<C-r>, and go back to Normal mode. Executing:echo g:nshows 1, which means that custom mapping was used.Notes:
complete()is used with one or more string candidates.ab abc a, press<C-n>. This shows a pmenu. Pressing<C-r>does not ask for register and executing:echo g:nlater shows increase ing:nvalue.Expected behaviour
Custom
<C-r>mapping in Insert mode should be executed regardless of whether there is a completion menu shown withcomplete().Version of Vim
9.2.316
Environment
OS: EndeavourOS Linux x86_64, 6.19.11-arch1-1
Terminal: Ghostty 1.3.1-arch2
$TERM: xterm-ghostty
Shell: Nu 0.111.0
Logs and stack traces