I want to create a function which would have the same behavior as for example :tabs (the screenshot is in french but I'm sure most of you will see what I mean):
I for now I have the folowing command which works partially:
function! MyFunction()
echo "foo"
echo "bar"
let test = input("Press Enter or input a command", "", "command")
endfunction
The output is shown until the user input something but the behavior is not exactly the same as the one of the built-in functions:
With my function the line
Press Enter or input a commandwill stay on screen whereas with the built-in functions when the user press a key the blue sentence on my screenshot disappears to let the command prompt appearing.Also I'll have to create my own code to execute the command entered by the user if he enter one.
So my question is: Is there a "default" way to keep the ouput of my vimscript function in the command line windows on the bottom of the screen until the user press Enter or input a new command?
I would be surprised if every function with an output had to redefine this behavior but I couldn't find how it is done.


echomsgis your friend. See also:help interactive-functions.echomwouldn't change the behavior of the "pause" after the message and the user has to use the command:messagesto see what was output which isn't very convenient in my opinion.echomsgmessages are persistent,echoones are ephemeral, they're gone at the next refresh whether you managed to see them or not. The point is, you should probably adapt what you want to do to the way Vim works, rather than trying to do it the other way around.echomare more persistent. Also I can't agree more with you when you say that I should follow the way Vim works, that's what I'll try to do ;-)