I think you want to use Potion instead of Vimscript here.