I posted the following for khenry under Grammar>Function of Infinitive Phrase. My suggestion of http://www.englishpage.com is helpful as well.
Choosing between gerunds and infinitives is a bit difficult unless you’re a native speaker. Go to http://www.englishpage.com and click on “gerunds” in the left column. There is a good, two part tutorial that should help.
Generally, gerunds are more common in the subject slot. They seem to sound more natural than infinitives, even if the infinitive is correct. For example:
Keeping diary in English is a good way to improve English.
To keep diary in English is a good way to improve English.
Both are correct, but the first sentence is better, except that you should say, “keeping a diary….” An article, such as “a” or “the,” typically precedes singular count nouns (those you can count). Non-count nouns, such as coffee, lettuce, water, etc. don’t generally use the article. Sometimes we say, “I want to stop here and get a coffee,” but that really means a “cup of coffee,” not coffee in general.
About 90 percent of verbals used as objects will be gerunds,
In the object position, it’s harder to choose between the gerund and the infinitive, since it all depends on the main verb. Some verbs take either, as in:
I like running outside.
I like to run outside.
Some verbs take only a gerund or only a infinitive:
“I ended up taking the subway” is correct.
“I ended up to take the subway” is incorrect.
“I want to buy a new car” is correct.
“I want buying a new car” is incorrect.
He is free to do what he wants. This is correct
He is free doing what he wants. This is incorrect, but, “He is happy doing what he wants” in correct.
(The correct form here is “wants”; you had “want.” Remember: I want, you want, he wants.)
I don’t know that there is a “rule,” but verb like wish, want, plan, hope, etc. will take an infinitive. Most of thes verbs express some type of desire or cognitive process.
The rest of the time, it’s gerund, infinitive, or either, depending in which verb.
Take a look at the site I mentioned and see if I’m missing anything. Wish this were clearer and easier, but it’s not.