There are many reasons why your idle is bad and your engine dies, changing your distributor may or may not solve the problem. But judging from the year of your truck, we have more than meets the eye. :)
Here is where you can find the cap
If the car runs fine while driving and cuts off ONLY when you are idling (foot completely off the gas pedal and RPM's at idle speed) then your idle air control valve my need adjusting or need to be replaced, or idle air passage make have been blocked off by excessive carbon build-up. If build-up is the problem, a good removal and cleaning will do the trick or an off the shelf spray cleaner may get the job done as well.
Could also be clogged fuel injection system. Try a fuel treatment with a full tank of gas or it could be a plugged up catalytic converter.
First thing id do is check and change the fuel filter, its usually checked by blowing air through it (in the arrow direction) if no air flows through or it blows through slowly then its more than likely plugged change it and go from there. sometimes after all avenues have been followed and the problem still exists i have seen the sock on the fuel pump be plugged and do the same. it will run great while accelerating but stall at idle due to not enough fuel pressure.
It could be a problem with the car not getting enough fuel, or it may have something to do with one or more of the sensors, such as the Mass Airflow Sensor. Is your check engine light on? If it is then its most likely a faulty or dirty sensor.
Please chect the EGR valve to see if it is stuck open with a chunk of carbon. This will cause an internal vacumn leak and the car will not idle. To test the EGR valve (Exhaust Gas recirculation) pull it off and try to blow thru it. Also look to see if the EGR pintle is seated.