Target closest enemy and cast ability

/startattack will target the nearest enemy if you don’t already have one targeted.

/targetenemy works the same as tab targeting.

/targetenemyplayer is a legacy command from before they revamped the targeting logic and I wouldn’t recommend ever using it.

/run C_CVar.SetCVar("TargetPriorityPvp",3)

Also, I strongly recommend against using /cleartarget rotationally as it may reset your swing timer causing you to lose significant dps from auto attacks.

I personally wouldn’t use mouseovers on melee characters except for abilities like taunt, charge, intervene, and ranged abilities like heroic throw.