Why filter by hand? Do what I mentioned previously, which is to take that incoming list of strings and build one big string and then return that to Vim. It's just simpler.