(This question had to show up eventually… :) For my answer, I'll be borrowing most example sentences and categorizations from pages 176-179 of 初級【しょきゅう】を教【おし】える人【ひと】のための日本語【にほんご】文法【ぶんぽう】ハンドブック and from this PDF.
Cases where only の is allowed
When the following verb deals with one of the senses: 聞く【きく】, 聞こえる【きこえる】, 見る【みる】, 見える【みえる】, 感じる【かんじる】, and so on.
隣【となり】の家【いえ】でだれかが叫ぶ【さけぶ】のが聞こえた【きこえた】。 I could hear someone shouting in the house next door.
船【ふね】の中【なか】から、魚【さかな】が泳いでいる【およいでいる】のが見えます【みえます】。 From inside the boat, I can see fish swimming.
When the following clause occurs in concert with the preceding clause: 待つ【まつ】, 手伝う【てつだう】, じゃまする, and so on.
テニスコートが乾く【かわく】のを待っています【まっています】。 I'm waiting for the tennis court to dry.
このパソコンを運ぶ【はこぶ】のを手伝ってください【てつだってください】。 Please help me carry this computer.
When the following verb is one of 止める【とめる】, やめる, and so on.
彼【かれ】が出て【でて】行こう【いこう】とするのを止めました【とめました】。 I stopped him trying to leave.
タバコを吸う【すう】のをやめましょう。 Stop smoking.
As you can see, the common thread running through these cases is that there is an immediacy of time and/or location. That is, the outer clause necessarily occurs at the same time and/or same location as the inner clause.
Cases where only こと is allowed
When the following verb deals with communication or internal thoughts: 話す【はなす】, 伝える【つたえる】, 約束する【やくそくする】, 祈る【いのる】, 希望する【きぼうする】, and so on.
ゼミに出られない【でられない】ことを先生【せんせい】に伝えてください【つたえてください】。 Please tell the teacher I can't make it to the seminar.
復興【ふっこう】が速く【はやく】進む【すすむ】ことを祈っています【いのっています】。 I'm praying that the recovery proceeds quickly.
When the following clause is one of だ, です, or である.
私【わたし】の趣味【しゅみ】は映画【えいが】を見る【みる】ことです。 My hobby is watching movies.
(This is because if の were used, it would be confused with the ~のだ pattern.)
When the こと is part of a set pattern such as ことができる, ことがある, ことにする, ことになる, and so on.
私【わたし】は外国【がいこく】で暮らした【くらした】ことがあります。 I've lived in a foreign country before.
あれを見なかった【みなかった】ことにする。 I'm going to pretend I didn't see that.
With こと, the immediacy expressed by の is lost, and matters are considered from a more abstract, removed standpoint.
Cases where both are allowed
In general, for any cases not covered in the above lists, you can use either こと or の, but there are some times when you might choose one over the other. For example, consider this pair of sentences from a page in the 日本語Q&A at ALC:
僕【ぼく】はこうしてのんびり映画【えいが】を観る【みる】ことが好きだ【すきだ】。 I like relaxing with a movie like this.
僕【ぼく】はこうしてのんびり映画【えいが】を観る【みる】のが好きだ【すきだ】。 I like relaxing with a movie like this.
The key here is the こうして ("like this"), which indicates the speaker is making a statement about something happening right now. Thus the statement has the immediacy of time and place that の is best for. Using こと here isn't technically incorrect, but it sounds a little unnatural, so の is the better option.
Non-nominalizing uses of の
As a side note, there was one example sentence in the PDF I linked which doesn't belong, in my opinion:
毎月【まいつき】おこづかいを貯金している【ちょきんしている】のは、新しい【あたらしい】スケートボードを買いたい【かいたい】からです。 The reason I'm saving my allowance every month is because I want to buy a new skateboard.
This use of の is the "anticipatory の" pattern. In this sentence, の could be replaced with the more specific 理由【りゆう】. Another example:
日本【にほん】にはじめて行った【いった】のは5年【ねん】前【まえ】です。 The first time I went to Japan was five years ago.
の could be replaced with 時【とき】 here.
I do not agree with the replacements that you suggest.
~理由は、~からだ sounds slightly ungrammatical to me, similar to English "The reason is because...". But then again, maybe it's because I know it's wrong in English that I don't like it in Japanese. I'd be interested in other people's opinions. If using 理由, I would prefer ~理由は、~ことだ.
~時は、五年前だ sounds even more ungrammatical to me. After 時は, I expect an explanation about what went on/happened at that time, not when it was.
– dainichi Jan 24 '12 at 04:55Now, my doubt is:
I wonder if this sentence is okay. Should I have used こと instead of の? Also, my never-ending doubt: I used が, but could it also be は? Or it should have been は not が?
– Francis Jan 17 '20 at 15:29