replace libs with idea modules when possible

Finally got around to clean up the commits (and adapt to 0.13). To use this feature use "sbt 'gen-idea replace-libs".