Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just started using Sublime Text 3. I noticed an annoying auto un-indent that happens when writing HTML and I can't figure out how to prevent it.

Any time I write html like this:

<div class="myclass">

</div>

And then follow it up by moving my cursor in between the open and closing div, it auto indents correctly and places the cursor one indent into the tag block like this (imagine the pipe character is the cursor):

<div class="myclass">
    |
</div>

But then as soon as I type the opening bracket for the nested element, the cursor jumps back one indent space like this (again, the pipe character is the cursor):

<div class="myclass">
<|
</div>

I can't figure out what setting is causing this or how to prevent it. The only plugin I've installed is SFTP and Package Control. Is this a beta bug or is there some setting that's causing this un-indenting?

share|improve this question
1  
Have you considered reporting a bug? It's beta software… I don't have any other explanation. –  slhck Sep 6 '13 at 13:40
    
I'll submit it. Just wanted to make sure that it was actually a bug. –  Ben Sep 6 '13 at 13:44
    
It may be worth trying the other versions to see if it is simply limited to 3. You have the option of dev or obviously the current stable version, 2. FWIW, I don't have that issue in Sublime3 on *Nix x64. –  nerdwaller Sep 6 '13 at 13:54
    
I used Sublime Text 2 and never had the issue. I'm on Windows 7 and 8. Happens on both. –  Ben Sep 6 '13 at 14:39
    
I can't figure out how to submit an issue on Sublime Text's website. I see there is a support section, but it seems to be down at the moment. Is that were bugs are supposed to be reported? –  Ben Sep 6 '13 at 14:40

1 Answer 1

up vote 2 down vote accepted

I can reproduce this on OSX using the latest build 3053 when I type the opening div, hit Enter twice, close the div, go back up a line, and hit Tab to position the cursor for another tag. However, there is a way around it: type the first div element, then immediately type </ and the tag will auto-close. Move your cursor back between the opening and closing tag, and hit Enter. You'll end up with your cursor like so:

<div class="myclass">
    |
</div>

and you can start typing another tag without the problematic behavior occurring - Sublime takes care of the auto-indenting for you. Besides, I like to close my tags as soon as I open them, just so I don't forget - I'm easily distracted :) However, once your cursor is indented, don't hit Backspace and then Tab again, or the same problem will happen.

No, I don't know where to report a bug for the beta, except by posting in the forum. It was down for me too the other day, but it seems to be working as I write this. I just posted the bug, so hopefully somebody can do something about it.

Happy coding!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.