A decent text editor will also fix indentation for you. In vim, select the code block you're working with, and press =