I haven't looked at vim code in ages but if it is really 300K lines of code, I wouldn't refactor it in any major way. If I absolutely wanted to scratch that particular itch, I'd rewrite it from scratch. In another language (not C or C++). And structure it differently.