Extract the prg determining code (from asynccommand.vim) to a function to make it easier for someone to implement commands like #29.