There are two things you can do to focus while working, e.g. while writing.

  1. break down your work into small and clearly separated tasks. If they are small, they can be accomplished in one go, which is that focusing on them does not require a lot of willpower.
  2. Close open loops by externalizing them. In philosophy, externalize the product of your thinking by writing down the outcomes via evergreens. You can also write possible connections between notes and reminders for open questions and tasks you’ll do later. andy matuschak leaves reminders like these in individual permanent notes. Another way to do this is to use a writing inbox where fleeting notes about undeveloped ideas are stored. As long as they are there, they serve as reminders for these open loops without distracting us.

References

Ahrens, S. (2017). How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking – for Students, Academics and Nonfiction Book Writers. CreateSpace Independent Publishing Platform.