Psalm 18

v.18

They confronted me in the day of my disaster, but the Lord was my support.

v.19

He brought me out into a spacious place; he rescued me because he delighted in me.

v.24

The Lord has rewarded me according to my righteousness, according to the cleanness of my hands in his sight.

v.25-26

To the faithful you show yourself faithful, to the blameless you show yourself blameless, 26 to the pure you show yourself pure, but to the crooked you show yourself shrewd.

In this statement, David explains that some parts of our relationship with the Lord are reciprocal. If we are merciful to others, the Lord will be merciful to us. In celebrating God’s mercy to him, David might have recalled how he showed mercy to his own enemies.

BibleRef

That general statement is, that God deals with men according to their character; or, that he will adapt his providential dealings to the conduct of men. They will find him to be such toward them as they have shown themselves to be toward him.

It cannot mean here that God would assume such a character, or that he would be crooked, crafty, perverse in his dealings with men, for no one can suppose that the psalmist meant to ascribe such a character to God; but the meaning plainly is, that God would deal with the man referred to according to his real character: instead of finding that God would deal with them as if they were pure, and righteous, and merciful, such men would find that he deals with them as they are - as perverse, crooked, wicked.

AlbertBarnes

We project the character and attitude of our hearts onto God.

jj

v.28

You, O Lord, keep my lamp burning; my God turns my darkness into light.

v.35

You have also given me the shield of Your salvation, And Your right hand upholds me; And Your gentleness makes me great.

The idea is, that God had dealt with him in gentleness, kindness, clemency, and that to this fact alone he owed all his prosperity and success in life. It was not by any claim which he had on God; it was by no worth of his own; it was by no native strength or valor that he had been thus exalted, but it was wholly because God had dealt kindly with him, or had showed him favor. So all our success in life is to be traced to the favor - the kindness - of God.

AlbertBarnes

v.41

They cried for help, but there was no one to save them—to the Lord, but he did not answer.