forked from Shopify/liquid-tmbundle
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{ | ||
"caption": "Preferences: Liquid Key Bindings", | ||
"command": "edit_settings", | ||
"args": { | ||
"base_file": "${packages}/Liquid/Default.sublime-keymap", | ||
"user_file": "${packages}/User/Default ($platform).sublime-keymap", | ||
"default": "[\n\t${0}\n]\n" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
[ | ||
// Auto-pair braces also in front of , : ; so starting embeddings in CSS properties and values works well. | ||
|
||
{ | ||
"keys": ["{"], | ||
"command": "insert_snippet", | ||
"args": { | ||
"contents": "{$0}" | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.template.liquid - meta.embedded.liquid - meta.interpolation.liquid - meta.template.liquid string" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "selection_empty", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:[ \t\\)\\]\\},:;]|$)", "match_all": true } | ||
] | ||
}, | ||
|
||
// Auto-pair braces also in front of closing ' and " in strings | ||
|
||
{ | ||
"keys": ["{"], | ||
"command": "insert_snippet", | ||
"args": { | ||
"contents": "{$0}" | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.template.liquid string" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "selection_empty", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:[ \t\\)\\]\\}\"',:;]|$)", "match_all": true } | ||
] | ||
}, | ||
|
||
// Bindings for inserting and removing statement block. | ||
|
||
// Expand {|} to {% | %} when % is pressed | ||
{ | ||
"keys": ["%"], | ||
"command": "insert_snippet", | ||
"args": { | ||
"contents": "% ${0} %" | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.template.liquid - meta.embedded.liquid - meta.interpolation.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^}", "match_all": true } | ||
] | ||
}, | ||
// Reduce {%|%} to | when backspace is pressed | ||
{ | ||
"keys": ["backspace"], | ||
"command": "chain", | ||
"args": { | ||
"commands": [ | ||
{"command": "left_delete" }, | ||
{"command": "right_delete" }, | ||
{"command": "left_delete" }, | ||
{"command": "right_delete" } | ||
] | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.embedded.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "selection_empty", "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{%$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^%}", "match_all": true } | ||
] | ||
}, | ||
// Expand {%|%} to {% | %} when space is pressed | ||
{ | ||
"keys": [" "], | ||
"command": "insert_snippet", | ||
"args": { | ||
"contents": " ${0} " | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.embedded.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{%$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^%}", "match_all": true } | ||
] | ||
}, | ||
// Reduce {% | %} to {%|%} when backspace is pressed | ||
{ | ||
"keys": ["backspace"], | ||
"command": "chain", | ||
"args": { | ||
"commands": [ | ||
{"command": "left_delete" }, | ||
{"command": "right_delete" } | ||
] | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.embedded.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "selection_empty", "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{% $", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^ %}", "match_all": true } | ||
] | ||
}, | ||
|
||
// Bindings for inserting and removing expression block. | ||
|
||
// Expand {|} to {{ | }} when { is pressed | ||
{ | ||
"keys": ["{"], | ||
"command": "insert_snippet", | ||
"args": { | ||
"contents": "{ ${0} }" | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.template.liquid - meta.embedded.liquid - meta.interpolation.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^}", "match_all": true } | ||
] | ||
}, | ||
// Reduce {{|}} to | when backspace is pressed | ||
{ | ||
"keys": ["backspace"], | ||
"command": "chain", | ||
"args": { | ||
"commands": [ | ||
{"command": "left_delete" }, | ||
{"command": "right_delete" }, | ||
{"command": "left_delete" }, | ||
{"command": "right_delete" } | ||
] | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.interpolation.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "selection_empty", "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{{$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^}}", "match_all": true } | ||
] | ||
}, | ||
// Expand {{|}} to {{ | }} when space is pressed | ||
{ | ||
"keys": [" "], | ||
"command": "insert_snippet", | ||
"args": { | ||
"contents": " ${0} " | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.interpolation.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{{$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^}}", "match_all": true } | ||
] | ||
}, | ||
// Reduce {{ | }} to {{|}} when backspace is pressed | ||
{ | ||
"keys": ["backspace"], | ||
"command": "chain", | ||
"args": { | ||
"commands": [ | ||
{"command": "left_delete" }, | ||
{"command": "right_delete" } | ||
] | ||
}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.interpolation.liquid" }, | ||
{ "key": "setting.auto_match_enabled" }, | ||
{ "key": "selection_empty", "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "{{ $", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^ }}", "match_all": true } | ||
] | ||
}, | ||
{ | ||
"keys": ["enter"], | ||
"command": "run_macro_file", | ||
"args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, | ||
"context": [ | ||
{ "key": "selector", "operand": "meta.template.liquid - source.liquid, meta.embedded.liquid punctuation.section.embedded.begin" }, | ||
{ "key": "setting.auto_indent", "operator": "equal", "operand": true }, | ||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "%\\}\\s*$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\{%", "match_all": true } | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[ | ||
{ | ||
"id": "preferences", | ||
"children": [ | ||
{ | ||
"caption": "Package Settings", | ||
"mnemonic": "P", | ||
"id": "package-settings", | ||
"children": [ | ||
{ | ||
"caption": "Liquid", | ||
"children": [ | ||
{ | ||
"caption": "Key Bindings", | ||
"command": "edit_settings", | ||
"args": { | ||
"base_file": "${packages}/Liquid/Default.sublime-keymap", | ||
"user_file": "${packages}/User/Default ($platform).sublime-keymap", | ||
"default": "[\n\t${0}\n]\n" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |