Some colleagues just drive us nuts. It's the things they say or do or how they talk to us. It's not even one single thing that can be summarize a difficult colleague. You mentioned several things that you find difficult to deal with.
Everything is a matter of perception
The first thing that we have to keep in mind when confronted with a difficult colleague, is that everything is a matter of perception and everything can be reframed. If you take someone who you would say is very critical or always complaining, keep in mind that someone else might find the person has an eye for the details or is very quality driven.
Practicing to see the other side of things - according to the development square by Schulz von Thun - can be a good way to start seeing the grey between the black and white.
To learn how to deal with someone who is attacking or shouting at you, it's best to have a strategy that you iteratively adjust.
Don't get emotional
Don't put emotions into a situation that you don't want to escalate. Make sure to find some excuse that allows you to leave the situation or get back to the person later on. So let's say a colleague tells you 5 minutes before you will present the project plan to your boss that he already made a better proposal yesterday and forgot to tell you. Don't explode, stay professional, suck it up for now. You can talk to the person later, when you have obviously rational arguments for why that was totally inacceptable.
If there is something that drives you completely nuts about someone, question yourself if it's something in your perception that might be perceiving you. There are some things that you might project onto others: Maybe the person reminds you of your ex-partner and by now you hate that person. Or you are a person that feels criticized easily and everything you hear from that person is criticism - that might have nothing to do with what the person is actually trying to communicate. Check with other people how they perceive the person and reflect on yours. On top of that, start focusing on the positive things and strengths of the person. The halo effect might just ruin the person to you.
Talk to the person
Don't talk behind her / his back but approach the person directly. If you start bitching about the person it's not fair play anymore and will eventually backfire on you anyways. Seek the conversation and try to follow the steps for negative feedback. Keep it on the objective level and use 'I messages'.
Keep your distance...
... if all the rest has not been working. That doesn't mean that you have to avoid the person completely - schedule the relevant and important meetings. Don't have unnecessary conversations about private life and don't pretend to be best friends with him / her.
How to handle attacks
If you feel attacked in a meeting or personal conversation, it's also good to be prepared and have a strategy for it. There are some killer phrases people are using to make you shut up or turn down your idea within a second. That would be something such as "We have to do it like that. The customer wants it that way." or "That doesn't make any sense." Try to find out what the person really wants to tell you with that and don't feel intimidated. Your answer could be something like "What exactly does the customer want. How did you find out about it? How big is the data base?" etc.
On top of that, it's good to have one sentence prepared how to handle an attack. You could be using a sentence that confuses the other person e.g. "Look at that." or "Oh well." and buys you some time. Or you can start out with something that build up a bridge to your actual reply - "Oh that sounds interesting, let me think about it." this one also buys you some time to come up with an answer.