Nitrogen heterocycles could be prepared in good yields via intramolecular cyclization of tertiary amines and alkenes promoted by KOt-Bu–DMF.