On Vim 9 linux running this code:
inoremap <C-n> <C-o>:echo "aa"<CR>
doesn't display anything whereas:
inoremap <C-n> <C-o>:echo "aaaa"<CR>
displays "aaaa" and Press ENTER or type command to continue
as expected
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI believe the result of echo is overridden by the INSERT
status.
I propose to set cmdheight
to 2.
set cmdheight=2
To validate the hypothesis you can try to replace echo
by echom
and verify if a message has been output using :messages
command.
Not exactly related but for command mapping in insert mode or visual mode I suggest <cmd>
modifier:
inoremap <c-n> <cmd>echo "aaaa"<CR>
No need of <C-o>
no need of <C-u>
and no need of :
among other things.