LOL this may sound dodgy but my mate rian did this the other day...
his stock 4k had a shit idle but reved ok like you said... we played around with the vacuum hoses for a while and no difference... So he pulled them all off and then reattached them randomly to each other making sure there was no vacuum leaks and no left over places to put vacuum hoses.. Ha Ha Ha the car now purs like a kitten and revs like it just rolled out of the showroom