Skip to content

Instantly share code, notes, and snippets.

@Jimbly
Last active August 29, 2015 13:55
Show Gist options
  • Save Jimbly/8722200 to your computer and use it in GitHub Desktop.
Save Jimbly/8722200 to your computer and use it in GitHub Desktop.
Jimbly's Sublime config snapshot
[
// Rebind mac to be like windows
{ "keys": ["ctrl+n"], "command": "new_file" },
{ "keys": ["ctrl+s"], "command": "save" },
{ "keys": ["ctrl+shift+s"], "command": "prompt_save_as" },
{ "keys": ["ctrl+alt+s"], "command": "save_all" },
{ "keys": ["ctrl+f4"], "command": "close" },
{ "keys": ["ctrl+z"], "command": "undo" },
{ "keys": ["ctrl+shift+z"], "command": "redo" },
{ "keys": ["ctrl+y"], "command": "redo_or_repeat" },
{ "keys": ["ctrl+u"], "command": "soft_undo" },
{ "keys": ["ctrl+shift+u"], "command": "soft_redo" },
{ "keys": ["ctrl+x"], "command": "cut" },
{ "keys": ["ctrl+c"], "command": "copy" },
{ "keys": ["ctrl+v"], "command": "paste" },
{ "keys": ["ctrl+shift+v"], "command": "paste_from_history" },
{ "keys": ["ctrl+a"], "command": "select_all" },
{ "keys": ["ctrl+]"], "command": "indent" },
{ "keys": ["ctrl+["], "command": "unindent" },
{ "keys": ["ctrl+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+k", "ctrl+d"], "command": "find_under_expand_skip" },
{ "keys": ["ctrl+alt+."], "command": "close_tag" },
{ "keys": ["ctrl+p"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+shift+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} },
{ "keys": ["ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["alt+left"], "command": "jump_back" },
{ "keys": ["alt+right"], "command": "jump_forward" },
{ "keys": ["f3"], "command": "find_under" },
{ "keys": ["shift+f3"], "command": "find_under_prev" },
{ "keys": ["ctrl+j"], "command": "join_lines" },
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof", "extend": false} },
{ "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof", "extend": false} },
{ "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true} },
{ "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} },
// Begin shared keybinds
// Record quick macro is Ctrl+q, play is Ctrl+shift+q
// Brace matching is Ctrl+m
// Comment selection on /
{ "keys": ["/"], "command": "toggle_comment", "args": { "block": false }, "context":
[
{ "key": "selection_empty", "operator": "not_equal", "operand": true, "match_all": true }
]
},
{ "keys": ["*"], "command": "toggle_comment", "args": { "block": true }, "context":
[
{ "key": "selection_empty", "operator": "not_equal", "operand": true, "match_all": true }
]
},
{ "keys": ["ctrl+shift+v"], "command": "paste_from_history" },
{ "keys": ["ctrl+shift+b"], "command": "build" },
{ "keys": ["ctrl+shift+t"], "command": "transpose_word" },
{ "keys": ["ctrl+t"], "command": "transpose_char" },
{ "keys": ["alt+p"], "command": "next_view_in_stack" },
{ "keys": ["shift+alt+p"], "command": "prev_view_in_stack" },
{ "keys": ["ctrl+i"], "command": "show_panel", "args": {"panel": "find", "reverse":false, "whole_word":false, "case_sensitive":false} },
{ "keys": ["ctrl+o"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["alt+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
//{ "keys": ["ctrl+d"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
//{ "keys": ["ctrl+shift+d"], "command": "show_overlay", "args": {"overlay": "goto", "text": "#"} },
{ "keys": ["alt+h"], "command": "move", "args": {"by": "characters", "forward": false} },
{ "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true} },
{ "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": false} },
{ "keys": ["alt+j"], "command": "move", "args": {"by": "lines", "forward": true} },
{ "keys": ["shift+alt+h"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true} },
{ "keys": ["shift+alt+l"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true} },
{ "keys": ["shift+alt+k"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true} },
{ "keys": ["shift+alt+j"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true} },
{ "keys": ["ctrl+alt+h"], "command": "move", "args": {"by": "words", "forward": false} },
{ "keys": ["ctrl+alt+l"], "command": "move", "args": {"by": "word_ends", "forward": true} },
{ "keys": ["ctrl+shift+alt+h"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
{ "keys": ["ctrl+shift+alt+l"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} },
{ "keys": ["alt+,"], "command": "move", "args": {"by": "pages", "forward": false} },
{ "keys": ["alt+m"], "command": "move", "args": {"by": "pages", "forward": true} },
{ "keys": ["shift+alt+,"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} },
{ "keys": ["shift+alt+m"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} },
{ "keys": ["alt+y"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["alt+u"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["shift+alt+y"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["shift+alt+u"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["ctrl+alt+y"], "command": "move_to", "args": {"to": "bof", "extend": false} },
{ "keys": ["ctrl+alt+u"], "command": "move_to", "args": {"to": "eof", "extend": false} },
{ "keys": ["ctrl+shift+alt+y"], "command": "move_to", "args": {"to": "bof", "extend": true} },
{ "keys": ["ctrl+shift+alt+u"], "command": "move_to", "args": {"to": "eof", "extend": true} },
{ "keys": ["ctrl+alt+,"], "command": "move_to", "args": {"to": "bof"} },
{ "keys": ["ctrl+alt+m"], "command": "move_to", "args": {"to": "eof"} },
{ "keys": ["alt+;"], "command": "right_delete", "args": { "forward": true } },
{ "keys": ["ctrl+alt+;"], "command": "delete_word", "args": { "forward": true } },
{ "keys": ["ctrl+;"], "command": "delete_word", "args": { "forward": true } },
{ "keys": ["ctrl+shift+alt+;"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} },
// { "keys": ["ctrl+k", "ctrl+n"], "command": "next_bookmark" },
// //{ "keys": ["shift+f2"], "command": "prev_bookmark" },
// { "keys": ["ctrl+k", "ctrl+k"], "command": "toggle_bookmark" },
// { "keys": ["ctrl+k", "ctrl+l"], "command": "clear_bookmarks" },
{ "keys": ["ctrl+2"], "command": "show_panel", "args": {"panel": "output.exec" } },
{ "keys": ["ctrl+3"], "command": "show_panel", "args": {"panel": "output.find_results" } },
// Exit find upon navigation keys
{ "keys": ["alt+h"], "command": "hide_panel_and_move", "args": {"by": "characters", "forward": false}, "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["alt+l"], "command": "hide_panel_and_move", "args": {"by": "characters", "forward": true}, "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["alt+k"], "command": "hide_panel_and_move", "args": {"by": "lines", "forward": false}, "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["alt+j"], "command": "hide_panel_and_move", "args": {"by": "lines", "forward": true}, "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["alt+y"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["alt+u"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["alt+y"], "command": "hide_panel_and_move_to", "args": {"to": "bol"}, "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["alt+u"], "command": "hide_panel_and_move_to", "args": {"to": "eol"}, "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} },
{ "keys": ["ctrl+shift+f"], "command": "slurp_and_show_panel", "args": {"panel": "find_in_files"}, "context":
// Only if there is some text (a view is open)
[{ "key": "text", "operator": "regex_contains", "operand": ".*" }]
},
{ "keys": ["ctrl+f"], "command": "slurp_and_show_panel", "args": {"panel": "find"} },
{ "keys": ["ctrl+h"], "command": "slurp_and_show_panel", "args": {"panel": "replace"} },
// Testing
{ "keys": ["alt+r"], "command": "reindent"},
// Emacs-like reindent, requires jimb_util.py
// Reindent if nothing is selected
{ "keys": ["tab"], "command": "reindent", "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": false },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
},
// If in the whitespace before the beginning of a line, reindent and also move to
// the beginning of the line
{ "keys": ["tab"], "command": "reindent_and_move_to",
"args": {"to": "bol"},
"context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^\\s*$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^\\s.*$", "match_all": true }
]
},
// Re-order the escape priorities
{ "keys": ["escape"], "command": "hide_panel", "args": {"cancel": true},
"context":
[
{ "key": "panel_visible", "operator": "equal", "operand": true }
]
},
{ "keys": ["escape"], "command": "hide_overlay", "context":
[
{ "key": "overlay_visible", "operator": "equal", "operand": true }
]
},
//
{ "keys": ["escape"], "command": "clear_fields", "context":
[
{ "key": "has_next_field", "operator": "equal", "operand": true }
]
},
{ "keys": ["escape"], "command": "clear_fields", "context":
[
{ "key": "has_prev_field", "operator": "equal", "operand": true }
]
},
// Should maybe be above clear_fields
{ "keys": ["escape"], "command": "single_selection", "context":
[
{ "key": "num_selections", "operator": "not_equal", "operand": 1 }
]
},
{ "keys": ["escape"], "command": "hide_auto_complete", "context":
[
{ "key": "auto_complete_visible", "operator": "equal", "operand": true }
]
},
{ "keys": ["alt+left"], "command": "jump_back" },
{ "keys": ["alt+right"], "command": "jump_forward" },
{ "keys": ["alt+o"], "command": "goto_symbol_in_project" },
{ "keys": ["ctrl+k", "ctrl+k"], "command": "sublime_bookmark", "args" : { "type" : "toggle_line" } },
{ "keys": ["ctrl+k", "ctrl+n"], "command": "sublime_bookmark", "args" : { "type" : "goto_next" } },
{ "keys": ["ctrl+k", "ctrl+p"], "command": "sublime_bookmark", "args" : { "type" : "goto_previous" } },
{ "keys": ["ctrl+k", "ctrl+g"], "command": "sublime_bookmark", "args" : { "type" : "goto" } },
{ "keys": ["ctrl+k", "ctrl+l"], "command": "sublime_bookmark", "args" : { "type" : "remove_all" } },
{}
]
# Drop this in Packages/User
import sublime, sublime_plugin
# Doesn't work :( self.view is not correct?
class HidePanelAndMoveCommand(sublime_plugin.TextCommand):
def run(self, edit, by, forward=False, extend=False):
self.view.window().run_command("hide_panel");
self.view.run_command("move", {"by": by, "forward": forward, "extend": extend});
class HidePanelAndMoveToCommand(sublime_plugin.TextCommand):
def run(self, edit, to, extend=False):
self.view.window().run_command("hide_panel");
self.view.run_command("move_to", {"to": to, "extend": extend});
# reindent and goto
class ReindentAndMoveToCommand(sublime_plugin.TextCommand):
def run(self, edit, to, extend=False):
self.view.run_command("reindent");
self.view.run_command("move_to", {"to": to, "extend": extend});
class SlurpAndShowPanelCommand(sublime_plugin.TextCommand):
def run(self, edit, panel="find_in_files"):
self.view.window().run_command("slurp_find_string");
self.view.window().run_command("show_panel", {"panel": panel});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment