Indenting multiple lines of code

A feature we have had in the development environment for a while now is the ability to indent multiple lines of code at once instead of one line at a time.

Generally it is recommended we try and keep your functions small and well structured (under 20 lines of code where possible), but this is still extremely handy when you are writing or restructuring code. Indenting 20 lines takes about 80 key strokes if you do them one at a time and only indent those 2 spaces.

From time to time I notice that some developers are unaware of the feature, so here is a little short blog on how it works.

If you have a few lines of code you would like to indent you can mark them by holding the <shift> down and pushing <Arrow up> or <Arrow down>

Now if you click TAB the codes indents in increments of 2 spaces from the left edge.

And you can click SHIFT + TAB to move the code to the left. Left is done 1 space at a time.

Enjoy.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s