8

im wondering if there is any Sublime Text 3 plugin besides HTML Tidy which is able to reindent or reformat parts of HTML Code

Mik
  • 1,705
  • 1
  • 14
  • 26
  • Potential solutions discussing sublime text 2, but i doubt that the functionality has changed very much: http://stackoverflow.com/questions/8839753/how-do-i-reformat-html-code-using-sublime-text-2 – lizz Feb 11 '14 at 21:12

2 Answers2

36

Thanks a lot for your answer, but i found a nice, built in approach of sublime text. Just select everything (CTRL + a (Windows) or CMD + a (Mac) and click this in the menu

Edit → Line → Reindent

maybe this helps also others

EDIT(2017): You can also use key combination (without need for mouse)

CTRL + SHIFT + P (Windows)
CMD + SHIFT + P (Mac)

then type 'Reindent' and select the fist option 'Indentation: Reindent Lines'

Mik
  • 1,705
  • 1
  • 14
  • 26
7

Check out HTML-CSS-JS Prettify. It requires nodejs be installed and in your PATH, but once you get that set up properly it works great. Make sure you read all of the docs, though.

MattDMo
  • 100,794
  • 21
  • 241
  • 231