Vim script copy from https://gist.github.com/3485271.