"Get rid of most of the bumpf in the file :g/solid/d :g/loop/d :g/endfacet/d "Get rid of leading and trailing spaces :%s/^ *//g :%s/ *$//g "Unify spaces :%s/ \+/ /g "Rewrite each facet normal into a glNormal3f :%s/facet normal /glNormal3f(/g "Rewrite each vertex into a glVertex3f :%s/vertex /glVertex3f(/g "Rewrite line endings into function endings "and separate arguments :%s/$/);/g :%s/ /, /g "Colour each vertex :%s/\v(glV.*\n)(glV.*\n)(glV.*\n)/glColor3f(1.0, 0.0, 0.0); \1glColor3f(0.0, 1.0, 0.0); \2glColor3f(0.0, 0.0, 1.0); \3/g "Get rid of blank lines :g/^$/d