Shimei son of Gera fell down before the king, as he was about to cross the Jordan, and said to the king, "May my lord not hold me guilty or remember how your servant did wrong on the day my lord the king left Jerusalem; may the king not bear it in mind. For your servant knows that I have sinned; therefore, see, I have come this day, the first of all the house of Joseph to come down to meet my lord the king." Abishai son of Zeruiah answered, "Shall not Shimei be put to death for this, because he cursed the Lord's anointed?" But David said, "What have I to do with you, you sons of Zeruiah, that you should today become an adversary to me? Shall anyone be put to death in Israel this day? For do I not know that I am this day king over Israel?" The king said to Shimei, "You shall not die." And the king gave him his oath. (2 Samuel 19:18-23, NRSV)
And there went over a ferry boat to carry over the king's household, and to do what he thought good. And Shimei the son of Gera fell down before the king, as he was come over Jordan; And said unto the king, Let not my lord impute iniquity unto me, neither do thou remember that which thy servant did perversely the day that my lord the king went out of Jerusalem, that the king should take it to his heart. For thy servant doth know that I have sinned: therefore, behold, I am come the first this day of all the house of Joseph to go down to meet my lord the king. But Abishai the son of Zeruiah answered and said, Shall not Shimei be put to death for this, because he cursed the Lord's anointed? And David said, What have I to do with you, ye sons of Zeruiah, that ye should this day be adversaries unto me? shall there any man be put to death this day in Israel? for do not I know that I am this day king over Israel? Therefore the king said unto Shimei, Thou shalt not die. And the king sware unto him. (2 Samuel 19:18-23, KJV)
After Absalom's death, David seems to be in a more tenderhearted and vulnerable mood. Which makes sense, we guess. After all, he's sick of death and pretty over the whole vengeance schtick. His own loss has made him sensitive and kind (in a sad way), as opposed to bitter.