I\'m trying to use the auto-indentation feature in Sublime Text 3 for HTML. I\'ve got some block comments in the html and selecting Edit>Line>Reindent works until it hits a bloc
I have logged the issue here: https://github.com/SublimeTextIssues/Core/issues/1271
The reason for this behavior is because Sublime Text, by default, is set to preserve the indentation of comments. To disable this:
Package Control: Install Package
PackageResourceViewer
PRV: O
PackageResourceViewer: Open Resource
Default
Indentation Rules - Comments.tmPreferences
under preserveIndent
to
Reindentation will now work correctly with comments.
I would also recommend to edit the HTML indentation rules to ignore comments, so that it doesn't change indentation based on tags in comments. i.e. otherwise
Testing Indent
Cell 1
Cell 2
would become:
Testing Indent
Cell 1
Cell 2
To do this:
PRV: O
PackageResourceViewer: Open Resource
HTML
Miscellaneous.tmPreferences
Change
scope
text.html
to
scope
text.html - comment
and
|-->
to
(?#|-->)
(this comments out the closing comment regex)
However, when the next release of ST3 is available, it might be a good idea to then delete your overrides, in case it is fixed properly. This way, you will continue to get updates to these files, otherwise you will be stuck with the versions you have saved. To do this:
Preferences
-> Browse Packages
HTML
folderDefault
folder and delete the Indentation Rules - Comments.tmPreferences
fileIf the problem wasn't fixed in the next build, you can simply recreate these changes.