Regardless of the warning about mental ambition, I shall add here the latin root of "vanity", which is vanus meaning empty. In the example given, vanity thus means emptiness of purpose or of substance.