The Apostle previously admonished the Ephesians to persevere in ecclesial unity by describing to them its quality and pattern (4:1). In the part that follows he teaches them the way to remain within the Church's unity. First, he gives them precepts by which they can remain in ecclesial unity. First, he sets down precepts for everyone. First, he expresses certain general precepts to which all the others can be reduced. Since the Apostle's intention is to draw them away from their old customs to embrace Christ's new teaching, first, he demonstrates how the doctrine of Christ is just the opposite... of the old pagan perversity. Secondly, he offers them incentives to leave it behind and adopt the way of Christ (4:22).
That you will be able to carry out, he says, what I have spoken of above, I say, not beseeching you as previously, rather I say and testify to what I have asserted. "I testify again to every man circumcising himself that he is a debtor to the whole law" (Gal. 5:3). "I charge thee, before God and Jesus Christ, who shall judge the living and the dead..." (2 Tim. 4:1). And what does he bear witness to here? That henceforward, from the moment you believed and were converted to Christ, since you "are now clean" (Jn. 13:10), you walk not as also the Gentiles walk. To walk here means to live: "If we live in the Spirit, let us also walk in the Spirit" (Gal. 5:25). This should not be as the Gentiles walk: "You know that, when you were heathens, you went to dumb idols according as you were led" (1 Cor. 12:2). You must not walk in such a manner: "My son, walk not with them: restrain thy foot from their paths" (Prov. 1:15).
Then, in saying in the vanity of their mind, he gives the reason for his prohibition. Note that to walk spiritually is to make progress. "The path of the just is right to walk in" (Is. 26:7), and to Abraham it was said: "Walk before me, and be perfect" (Gen. 17:1). There are three norms immanent in man by which he must be guided and regulated if he is to walk justly and make spiritual progress. In man, one of these is the reason which judges about what is to be done in concrete circumstances. Another is the understanding of universal principles, called synderesis; and thirdly, there is the divine law or God. Actions are good and meritorious when the person is guided by these three in their proper interrelations; namely, when the action is in accord with the judgment of reason, and this reason judges according to true understanding, or synderesis; and this synderesis is, in turn, directed by the divine law.
The life of the Gentiles did not resemble this, it was lacking these three. First of all, rational judgment was missing since they walked in the vanity of their mind. Mind here is the power to apprehend through which we judge about individual objects. Hence, a man is called upright when he judges correctly about what should be done. But this mind is sometimes upright, and at other times vain. It is termed upright when, guided by appropriate norms, it attains to the proper end; it is vain when, led by the wrong norms, it does not achieve the proper end. "All men are vain, in whom there is not the knowledge of God" (Wis. 13:1), "because they became vain in their thoughts" (Rom. 1:21) "and walked after vanity and are become vain" (Jer. 2:5).
Source: Commentary on Ephesians