Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-indent Between Tags in Brackets

Typing <html> automatically creates </html> after your cursor in Brackets:

But when you press enter it just puts the closing tag on the next line:

To begin adding code I need to press (enter * 2), up arrow, tab (too many steps).


How can I do this automatically so that pressing enter results in:

Couldn't find an extension that does this.

This works natively in CSS, why not in HTML?

like image 296
JBallin Avatar asked Oct 18 '22 01:10

JBallin


1 Answers

UPDATE: arsakasra's comment works really well!

Press enter followed by (CMD on Mac or CTRL on PC) + shift + enter


I've been playing around with the preferences and added the following to my brackets.json file (access in Menu Bar: Debug: "Open Preferences File").

"closeTags": {
    "dontCloseTags": ["br", "hr", "img", "input", "link", "meta", "area", "base", "col", "command", "embed", "keygen", "param", "source", "track", "wbr"],
    "indentTags": ["ul", "ol", "div", "section", "table", "tr"],
    }
  • dontCloseTags are tags such as <br> which shouldn't be closed.
  • indentTags are tags that you want to automatically create a new indented line - add more as needed!
  • (any tags that aren't in above arrays will self-close on the same line)
like image 199
JBallin Avatar answered Oct 21 '22 08:10

JBallin