I’m using vim.api.nvim_echo
to output some text for a plugin I’m writing, and I’m trying to avoid the Press ENTER or type command to continue
prompt.
Here’s an example that triggers that prompt:
:lua vim.api.nvim_echo({ { string.rep("A", 200) } }, false, {})
I’ve tried using the window width to truncate the result. Even though the message now fits on one line, I’m still seeing the prompt.
:lua vim.api.nvim_echo({ { string.sub(string.rep("A", 200), 1, vim.fn.winwidth(0) - 1) } }, false, {})
In my Vim instance, it seems the magic number of 103
is what’s needed to prevent this prompt from being displayed. Is there a way that I can programmatically determine what value is needed to truncate my string to avoid the prompt? Or, better yet, is there a way I can avoid the prompt entirely while using vim.api.nvim_echo
?