> I thought about using includes, but that defeats having everything in
> one place.
It sounds like the problem is that you have everything in one place.
I had a similar problem with a huge mess of PHP/HTML and it became a
lot more manageable once I organized the code better. I don't think
an editor can help with this problem.