Add the olive oil, onion, sugar and a large pinch of salt to the skillet. Cover and cook over low heat, stirring occasionally from time to time, until the onion is completely limp but still pale, 15 to 20 minutes. Uncover and cook over moderate heat until the liquid boils off and the onion is a light nut brown, about 3 minutes. Add the vinegar and boil over high heat for 3 minutes. Remove from the heat and let cool.