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:
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:n later shows increase in g:n value.Custom <C-r> mapping in Insert mode should be executed regardless of whether there is a completion menu shown with complete().
9.2.316
OS: EndeavourOS Linux x86_64, 6.19.11-arch1-1
Terminal: Ghostty 1.3.1-arch2
$TERM: xterm-ghostty
Shell: Nu 0.111.0
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()