1 Samuel 25:13

And David said unto his men, Gird ye on every man his sword. And they girded on every man his sword; and David also girded on his sword: and there went up after David about four hundred men; and two hundred abode by the stuff.

This order belongs to the period when David was showing magnanimity while being hunted by Saul, after Abiathar escaped Saul's slaughter of the priests and fled to David, who took him under his safeguard and protection. David spoke in indignation after his young men returned empty-handed, because Nabal had denied him what was his right and added insult to injury. In anger at that insult he decided to take revenge on Nabal and his household, commanding his men to gird on their swords to punish him.

That impulsive move to take revenge was more in keeping with Saul's character than with David's, showing that David still had to learn patience in the school of affliction. The violence he intended against Nabal and his household was not carried out, because Abigail's intervention kept him from it.