Usually I find editing (both text and code) to be a bit of a drag. To spark things, I'd try rewriting instead of modifying things in place. Maybe pick a subroutine that you know you could do better and just rewrite it. Then another, then another. It's not quite doing something new, but I find that a lot more rewarding (and easier to motivate myself for) than changing things line by line.
Bottom line. When I'm in the low motivation part of the cycle, I try to find lots of really small tasks I can do quickly. Normally having those wins gets me going again.