I'm still vengeful towards my ex
That sounds stressful. Why stay vengeful towards an ex?
When I think about him negatively,  I can picture him talking back to me.
It's understandable to be upset about an ex who treated you badly. Holding grudges though can be unhealthy. Its better to get over someone and start fresh than to constantly think about the negative things in your life.
It gives me nightmares sometimes to think about how he used to treat me.
If you're having nightmares you might need to talk to someone to clear your mind. Maybe find other ways to occupy your mind as well as work on ways to improve your sleep.