Here is an even more useful snippet I’ve used million times in E-texteditor:
<div${1: id="${2}"}${3: class="${4}"}>
$0
</div>
which resembles to this:
<div id="" class="">
</div>
Basically what this means is that I always have my divs with either a class or an id.
In E-texteditor:
The key sequence for div with id is: div, Tab, Tab, write the id, Tab, Del, Tab - continue with the div’s content.
The key sequence for div with class is: div, Tab, Del, Tab, Tab, write the class, Tab - continue with the div’s content.
In Sublime Text 2:
The key sequence for div with id is: div, Tab, Tab, write the id, Tab, Del, Tab, Tab - continue with the div’s content.
The key sequence for div with class is: div, Tab, Del, Tab, Tab, Tab, write the class, Tab - continue with the div’s content.
Now if I have to execute this snippet +200 times a day, it hurts not only my performance but my nerves too.
In other words I really like Sublime Text 2 and I use it a lot but I never use it when I’m slicing (working). And this is one of the major bugs preventing me from switching to Sublime and actually buy it. It’s a bug because it has no point to have a blank tab hit for something that is already deleted.
I hope someone will answer and give me a direction how can I fix this behaviour.
Here is the entire snippet:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>m2k-div</string>
<key>uuid</key>
<string>A73D3916-DED9-4BDD-95EC-73C6383583D5</string>
<key>tabTrigger</key>
<string>div</string>
<key>content</key>
<string><div${1: id="${2}"}${3: class="${4}"}>
$0
</div></string>
<key>scope</key>
<string>text.html</string>
</dict>
</plist>