This widget will make it so when you right click attack a unit, it will also set target on them. So moving away it will remember that as your target.
Installation
Place widget inside: Beyond-All-Reason\data\LuaUI\Widgets
Search settings for "target"
Set-target as default: set to off
Attack sets target: set to on
Lexon is the author so ping him if any issues.