Skip to main content
KCDOT.ac
Known Participant
January 21, 2017
Answered

How to stop Dreamweaver 2017 from indenting my code

  • January 21, 2017
  • 1 reply
  • 6411 views

I have gone to Code View Options and unchecked Auto Indent, but Dreamweaver still indents my code as I am typing it. It's driving me nuts and wasting time as I have to correct all those unwanted indents.

I've also gone under Edit / Preferences / Code Format and unchecked Indent, to no avail.

Any assistance will be greatly appreciated.

This topic has been closed for replies.
Correct answer Jon Fritz

Thank you for this, but even this does not work because if I set something to be "format only and not indented," when I type the closing tag it un-indents itself. Isn't there some way I can set Dreamweaver to just leave the indenting up to me? And NOT move my code around, ever?


The Brackets engine in DW has a separate rule for tabs/indenting that currently can't be changed in the preferences interface.

While Apply Source Formatting will set your tabs to whatever you've defined in the Tag Libraries, the program will continue to plop tabs in when it feels they're necessary while hand-coding.

You can turn that off though, it just takes a little more effort. You can add a small snip of code to the brackets.json file to fix it...

1. Go to C: > Users > your user name >  AppData (make sure hidden files are turned on if you don't see this folder) > Roaming > Adobe > Dreamweaver CC 2017 > your language > Configuration > Brackets > brackets.json

2. (make a back-up first so you can go back if you goof) Open the file in something other than DW

3. Add a comma to the last item on the list, then add the following to the end of the file, before the } ...

"smartIndent" : false

(make sure the "i" in Indent is capitalized)

3. Save and open DW

That should nuke the Brackets auto-indentation

1 reply

Nancy OShea
Community Expert
Community Expert
January 21, 2017

Hit Apply Source Formatting. 

You'll find it on the Common (vertical) Toolbar as shown below.

Nancy

Nancy O'Shea— Product User & Community Expert
KCDOT.ac
KCDOT.acAuthor
Known Participant
January 23, 2017

Thank you but this seems to remove ALL indents from the code, moving everything back to the left-hand margin. As I continue to work on the page, new code still auto-indents.

I use indents, but I use them in the way that works best for me - and it's different from the way Dreamweaver does them. I want to be able to either pre-program or manually enter my own indents, and keep Dreamweaver from changing them.

Is there a way to do that?

Nancy OShea
Community Expert
Community Expert
January 23, 2017

KCDOT.ac wrote:

Thank you but this seems to remove ALL indents from the code, moving everything back to the left-hand margin. As I continue to work on the page, new code still auto-indents.

I use indents, but I use them in the way that works best for me - and it's different from the way Dreamweaver does them. I want to be able to either pre-program or manually enter my own indents, and keep Dreamweaver from changing them.

Is there a way to do that?

Personally, I am no fan of indented code. But if you want your code indented you must define it first in Tag Libraries -- either globally or for each tag.   Once your formatting is defined, hit Apply to save.  Then use the Apply Source Formatting button.   Since I use this quite a bit, I have a keyboard shortcut for it.

Nancy

Nancy O'Shea— Product User & Community Expert