Audacity is a classic, freely available, open source DAW that should work for recording lectures. When I record podcasts, I'll occasionally want to pause mid-recording to collect my thoughts or look at notes. I use the 'p' keyboard shortcut to toggle pausing and continuing recording.
Alternately, you could record the entire lecture, and then use the build-in effects to remove silences. Effect > Truncate silence. The settings for that effect will allow you to set a threshold and choose whether to shorten to a fixed length for each silence, or compress the silence to speed things up. The documentation is very good.