this is something you cannot change during a game. When you have the game client open and are logged in, in the top is a list of tabs that you can visit. Click on "Options", then you are presented with a list of options. The 5th from the top is called "Use autobuy" and it should be set to "Yes" to get the feature you want.
Then, when you are in the game and about to buy cards, the game will mark with a "+" sign all the cards biyable with the coin already generated (as now), but also the Treasures from your hand.
So, for example, with a Copper, Silver and Gold in hand, it will mark all cards up to 6 coins. You can click on the Gold in the supply and the game will automatically play the Treasures needed and buy that Gold.
Note that the game considers a some Treasures 'unsafe' to automatically play, because they have additional effects you may not want. Spoils is one example, maybe you want to preserve it for the next shuffle. Relic is another; it's an attack, so opponent might play a Caravan Guard and 'profit' from it.
Be sure to take this into account when you decide what you can and want to buy. With Copper, Silver, Gold and Relic in hand, the game will mark only the cards costing up to $6 as buyable, while in reality you can buy up to $8. Getting a Province (by also playing the Relic) would most players considered much more important that the small chance that opponent can react with something the Relic.
If you play the Relic first, the game sees that you generated $2 already, and will add the $6 in your hand and now show cards up to $8 as buyable.