Heat the oil in a large saucepan over medium heat. Add the onions, shallots, leek, garlic, vinegar, salt, pepper, and sugar and stir. Cook the onion mixture, stirring occasionally, for 45 minutes. Reduce the heat to low and continue cooking for 15 minutes, or until the onions are soft and brown and reduced to about 1 cup.
The confit will keep, covered, for up to 5 days in the refrigerator.