Sublime Forum

HTML tab indent problem

#1

I have an annoying bug(?) in Sublime Text 2. When typing out an html closing tag and hitting return to knock it onto the next line Sublime Text doesn’t maintain the correct tab indent. The tab indent is always one less than it should be.

I created a video demo here: http://www.youtube.com/watch?v=vDllGEdIupU)

Any ideas why it is doing this, anyone experiencing similar issues?

Example image:

0 Likes

#2

I couldn’t replicate this issue. However, I would recommend you to make use of Zen Coding or the tab completion feature (added in build 2165). A Sublime user should not have to type closing tags. :wink:

0 Likes

#3

Ok. I think I figured out what’s causing the problem. I was having the same issue. Remove the html5 package. It’s the culprit. Perhaps you could report this to the author of the plugin. Remove it through the package control and restart. In my case there was a file still left under the user area of the packages directory. Once I killed it the indent glitch disappeared.

0 Likes

#4

Yeeeeeeeeeah!!

Thank you so much. Ditched the HTML5 package, restarted, voila!

Problem fixed.

0 Likes

#5

No worries. I was having the same problem and it wasn’t happening on the usb key install. So I figured it must be a package causing the problem. It was very annoying.

0 Likes

#6

Guys, I’m having a similar problem. To start with, let me tell you I’m using the 2165 build.

My issue has to do with pressing the tab keyboard-button to make the zen coding work. Say if I simply type inhtml then followed by tab the zen coding won’t work. Normally, it’s supposed to give me this when “html”+tab is pressed -

<html>
<head>
	<title></title>
</head>
<body>

</body>
</html>

But weird enough I’d admit it that it works randomly though should I press the tab twice or thrice. The count to press the tab key isn’t fixed as sometimes pressing tab key once - it works, or most of the times pressing the zen coding effect would be rendered only after having pressed the tab key twice.

I’m wondering if that’s rather being caused due to some conflict? I’ve installed zen coding through winbond’s package but now I am reading on this post that

So could it be just that the 2165 build already comes with its own zen coding plugins and hence by installing another copy, manually through winbond’s package - this could be causing this conflict?

In earlier builds, this wasn’t really a problem. So maybe conversely there’s actually a bug (that’s yet to be identified and fixed) in this current 2165 build?

0 Likes

#7

Try disabling the packages using the package disable feature and see if that solves the issue. If you have the html5 package installed that’s probably the issue.

0 Likes

#8

@amdtek Did you setup the TAB completion for Zen Coding yourself? Afaik Zen Coding is default triggered by CTRL+ALT+Enter (which opens an input line to enter your “zen coding haiku”).
Evenmore, the TAB completion in build 2165 is not enabled by default (see: sublimetext.com/docs/2/auto_complete.html).
On the other hand, ST2 knows the concept of “tab triggers” that are used by code snippets.

Are you sure you were using Zen Coding? ST2 comes with some default snippets like “html”, but doesn’t know how to handle zen coding input like:

div#test>ul>li.test-$*8>a{bla$}
0 Likes

#9

@philosopherdog

Of course I removed my html5 package asap I read it could be one of the reasons for conflicts. Otherwise, I don’t think the little packages that I have currently must be the root cause(s) for my tab & zencoding problem. Still, here’s the list of packages that I am having so far -

Camaleon
CSS Less(fish)
Dogs Color Scheme
ElasticTabStops
Indent XML
PhpBeautifier
Theme - Soda
SublimeCodeIntel
Zenburn
ZenCoding

@ludder

No. But now when I checked the settings under Preferences > File Settings Default, I saw that the auto_complete feature was set to true. I am providing a dump for your convenience below:

In the earlier builds (say 2160), if I were to perform any zencoding haiku, then followed by TAB key at the end, then it would be executing it. I’ve kind of got used with successing the haiku with the TAB key as it’s very fast. I know about the CTRL+ALT+Enter too but this one is mostly used to modify in between lines of codes. Say if you wanted to wrap a certain lines, I would use **CTRL+ALT+Enter **for this. Otherwise simple zencoding like the one provided by you below, I was able to perform those command and by ending it with the TAB key. Now it doesn’t work. Sometimes I have to press TAB key more than once, sometimes twice or even thrice.

[quote=“ludder”]Evenmore, the TAB completion in build 2165 is not enabled by default (see: sublimetext.com/docs/2/auto_complete.html).
On the other hand, ST2 knows the concept of “tab triggers” that are used by code snippets.[/quote]

It seems to be enabled (i.e. set to ‘true’) here by default on my ST2. Look out for the same in the dump above for more details. BTW, can you throw some light by providing some examples between how different is a code snippet (and how it is utilized) in ST2 in contrast to zen coding? I mean based from what you are saying, both are somehow very similar. Hence I am placing the request to you to kindly clarify that to me.

[quote=“ludder”]Are you sure you were using Zen Coding? ST2 comes with some default snippets like “html”, but doesn’t know how to handle zen coding input like:

div#test>ul>li.test-$*8>a{bla$}

Of course that’s Zen coding, I mean the above code you have provided is Zen Coding code, right? I recall I’ve tried something similar to that (followed by the tab key I pressed only once) in the earlier build (2160) and it worked like a charm. But now I have been trying to enter similar zen coding codes followed by the TAB key but it just wouldn’t work all the times. Or, wait here, did you mean something different by snippet?

0 Likes

#10

Sorry I don’t have a specific solution, but I would start by disabling all plugins to see if that solves it. Then enable one by one. One thing off hand is you don’t need SublimeCodeIntel since that feature is now built in. Also I have had issues with phpbeautifier. Sorry I can’t be of more specific assistance.

0 Likes