Vanity is a sign of ignorance of Torah (Kiddushin 49b).
The Talmud and the ethical works condemn vanity as the worst of all character traits. Whereas the Divine Presence is infinite, and God does not abandon even the worst sinner, He cannot countenance a vain person: Haughty eyes [vanity] ... him I cannot tolerate (Psalms 101:5).
It is not difficult to understand the Divine intolerance, since we ourselves also are uncomfortable in the presence of those who boast of their achievements, try to impress everyone with name dropping, and have an attitude of superiority and condescension. While we may be unable to avoid these people's company, we certainly do not try to cultivate friendships with them. The irony is that while we may despise this attitude in others, we may sometimes fall into the trap of harboring it ourselves.
Luzzato states that the magnitude of one's vanity is directly proportional to the magnitude of one's folly (Path of the Just, Chapter 23). Truly wise people are not vain.
Imagine yourself speaking to an audience through a computerized public address system which has been so programmed that anytime you say something to impress other people with your greatness, the words that come out of the loudspeaker are, "I am a fool." How careful you would be to avoid making a spectacle of yourself!
Such a computerized speaker system actually exists within each of us, says Luzzato. Anytime people boast about themselves, they are announcing to the whole world, "I am a fool." Any self-respecting person would be cautious not to make such a declaration.