How to auto indent and collapse source code in Dreamweaver

I keep forgetting where and how to find this feature. Turns out the Command menu gives us such features:

Screen Shot 2013-11-15 at 09.58.24

  • Commands – Apply Source Formatting (to Selection)

Applies the correct indentations to the entire file, or your selection only. It’s the equivalent of Xcode’s “Editor – Structure – Re-Indent”.

To manually move blocks of code, select the lines that need to be shifted, then hold down OPTION + CMD and press the square brackets to indent and outdent respectively. Not sure what these keys are on Windows.

Collapsing Code

On this note, it is also possible to collapse code that you don’t want to look at. It’s not as easy as using Xcode’s method collapse option. In Dreamweaver, you select the code you want to collapse, then hit one of the little triangles that appears on the left hand side.

Selected but uncollapsed code

Selected but uncollapsed code

Click on the triangle to collapse/uncollapse

Click on the triangle to collapse/expand





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.