When I wrote some script, I will echo (not echom) some message in the command line to provide some hint. And I want to this message can be automatically removed once the job is finished or interrupted.
How to do that in vimL script?
You can clear all messages with :messages clear
, but as for individual messages I don’t know if there’s an API for that . . . .
It’s a bit of a hack, but you can use call feedkeys(':','nx')
. You may want to wrap this call with call inputsave()
and call inputrestore()
.
2 Likes
Since @wkcosmology mentioned using echo rather than echom I think by remove the message he means clear the output rather than clear the entry from the messages log.
Thanks! This is exactly what I want!