Prevent infinite loop on gVim

This addresses the issue in #42.