Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
ibnmajah:785ʿAlī b. Muḥammad > Wakīʿ > Isrāʾīl > Simāk > ʿIkrimah > Ibn ʿAbbās > Kānat al-Anṣār Baʿīdah Manāziluhum from al-Masjid Faʾarādūā > Yaqtaribūā Fanazalat Wanaktub Mā Qaddamūā Wāthārahum

"The houses of the Ansar were far from the mosque and they wanted to move closer. Then the following Verse was revealed: 'We record that which they send before (them), and their traces.'" [Ya-Sin: 12] He said: So they remained (where they were)."  

ابن ماجة:٧٨٥حَدَّثَنَا عَلِيُّ بْنُ مُحَمَّدٍ حَدَّثَنَا وَكِيعٌ حَدَّثَنَا إِسْرَائِيلُ عَنْ سِمَاكٍ عَنْ عِكْرِمَةَ عَنِ ابْنِ عَبَّاسٍ قَالَ

كَانَتِ الأَنْصَارُ بَعِيدَةً مَنَازِلُهُمْ مِنَ الْمَسْجِدِ فَأَرَادُوا أَنْ يَقْتَرِبُوا فَنَزَلَتْ {وَنَكْتُبُ مَا قَدَّمُوا وَآثَارَهُمْ} قَالَ فَثَبَتُوا  


See similar narrations below:

Collected by Ṭabarānī
tabarani:12310ʿAbdullāh b. Muḥammad b. Saʿīd b. Abū Maryam > Muḥammad b. Yūsuf al-Firyābī > Isrāʾīl > Simāk b. Ḥarb > Saʿīd b. Jubayr > Ibn ʿAbbās > Kānat al-Anṣār Baʿīdah Manāziluhum from al-Masjid Faʾarādūā

[Machine] The Ansar were far from their homes from the mosque, so they wanted to go to the mosque. And it was revealed: "And We record what they have put forth and their effects." So they stayed in their homes.  

الطبراني:١٢٣١٠حَدَّثَنَا عَبْدُ اللهِ بْنُ مُحَمَّدِ بْنِ سَعِيدِ بْنِ أَبِي مَرْيَمَ ثنا مُحَمَّدُ بْنُ يُوسُفَ الْفِرْيَابِيُّ ثنا إِسْرَائِيلُ عَنْ سِمَاكِ بْنِ حَرْبٍ عَنْ سَعِيدِ بْنِ جُبَيْرٍ عَنِ ابْنِ عَبَّاسٍ قَالَ

كَانَتِ الْأَنْصَارُ بَعِيدَةً مَنَازِلُهُمْ مِنَ الْمَسْجِدِ فَأَرَادُوا أَنْ يَتَحَوَّلُوا إِلَى الْمَسْجِدِ فَنَزَلَتْ {وَنَكْتُبُ مَا قَدَّمُوا وَآثَارَهُمْ} فَثَبَتُوا فِي مَنَازِلِهِمْ