Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically indent source code?

People also ask

What is the fastest way to indent a code?

Indenting once with the tab key means just pressing the tab key once. Indenting once with the space bar means pressing the space bar 4 times.

How do I indent a python code automatically?

Use the reindent.py script that you find in the Tools/scripts/ directory of your Python installation: Change Python (. py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files.


Ctrl+E, D - Format whole doc
Ctrl+K, Ctrl+F - Format selection

Also available in the menu via Edit|Advanced.

Thomas

Edit-
Ctrl+K, Ctrl+D - Format whole doc in VS 2010


In 2010 it is Ctrl+k, Ctrl+d. See image below.

enter image description here


In Visual Studio 2010

Ctrl +k +d indent the complete page.

Ctrl +k +f indent the selected Code.

For more help visit : http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx

every thing is there.


In 2010 it is ctrl +k +d for indentation


Also, there's the handy little "increase indent" and "decrease indent" buttons. If you highlight a block of code and click those buttons the entire block will indent.