I'm not sure whether you'll manage to do this with echo and the message list.
A good way of going about this would be to create a new buffer and put the stuff you're interested in into that buffer. Then set the buffer to be nomodifiable
, nomodified
and buftype=wipe
. If you need to add more data to the buffer, set modifiable
, add the data and then set noma nomod bh=wipe
. Set the filetype to something custom and write a syntax file for your required syntax.
Set the buffer name to something specific for your requirements.
Finally, map a keyboard shortcut or command to something like:
map @ :exe 'bufdelete' bufnr('MyBufferName')<CR>
This will make the @ key close the buffer (thereby providing you with a single key method of deleting the info). You could, of course, improve this by sticking it in a function and checking that the buffer exists before deleting it, but I'll leave that as an exercise for you for now (let me know if you have any problems).
An existing plugin that does something fairly similar to this is Dr Chip's RunView plugin. Have a look at the source code and see if it helps. Add a comment to this post if you need any more help.