Sayyiduna Ibn Abbas (may Allah be pleased with him) narrated: "The homes of the Ansar were far from the mosque, so they intended to move close to the mosque. Then this verse was revealed: 'And We record what they have sent ahead and their footprints' [Surah Ya-Sin: 12]. So they remained in their homes."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12258