A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
psa 7:1Shiggaion--a plaintive song or elegy. Though obscure in details, this title seems to intimate that the occasion of this Psalm was some event in David's persecution by Saul. He prays for relief because he is innocent, and God will be glorified in his vindication. He thus passes to the celebration of God's righteous government, in defending the upright and punishing the wicked, whose malignant devices will result in their own ruin; and, confident of God's aid, he closes with rejoicing. (Psa. 7:1-17)
Though many enemies set upon him, one is singled out as prominent, and compared to a wild beast tearing his prey to pieces (compare Sa1 20:1; Sa1 23:23; Sa1 26:19).
psa 7:3if I have done this--that is, the crime charged in the "words of Cush" (compare Sa1 24:9).
psa 7:4If I have injured my friend.
yea, I have delivered, &c.--This makes a good sense, but interrupts the course of thought, and hence it is proposed to render, "if I have spoiled my enemy"--in either case (compare Sa1 24:4-17; Sa1 31:8, Sa1 31:11).
psa 7:5This is the consequence, if such has been his conduct.
mine honour--(compare Psa 3:3; Psa 4:2) --my personal and official dignity.
psa 7:6God is involved as if hitherto careless of him (Psa 3:7; Psa 9:18).
rage--the most violent, like a flood rising over a river's banks.
the judgment . . . commanded--or, "ordained"; a just decision.
psa 7:7compass thee--as those seeking justice.
return thou on high--assume the judgment seat, to be honored as a just Ruler by them.
psa 7:8Though not claiming innocence in general, he can confidently do so in this case, and in demanding from the Judge of all the earth a judgment, he virtually asks acquittal.
psa 7:9the hearts and reins--the affections and motives of men, or the seat of them (compare Psa 16:7; Psa 26:2); as we use heart and bosom or breast.
psa 7:10defence--literally, "shield" (Psa 5:12).
psa 7:11judgeth--as in Psa 7:8.
the wicked--Though not expressed, they are implied, for they alone are left as objects of anger.
psa 7:12They are here distinctly pointed out, though by changing the person, a very common mode of speech, one is selected as a representative of wicked men generally. The military figures are of obvious meaning.
psa 7:13against the persecutors--Some render "for burning," but the former is the best sense. Arrows for burning would be appropriate in besieging a town, not in warring against one man or a company in open fight.
psa 7:14The first clause expresses the general idea that wicked men labor to do evil, the others carry out the figure fully.
psa 7:15Sa1 18:17; Sa1 31:2 illustrate the statement whether alluded to or not. These verses are expository of Psa 7:14, showing how the devices of the wicked end in disappointment, falsifying their expectations.
psa 7:17his righteousness-- (Psa 5:8). Thus illustrated in the defense of His servant and punishment of the wicked.