Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indentation shortcuts in Visual Studio

People also ask

How do I show indentation in visual studio?

In VS 2010 it is ctrl +k +d for indentation. and click on General if is not selected automatically. Then, in the last section of the window named “ Display ”, enable the Line Numbers checkbox .

How do I indent shortcuts?

This shortcut increases the indent in a cell by one step each time it is used. On Windows, you can sometimes use Ctrl+Alt+Tab to indent and Ctrl+Alt+Shift+Tab to un-indent.


Tab and Shift+Tab will do that.

Another cool trick is holding down ALT when you select text, it will allow you to make a square selection. Starting with VS2010, you can start typing and it will replace the contents of your square selection with what you type. Absolutely awesome for changing a bunch of lines at once.


Ctrl-K, Ctrl-D

Will just prettify the entire document. Saves a lot of messing about, compared to delphi.

Make sure to remove all indents by first selecting everything with Ctrl+A then press Shift+Tab repeatedly until everything is aligned to the left. After you do that Ctrl+K, Ctrl+D will work the way you want them to.

You could also do the same but only to a selection of code by highlighting the block of code you want to realign, aligning it to the left side (Shift+Tab) and then after making sure you've selected the code you want to realign press Ctrl+K, Ctrl+F or just right click the highlighted code and select "Format Selection".


If you would like nicely auto-formatted code. Try CTRL + A + K + F. While holding down CTRL hit a, then k, then f.


Tab to tab right, shift-tab to tab left.