Skip to content

Instantly share code, notes, and snippets.

@Chun-Yang
Created June 10, 2014 20:07
Show Gist options
  • Select an option

  • Save Chun-Yang/4564721096a44aaae684 to your computer and use it in GitHub Desktop.

Select an option

Save Chun-Yang/4564721096a44aaae684 to your computer and use it in GitHub Desktop.
sublime key bindings mac
[
// -------------------------------------------------------------------------
// Auto-complete behaviour for ), ], '', ""
// Bind to <tab> to step over the auto-completed character(s)
// -------------------------------------------------------------------------
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true},
"context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)\\]'\"]", "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "[(['\"]", "match_all": true },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
},
// automatic indentation
{ "keys": ["super+i"], "command": "reindent" },
// Auto-pair curly brackets
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{ $0 }"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "source.ruby" }
]
},
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{${0:$SELECTION}}"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
{ "keys": ["}"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }
]
},
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment