Trim the top and bottom of the onions minimally, otherwise they will break up during cooking.
Set the oven to low, 140°C/275°F/Gas 1.
Take a pan wide enough to hold the onions in a single layer and melt the butter in this over a medium flame. As soon as this starts to brown, add the sugar and half the vinegar. Add the onions and stir to coat.