Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created July 9, 2025 19:18
Show Gist options
  • Save james2doyle/d777c699a7971377b5d9a288f12080e4 to your computer and use it in GitHub Desktop.
Save james2doyle/d777c699a7971377b5d9a288f12080e4 to your computer and use it in GitHub Desktop.
An example of a complex keybinding in Sublime Text. This example shows you can "press [key] when selecting text to wrap it in template echo tags and a variable"
[
// press $ when selecting text to wrap it in blade echo tags and a variable
{
"keys": [
"$"
],
"command": "insert_snippet",
"args": {
"contents": "{{ \\$${0:$SELECTION} }}"
},
"context": [
{
"key": "selector",
"operator": "equal",
"operand": "text.html.blade",
"match_all": true
},
{
"key": "setting.auto_match_enabled",
"operator": "equal",
"operand": true
},
{
"key": "selection_empty",
"operator": "equal",
"operand": false,
"match_all": true
}
]
},
// press ! when selecting text to wrap it in blade raw echo tags and a variable
{
"keys": [
"!"
],
"command": "insert_snippet",
"args": {
"contents": "{!! \\$${0:$SELECTION} !!}"
},
"context": [
{
"key": "selector",
"operator": "equal",
"operand": "text.html.blade",
"match_all": true
},
{
"key": "setting.auto_match_enabled",
"operator": "equal",
"operand": true
},
{
"key": "selection_empty",
"operator": "equal",
"operand": false,
"match_all": true
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment