vim: Cleanup word matching code

**Don't merge it yet!** It requires review from people that actually know the Vim syntax :)
The check for `endfo` is lost here, isn't it?