How to avoid hit-enter when using cmdheight=0?

Should I do something like:

if vim.opt.cmdheight:get() ~= 0 then
     print(msg)
end

the issue is that the msg isn’t added to the messages history.
So is there a way using vim.api.nvim_echo or vim.pretty_print to print a msg without trigger the hit-enter “behavior”?
Thank you (:

You could maybe set the cmdheight to 1, print the message, then set it back to 0.

1 Like