Its pretty simple. If you just want to gain weight or muscle you need to get enough complete protein, carbs from whole foods and good fats.
Protein from tofu, tempeh, seitan, beans, quinoa, protein powders etc
Carbs - from brown rice, wholemeal bread, oats, buckwheat, fruit
Get you fats from nuts, seeds, avocados and coconut.
I think one of the best ways to put on some fat is to eat carbs before going to sleep.