Getting along with 気が合う
考え方や感じ方が通じ合う。
The way of thinking and feeling is understood by each other.
Goo Dictionary
The expression 気が合う means “to get along well” or “to be on the same wavelength” with someone. It describes a sense of compatibility, mutual understanding, or shared preferences between people.
Your 気 (spirit) does the action of 合う (to match). When your 気 matches someone else’s 気, the two of you get along. You are kindred spirits.
Examples
俺物語!! » Volume 3 » Page 170
老女的少女ひなたちゃん » Volume 3 » Page 104