Recently, I needed to write lots of Text — my deploma thesis, FLOW3 documentation and internal documentation for our company. I recognized that I had some severe difficulties in staying focussed; I always knew some distractions I could do instead of writing.
I tried out several distraction-free writing tools; and the one I am using now is called FocusWriter.
It’s open source, available for all platforms, actively maintained and can be customized to your needs. For me, it really helps keeping myself focused.