Reputation: 51
I successfully installed Emmet via Package Control.
ul
and press Tab, I get <ul></ul>
.ul.class
and press Tab, I get ul.body_class
but I want it to generate <ul class="class"></ul>
.What am I doing wrong?
I have read posts saying to try Ctl+E instead of Tab as the trigger key, but that doesn't do anything.
Upvotes: 3
Views: 10861
Reputation: 419
I will have shared this as a comment directly where I feel like but 50 reps was required. Any ways. Here is what I did that made mine work for me.
From @saadq's answer, do this: [ //other user key bindings should be here, followed by
{"keys": ["tab"], "args": {"action": "expand_abbreviation"}, "command": "run_emmet_action", "context": [{"key": "emmet_action_enabled.expand_abbreviation"}]}
]
The point is to have other bindings appear before it so that whatever binding overwriting it will be overwritten again.
Upvotes: 1
Reputation: 159
I check the emmet default key is ctrl+e
, so I add this to my Key Bindings - User
:
{"keys": ["tab"], "args": {"action": "expand_abbreviation"}, "command": "run_emmet_action", "context": [{"key": "emmet_action_enabled.expand_abbreviation"}]}
Upvotes: 1
Reputation: 1593
I was facing same issue. Just pasted the below code in "Preferences -> Key Bindings — User:".
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
"operand": "SCOPE_SELECTOR",
"operator": "equal",
"match_all": true,
"key": "selector"
},
// run only if there's no selected text
{
"match_all": true,
"key": "selection_empty"
},
// don't work if there are active tabstops
{
"operator": "equal",
"operand": false,
"match_all": true,
"key": "has_next_field"
},
// don't work if completion popup is visible and you
// want to insert completion with Tab. If you want to
// expand Emmet with Tab even if popup is visible --
// remove this section
{
"operand": false,
"operator": "equal",
"match_all": true,
"key": "auto_complete_visible"
},
{
"match_all": true,
"key": "is_abbreviation"
}
]
}
Github: See for more description
Upvotes: 1
Reputation: 31
After reading your question, I installed Emmet in the Windows version of Sublime Text 3 today and had the same problem. Within my search for the solution, I found the following:
http://docs.emmet.io/actions/expand-abbreviation/#comment-1272517661
In Windows I opened the Default Emmet Preferences. By going to:
Preferences > Package Settings > Emmet > Setting - Default and Preferences > Package Settings > Emmet > Key Bindings - Default
As I was closing the settings files, I was prompted to save the setting files. I clicked OK to save and then restarted Sublime Text 3.
After Sublime Text 3 reloaded:
I created a new html file and was able to type ul.class
, tabbed and it expanded to <ul class></ul>
It was funny, I never ran into that problem with Sublime on my Mac. If you had to do the same process on Mac, you go to Preferences > Package Settings > Emmet ...
Upvotes: 3
Reputation: 53969
Try using Ctrl+Space instead. If that doesn't work, you can try changing the keybinding by putting the following in your User key bindings file which can be found by doing Preferences -> Key Bindings — User:
[
{"keys": ["tab"], "args": {"action": "expand_abbreviation"}, "command": "run_emmet_action", "context": [{"key": "emmet_action_enabled.expand_abbreviation"}]}
]
and then just change "tab"
to whatever keybinding you want. Check to see if that works.
Upvotes: 8