0

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

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.