After Paste, how do you realign script?

After pasting codes, how do you realign the scripts, I keep having to go and press return, move up delete empty space, next line press return, move up, and delete empty space, unless I feel comfortable and I can just use the backspace key to align. It is easier to read if its properly aligned. Using Unity’s MonoDevelop. I like to select all and there should be some command that says realign or something.

Select code that needs to be aligned, then press tab to indent to the right and shift+tab to indent to the left.

In MonoDevelop there is a menu option (you can also add a key binding in the preferences):

Edit->Format->Format document

Unfortunately this will also change things like line spacing, where the opening parenthesis goes etc. But it will indent all of your code correctly.

Another option could be to copy the text to another editor, format, then copy back.