My problem is when I open the editor and refactor a function, I start finding other functions that need to be refactored, then finding even more refactoring opportunities from those, recursively, forever. At some point I need to stop refactoring and start producing something new...
The book 'Hare Brain, Tortoise Mind' has a good explanation of how that works, what it's good at and what it's not.
I get a lot of side chores done with directed procrastination. But, what works for me to get the main task done is to just open the IDE even without a goal. Instead of "Ugg... I need to make X work today...". Just open the editor and do anything. Refactor a function. Comment something. Whatever. Once you get started, it much easier to continue.