Coarsley dice onions into large squares.
In a cold pan, combine oil and onions. Place over low heat.
Cover and let onions cook for 1 - 1.5 hours, stiring ocasionally. At first, the onions may not seem like they are cooking. Do not turn the heat up. Let them sit at low heat and they will soften and release a lot of water.
Once the onions should be soft and translucent, add sugar and turn heat up to medium low. Stir constantly. The onions will slowly start to develop some colour.
Keep stiring until the onions reach a dark auburn, brown colour, about 15-20 minutes. Add red wine vinegar and cook on medium low heat, stirring constantly for another 10-15 minutes until there is no more liquid is at the bottom of the pan. Some oil may remain at the bottom of the pan.
Transfter onion compote into a jar. Serve immediatly or let cool and refridgerate for up to 2 weeks.