How long ago was the surgery? What kind of repair did they do? Was he doing this before the injury occurred? How long has the behavior going on relative to the other events?
These things can be horribly painful, and even a slight motion could be setting him off. You should definitely talk to your vet and see if they can suggest anything. Perhaps further evaluation and/or pain medication is in order.
I don't think you can "train" him to give more warning...Cats don't work like that.