Yesss. I definitely notice that I’m less productive when I don’t eat very well and don’t make an effort to be socially and physically active.
One thing that helps me is to get properly dressed (i.e. in a cute, presentable outfit - not a giant baggy sweater and jeans) and then go to a local coffee shop and do my homework there. If the homework doesn’t require internet access, I try to pick a café that doesn’t have WiFi because then I’m more productive.
Another trick I use is to set my writing app to full-screen mode. That way, every time I have an urge to check my Twitter or refresh Reddit, I look at my screen and remember that I set it to full-screen for a good reason.
I also find it massively helpful to ingest caffeine slowly over the course of my study session, listen to good music, have a friend around who won’t interrupt me but will pester me if I get off-track, and have a reward lined up for when I’m done.