I thought the usual solution is to make it very clear to the client that yak shaving is billable time. I even have a section in my invoice that goes into detail about how much they're paying me for that yak shaving time. The yak shaving stops pretty damned fast after they get that first invoice.
yak shaving is time the dev spends futzing around with tooling configuration, it has nothing to do with the client.
Sometimes yak shaving is necessary for a project (Java build config funtimes), in other cases not so much (fiddling with autocompletion plugins in your .vimrc)
The usual solution to this is to charge more. :)