/startattack
/petassist

/* Your rotations here */

/stopmacro [@target, nodead, exists, harm]
/targetnearestenemy
/targetenemyplayer
/stopmacro [@target, nodead, exists, harm]
/follow /* Your FTL here */

Now what you'll want is a clear target. Normally this is just a mod variant of your spam key. Chain the spam key above and then mod the clear. So when your hunter gets turned the wrong way, you can clear target, and then immediately following with the spam key the FTL will regain an available target.