[vim/vim] Insert mode `<C-r>` mapping is not triggered after calling `complete()` (Issue #20004)

2 views
Skip to first unread message

Evgeni Chasnovski

unread,
Apr 18, 2026, 9:09:14 AM (2 days ago) Apr 18
to vim/vim, Subscribed
echasnovski created an issue (vim/vim#20004)

Steps to reproduce

  1. 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>
  2. vim --clean -u init.vim

  3. Press <M-m>. It starts Insert mode with empty+hidden completion menu.

  4. 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.

  5. 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


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20004@github.com>

Christian Brabandt

unread,
11:47 AM (7 hours ago) 11:47 AM
to vim/vim, Subscribed

Closed #20004 as completed via 49e8630.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/20004/issue_event/24684347726@github.com>

Reply all
Reply to author
Forward
0 new messages