Skip to content

Instantly share code, notes, and snippets.

@catwell
Created August 12, 2019 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save catwell/2dce7a87bed9140d9d107dfc0e3a2182 to your computer and use it in GitHub Desktop.
Save catwell/2dce7a87bed9140d9d107dfc0e3a2182 to your computer and use it in GitHub Desktop.
Enable Emmet and tag auto-close in Sublime Text
[
{
"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": "meta.block.tsx, source.tsx, source.jsx, meta.group.braces.round.js, text.html",
"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"
}
]
},
// HTML, XML close tag
{ "keys": ["/"], "command": "close_tag", "args": { "insert_slash": true }, "context":
[
{ "key": "selector", "operator": "equal", "operand": "(meta.block.tsx, source.tsx, source.jsx, meta.group.braces.round.js, text.html, text.xml) - string - comment", "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": ".*<$", "match_all": true },
{ "key": "setting.auto_close_tags" }
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment