Melt 1/2 of the ghee in a nonstick skillet over medium-low heat. Add onion; spread out into a thin layer. Cook, stirring occasionally, until soft and beginning to brown, 8 to 10 minutes. Reduce heat if it's browning too quickly; do not allow to burn. Add garlic; cook and stir until fragrant, about 1 minute. Stir in vinegar.
Transfer onion-garlic mixture to a bowl; season with salt and pepper. Wipe out skillet and melt the remaining ghee over medium-low heat. Add walnut pieces and stir until crisp and lightly toasted, about 3 minutes. Remove from pan and set aside.
Add asparagus to the same skillet and increase heat to medium-high. Cook, stirring frequently, until bright green, tender, but still crunchy, 10 to 12 minutes. Season with salt and pepper. Plate asparagus, add onion mixture, and garnish with walnuts.