This paper proposes an inverter control strategy that combines virtual synchronous generator control with harmonic detection based on Fourier linear combiners with adaptive gain. In the proposed strategy, the virtual synchronous generator control calculates the current in the fundamental frequency component, responsible for the control inertial characteristic, and harmonic voltage detector based on Fourier linear combiners selectively detects the harmonic voltages to be damped. The 5th harmonic order adaptive gain is calculated from voltage and current measurements on a bus of interest in the system. Real-time simulation results were developed in a hardware-in-the-loop test-bench to show that the proposed control can simultaneously mitigate the grid voltage and current harmonics and reduce the peaks of frequency oscillations after transients.