Department stores have a nice selection of delicatessen stalls called “Markthallen” where you can eat everything on the spot.
Cafes - Many of the cafes in Heidelberg set up outside tables when the weather is fair, and these are enjoyed by locals and tourists alike.
It might be necessary to change trains (only once) at Mannheim, Stuttgart, or Frankfurt Central Station, but it is still likely to be faster than the bus.
One way prices: Frankfurt €24.50 (ICE), Stuttgart €26 (IC) €38 (ICE).
The "Heidelberg CARD", a tourist pass that includes public transportation, many museums, and the lower section of the mountain railway (a separate fare is required for the upper section), can be bought at the tourist information center located just outside the main station.