diff --git a/sublime-text/Default/Add Line Before.sublime-macro b/sublime-text/Default/Add Line Before.sublime-macro new file mode 100644 index 0000000..a1164e7 --- /dev/null +++ b/sublime-text/Default/Add Line Before.sublime-macro @@ -0,0 +1,6 @@ +[ + {"command": "move_to", "args": {"to": "hardbol"}}, + {"command": "insert", "args": {"characters": "\n"}}, + {"command": "move", "args": {"by": "lines", "forward": false}}, + {"command": "reindent", "args": {"force_indent": false}} +] diff --git a/sublime-text/Default/Add Line in Braces.sublime-macro b/sublime-text/Default/Add Line in Braces.sublime-macro new file mode 100644 index 0000000..aaf8218 --- /dev/null +++ b/sublime-text/Default/Add Line in Braces.sublime-macro @@ -0,0 +1,6 @@ +[ + {"command": "insert", "args": {"characters": "\n\n"} }, + {"command": "move", "args": {"by": "lines", "forward": false} }, + {"command": "move_to", "args": {"to": "hardeol", "extend": false} }, + {"command": "reindent", "args": {"single_line": true} } +] diff --git a/sublime-text/Default/Add Line.sublime-macro b/sublime-text/Default/Add Line.sublime-macro new file mode 100644 index 0000000..6d746e7 --- /dev/null +++ b/sublime-text/Default/Add Line.sublime-macro @@ -0,0 +1,4 @@ +[ + {"command": "move_to", "args": {"to": "hardeol"}}, + {"command": "insert", "args": {"characters": "\n"}} +] diff --git a/sublime-text/Default/Context.sublime-menu b/sublime-text/Default/Context.sublime-menu new file mode 100644 index 0000000..61a9de2 --- /dev/null +++ b/sublime-text/Default/Context.sublime-menu @@ -0,0 +1,13 @@ +[ + { "command": "copy" }, + { "command": "cut" }, + { "command": "paste" }, + { "caption": "-", "id": "selection" }, + { "command": "select_all" }, + { "caption": "-", "id": "file" }, + { "command": "open_in_browser", "caption": "Open in Browser" }, + { "command": "open_dir", "args": {"dir": "$file_path", "file": "$file_name"}, "caption": "Open Containing Folder…" }, + { "command": "copy_path", "caption": "Copy File Path" }, + { "command": "reveal_in_side_bar", "caption": "Reveal in Side Bar" }, + { "caption": "-", "id": "end" } +] diff --git a/sublime-text/Default/Default (Linux).sublime-keymap b/sublime-text/Default/Default (Linux).sublime-keymap new file mode 100644 index 0000000..0903204 --- /dev/null +++ b/sublime-text/Default/Default (Linux).sublime-keymap @@ -0,0 +1,650 @@ +[ + { "keys": ["ctrl+q"], "command": "exit" }, + + { "keys": ["ctrl+shift+n"], "command": "new_window" }, + { "keys": ["ctrl+shift+w"], "command": "close_window" }, + { "keys": ["ctrl+o"], "command": "prompt_open_file" }, + { "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, + { "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }, + { "keys": ["ctrl+n"], "command": "new_file" }, + { "keys": ["ctrl+s"], "command": "save" }, + { "keys": ["ctrl+shift+s"], "command": "prompt_save_as" }, + { "keys": ["ctrl+f4"], "command": "close_file" }, + { "keys": ["ctrl+w"], "command": "close" }, + + { "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" }, + { "keys": ["f11"], "command": "toggle_full_screen" }, + { "keys": ["shift+f11"], "command": "toggle_distraction_free" }, + + { "keys": ["backspace"], "command": "left_delete" }, + { "keys": ["shift+backspace"], "command": "left_delete" }, + { "keys": ["ctrl+shift+backspace"], "command": "left_delete" }, + { "keys": ["delete"], "command": "right_delete" }, + { "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} }, + { "keys": ["shift+enter"], "command": "insert", "args": {"characters": "\n"} }, + { "keys": ["keypad_enter"], "command": "insert", "args": {"characters": "\n"} }, + { "keys": ["shift+keypad_enter"], "command": "insert", "args": {"characters": "\n"} }, + + { "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": ["shift+delete"], "command": "cut" }, + { "keys": ["ctrl+insert"], "command": "copy" }, + { "keys": ["shift+insert"], "command": "paste" }, + + // These two key bindings should replace the above three if you'd prefer + // the traditional X11 behavior of shift+insert pasting from the primary + // selection. The above CUA keys are the default, to match most GTK + // applications. + //{ "keys": ["shift+insert"], "command": "paste", "args": {"clipboard": "selection"} }, + //{ "keys": ["shift+delete"], "command": "right_delete" }, + + { "keys": ["ctrl+x"], "command": "cut" }, + { "keys": ["ctrl+c"], "command": "copy" }, + { "keys": ["ctrl+v"], "command": "paste" }, + { "keys": ["ctrl+shift+v"], "command": "paste_and_indent" }, + + { "keys": ["left"], "command": "move", "args": {"by": "characters", "forward": false} }, + { "keys": ["right"], "command": "move", "args": {"by": "characters", "forward": true} }, + { "keys": ["up"], "command": "move", "args": {"by": "lines", "forward": false} }, + { "keys": ["down"], "command": "move", "args": {"by": "lines", "forward": true} }, + { "keys": ["shift+left"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true} }, + { "keys": ["shift+right"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true} }, + { "keys": ["shift+up"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true} }, + { "keys": ["shift+down"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true} }, + + { "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} }, + { "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true} }, + { "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} }, + { "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} }, + + { "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, + { "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, + { "keys": ["alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, + { "keys": ["alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, + + { "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} }, + { "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} }, + + { "keys": ["pageup"], "command": "move", "args": {"by": "pages", "forward": false} }, + { "keys": ["pagedown"], "command": "move", "args": {"by": "pages", "forward": true} }, + { "keys": ["shift+pageup"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} }, + { "keys": ["shift+pagedown"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} }, + + { "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} }, + + { "keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 1.0 } }, + { "keys": ["ctrl+down"], "command": "scroll_lines", "args": {"amount": -1.0 } }, + + { "keys": ["ctrl+pagedown"], "command": "next_view" }, + { "keys": ["ctrl+pageup"], "command": "prev_view" }, + + { "keys": ["ctrl+tab"], "command": "next_view_in_stack" }, + { "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" }, + + { "keys": ["ctrl+a"], "command": "select_all" }, + { "keys": ["ctrl+shift+l"], "command": "split_selection_into_lines" }, + { "keys": ["escape"], "command": "single_selection", "context": + [ + { "key": "num_selections", "operator": "not_equal", "operand": 1 } + ] + }, + { "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 } + ] + }, + { "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": "hide_auto_complete", "context": + [ + { "key": "auto_complete_visible", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, + { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, + "context": + [ + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "replace_completion_with_next_completion", "context": + [ + { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "reindent", "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": "^$", "match_all": true }, + { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true } + ] + }, + { "keys": ["tab"], "command": "indent", "context": + [ + { "key": "text", "operator": "regex_contains", "operand": "\n" } + ] + }, + { "keys": ["tab"], "command": "next_field", "context": + [ + { "key": "has_next_field", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "commit_completion", "context": + [ + { "key": "auto_complete_visible" }, + { "key": "setting.auto_complete_commit_on_tab" } + ] + }, + + { "keys": ["shift+tab"], "command": "insert", "args": {"characters": "\t"} }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true } + ] + }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "preceding_text", "operator": "regex_match", "operand": "^[\t ]*" } + ] + }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "text", "operator": "regex_contains", "operand": "\n" } + ] + }, + { "keys": ["shift+tab"], "command": "prev_field", "context": + [ + { "key": "has_prev_field", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["ctrl+]"], "command": "indent" }, + { "keys": ["ctrl+["], "command": "unindent" }, + + { "keys": ["insert"], "command": "toggle_overwrite" }, + + { "keys": ["ctrl+l"], "command": "expand_selection", "args": {"to": "line"} }, + { "keys": ["ctrl+d"], "command": "find_under_expand" }, + { "keys": ["ctrl+k", "ctrl+d"], "command": "find_under_expand_skip" }, + { "keys": ["ctrl+shift+space"], "command": "expand_selection", "args": {"to": "scope"} }, + { "keys": ["ctrl+shift+m"], "command": "expand_selection", "args": {"to": "brackets"} }, + { "keys": ["ctrl+m"], "command": "move_to", "args": {"to": "brackets"} }, + { "keys": ["ctrl+shift+j"], "command": "expand_selection", "args": {"to": "indentation"} }, + { "keys": ["ctrl+shift+a"], "command": "expand_selection", "args": {"to": "tag"} }, + + { "keys": ["alt+."], "command": "close_tag" }, + + { "keys": ["ctrl+alt+q"], "command": "toggle_record_macro" }, + { "keys": ["ctrl+alt+shift+q"], "command": "run_macro" }, + + { "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, + { "keys": ["ctrl+shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line Before.sublime-macro"} }, + { "keys": ["enter"], "command": "commit_completion", "context": + [ + { "key": "auto_complete_visible" }, + { "key": "setting.auto_complete_commit_on_tab", "operand": false } + ] + }, + + { "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+alt+p"], "command": "prompt_select_project" }, + { "keys": ["ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, + { "keys": ["ctrl+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, + { "keys": ["ctrl+;"], "command": "show_overlay", "args": {"overlay": "goto", "text": "#"} }, + + { "keys": ["ctrl+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false} }, + { "keys": ["ctrl+shift+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":true} }, + { "keys": ["ctrl+f"], "command": "show_panel", "args": {"panel": "find"} }, + { "keys": ["ctrl+h"], "command": "show_panel", "args": {"panel": "replace"} }, + { "keys": ["ctrl+shift+h"], "command": "replace_next" }, + { "keys": ["f3"], "command": "find_next" }, + { "keys": ["shift+f3"], "command": "find_prev" }, + { "keys": ["ctrl+f3"], "command": "find_under" }, + { "keys": ["ctrl+shift+f3"], "command": "find_under_prev" }, + { "keys": ["alt+f3"], "command": "find_all_under" }, + { "keys": ["ctrl+e"], "command": "slurp_find_string" }, + { "keys": ["ctrl+shift+e"], "command": "slurp_replace_string" }, + { "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} }, + { "keys": ["f4"], "command": "next_result" }, + { "keys": ["shift+f4"], "command": "prev_result" }, + + { "keys": ["f6"], "command": "toggle_setting", "args": {"setting": "spell_check"} }, + { "keys": ["ctrl+f6"], "command": "next_misspelling" }, + { "keys": ["ctrl+shift+f6"], "command": "prev_misspelling" }, + + { "keys": ["ctrl+shift+up"], "command": "swap_line_up" }, + { "keys": ["ctrl+shift+down"], "command": "swap_line_down" }, + + { "keys": ["ctrl+backspace"], "command": "delete_word", "args": { "forward": false } }, + { "keys": ["ctrl+shift+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, + + { "keys": ["ctrl+delete"], "command": "delete_word", "args": { "forward": true } }, + { "keys": ["ctrl+shift+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + + { "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } }, + { "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } }, + + { "keys": ["ctrl+j"], "command": "join_lines" }, + { "keys": ["ctrl+shift+d"], "command": "duplicate_line" }, + + { "keys": ["ctrl+`"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, + + { "keys": ["alt+/"], "command": "auto_complete" }, + { "keys": ["alt+/"], "command": "replace_completion_with_auto_complete", "context": + [ + { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, + { "key": "auto_complete_visible", "operator": "equal", "operand": false }, + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["ctrl+alt+shift+p"], "command": "show_scope_name" }, + + { "keys": ["f7"], "command": "build" }, + { "keys": ["ctrl+b"], "command": "build" }, + { "keys": ["ctrl+shift+b"], "command": "build", "args": {"variant": "Run"} }, + { "keys": ["ctrl+break"], "command": "exec", "args": {"kill": true} }, + + { "keys": ["ctrl+t"], "command": "transpose" }, + + { "keys": ["f9"], "command": "sort_lines", "args": {"case_sensitive": false} }, + { "keys": ["ctrl+f9"], "command": "sort_lines", "args": {"case_sensitive": true} }, + + // Auto-pair quotes + { "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": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true } + ] + }, + { "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 } + ] + }, + + // Auto-pair single quotes + { "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": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true } + ] + }, + { "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 } + ] + }, + + // Auto-pair 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 } + ] + }, + { "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 } + ] + }, + + // Auto-pair square 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 } + ] + }, + { "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 } + ] + }, + + // 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 } + ] + }, + { "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 } + ] + }, + + { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": + [ + { "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": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } + ] + }, + { "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": + [ + { "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": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } + ] + }, + + { + "keys": ["alt+shift+1"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1]] + } + }, + { + "keys": ["alt+shift+2"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] + } + }, + { + "keys": ["alt+shift+3"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.33, 0.66, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] + } + }, + { + "keys": ["alt+shift+4"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.25, 0.5, 0.75, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] + } + }, + { + "keys": ["alt+shift+8"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] + } + }, + { + "keys": ["alt+shift+9"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.33, 0.66, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] + } + }, + { + "keys": ["alt+shift+5"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": + [ + [0, 0, 1, 1], [1, 0, 2, 1], + [0, 1, 1, 2], [1, 1, 2, 2] + ] + } + }, + { "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } }, + { "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } }, + { "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } }, + { "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } }, + { "keys": ["ctrl+shift+1"], "command": "move_to_group", "args": { "group": 0 } }, + { "keys": ["ctrl+shift+2"], "command": "move_to_group", "args": { "group": 1 } }, + { "keys": ["ctrl+shift+3"], "command": "move_to_group", "args": { "group": 2 } }, + { "keys": ["ctrl+shift+4"], "command": "move_to_group", "args": { "group": 3 } }, + { "keys": ["ctrl+0"], "command": "focus_side_bar" }, + + { "keys": ["alt+1"], "command": "select_by_index", "args": { "index": 0 } }, + { "keys": ["alt+2"], "command": "select_by_index", "args": { "index": 1 } }, + { "keys": ["alt+3"], "command": "select_by_index", "args": { "index": 2 } }, + { "keys": ["alt+4"], "command": "select_by_index", "args": { "index": 3 } }, + { "keys": ["alt+5"], "command": "select_by_index", "args": { "index": 4 } }, + { "keys": ["alt+6"], "command": "select_by_index", "args": { "index": 5 } }, + { "keys": ["alt+7"], "command": "select_by_index", "args": { "index": 6 } }, + { "keys": ["alt+8"], "command": "select_by_index", "args": { "index": 7 } }, + { "keys": ["alt+9"], "command": "select_by_index", "args": { "index": 8 } }, + { "keys": ["alt+0"], "command": "select_by_index", "args": { "index": 9 } }, + + { "keys": ["f2"], "command": "next_bookmark" }, + { "keys": ["shift+f2"], "command": "prev_bookmark" }, + { "keys": ["ctrl+f2"], "command": "toggle_bookmark" }, + { "keys": ["ctrl+shift+f2"], "command": "clear_bookmarks" }, + { "keys": ["alt+f2"], "command": "select_all_bookmarks" }, + + { "keys": ["ctrl+shift+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, + + { "keys": ["alt+q"], "command": "wrap_lines" }, + + { "keys": ["ctrl+k", "ctrl+u"], "command": "upper_case" }, + { "keys": ["ctrl+k", "ctrl+l"], "command": "lower_case" }, + + { "keys": ["ctrl+k", "ctrl+space"], "command": "set_mark" }, + { "keys": ["ctrl+k", "ctrl+a"], "command": "select_to_mark" }, + { "keys": ["ctrl+k", "ctrl+w"], "command": "delete_to_mark" }, + { "keys": ["ctrl+k", "ctrl+x"], "command": "swap_with_mark" }, + { "keys": ["ctrl+k", "ctrl+y"], "command": "yank" }, + { "keys": ["ctrl+k", "ctrl+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + { "keys": ["ctrl+k", "ctrl+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, + { "keys": ["ctrl+k", "ctrl+g"], "command": "clear_bookmarks", "args": {"name": "mark"} }, + { "keys": ["ctrl+k", "ctrl+c"], "command": "show_at_center" }, + + { "keys": ["ctrl++"], "command": "increase_font_size" }, + { "keys": ["ctrl+="], "command": "increase_font_size" }, + { "keys": ["ctrl+-"], "command": "decrease_font_size" }, + + { "keys": ["alt+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } }, + + { "keys": ["ctrl+shift+["], "command": "fold" }, + { "keys": ["ctrl+shift+]"], "command": "unfold" }, + { "keys": ["ctrl+k", "ctrl+1"], "command": "fold_by_level", "args": {"level": 1} }, + { "keys": ["ctrl+k", "ctrl+2"], "command": "fold_by_level", "args": {"level": 2} }, + { "keys": ["ctrl+k", "ctrl+3"], "command": "fold_by_level", "args": {"level": 3} }, + { "keys": ["ctrl+k", "ctrl+4"], "command": "fold_by_level", "args": {"level": 4} }, + { "keys": ["ctrl+k", "ctrl+5"], "command": "fold_by_level", "args": {"level": 5} }, + { "keys": ["ctrl+k", "ctrl+6"], "command": "fold_by_level", "args": {"level": 6} }, + { "keys": ["ctrl+k", "ctrl+7"], "command": "fold_by_level", "args": {"level": 7} }, + { "keys": ["ctrl+k", "ctrl+8"], "command": "fold_by_level", "args": {"level": 8} }, + { "keys": ["ctrl+k", "ctrl+9"], "command": "fold_by_level", "args": {"level": 9} }, + { "keys": ["ctrl+k", "ctrl+0"], "command": "unfold_all" }, + { "keys": ["ctrl+k", "ctrl+j"], "command": "unfold_all" }, + { "keys": ["ctrl+k", "ctrl+t"], "command": "fold_tag_attributes" }, + + { "keys": ["context_menu"], "command": "context_menu" }, + + { "keys": ["alt+c"], "command": "toggle_case_sensitive", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["alt+r"], "command": "toggle_regex", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["alt+w"], "command": "toggle_whole_word", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["alt+a"], "command": "toggle_preserve_case", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + + // Find panel key bindings + { "keys": ["enter"], "command": "find_next", "context": + [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + + // Replace panel key bindings + { "keys": ["enter"], "command": "find_next", "context": + [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + + // Incremental find panel key bindings + { "keys": ["enter"], "command": "hide_panel", "context": + [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + } +] diff --git a/sublime-text/Default/Default (Linux).sublime-mousemap b/sublime-text/Default/Default (Linux).sublime-mousemap new file mode 100644 index 0000000..44bed1f --- /dev/null +++ b/sublime-text/Default/Default (Linux).sublime-mousemap @@ -0,0 +1,100 @@ +[ + // Basic drag select + { + "button": "button1", "count": 1, + "press_command": "drag_select" + }, + { + "button": "button1", "count": 1, "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"additive": true} + }, + { + "button": "button1", "count": 1, "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"subtractive": true} + }, + + // Select between selection and click location + { + "button": "button1", "modifiers": ["shift"], + "press_command": "drag_select", + "press_args": {"extend": true} + }, + { + "button": "button1", "modifiers": ["shift", "ctrl"], + "press_command": "drag_select", + "press_args": {"additive": true, "extend": true} + }, + { + "button": "button1", "modifiers": ["shift", "alt"], + "press_command": "drag_select", + "press_args": {"subtractive": true, "extend": true} + }, + + // Drag select by words + { + "button": "button1", "count": 2, + "press_command": "drag_select", + "press_args": {"by": "words"} + }, + { + "button": "button1", "count": 2, "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"by": "words", "additive": true} + }, + { + "button": "button1", "count": 2, "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"by": "words", "subtractive": true} + }, + + // Drag select by lines + { + "button": "button1", "count": 3, + "press_command": "drag_select", + "press_args": {"by": "lines"} + }, + { + "button": "button1", "count": 3, "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"by": "lines", "additive": true} + }, + { + "button": "button1", "count": 3, "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"by": "lines", "subtractive": true} + }, + + // Column select + { + "button": "button2", "modifiers": ["shift"], + "press_command": "drag_select", + "press_args": {"by": "columns"} + }, + { + "button": "button2", "modifiers": ["shift", "ctrl"], + "press_command": "drag_select", + "press_args": {"by": "columns", "additive": true} + }, + { + "button": "button2", "modifiers": ["shift", "alt"], + "press_command": "drag_select", + "press_args": {"by": "columns", "subtractive": true} + }, + + // Middle click paste + { "button": "button3", "command": "paste_selection_clipboard" }, + + // Switch files with buttons 4 and 5, as well as 8 and 9 + { "button": "button4", "modifiers": [], "command": "prev_view" }, + { "button": "button5", "modifiers": [], "command": "next_view" }, + { "button": "button8", "modifiers": [], "command": "prev_view" }, + { "button": "button9", "modifiers": [], "command": "next_view" }, + + // Change font size with ctrl+scroll wheel + { "button": "scroll_down", "modifiers": ["ctrl"], "command": "decrease_font_size" }, + { "button": "scroll_up", "modifiers": ["ctrl"], "command": "increase_font_size" }, + + { "button": "button2", "modifiers": [], "press_command": "context_menu" } +] diff --git a/sublime-text/Default/Default (OSX).sublime-keymap b/sublime-text/Default/Default (OSX).sublime-keymap new file mode 100644 index 0000000..52cecb5 --- /dev/null +++ b/sublime-text/Default/Default (OSX).sublime-keymap @@ -0,0 +1,624 @@ +/* +On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings, +and don't need to be repeated here. Anything listed here will take precedence, however. +*/ +[ + { "keys": ["super+shift+n"], "command": "new_window" }, + { "keys": ["super+shift+w"], "command": "close_window" }, + { "keys": ["super+o"], "command": "prompt_open" }, + { "keys": ["super+shift+t"], "command": "reopen_last_file" }, + { "keys": ["super+alt+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }, + { "keys": ["super+n"], "command": "new_file" }, + { "keys": ["super+s"], "command": "save" }, + { "keys": ["super+shift+s"], "command": "prompt_save_as" }, + { "keys": ["super+alt+s"], "command": "save_all" }, + { "keys": ["super+w"], "command": "close" }, + + { "keys": ["super+k", "super+b"], "command": "toggle_side_bar" }, + { "keys": ["super+ctrl+f"], "command": "toggle_full_screen" }, + { "keys": ["super+ctrl+shift+f"], "command": "toggle_distraction_free" }, + + { "keys": ["super+z"], "command": "undo" }, + { "keys": ["super+shift+z"], "command": "redo" }, + { "keys": ["super+y"], "command": "redo_or_repeat" }, + { "keys": ["super+u"], "command": "soft_undo" }, + { "keys": ["super+shift+u"], "command": "soft_redo" }, + + { "keys": ["super+x"], "command": "cut" }, + { "keys": ["super+c"], "command": "copy" }, + { "keys": ["super+v"], "command": "paste" }, + { "keys": ["super+shift+v"], "command": "paste_and_indent" }, + + { "keys": ["ctrl+alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, + { "keys": ["ctrl+alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, + { "keys": ["ctrl+alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, + { "keys": ["ctrl+alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, + + { "keys": ["ctrl+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, + { "keys": ["ctrl+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, + { "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, + { "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, + + { "keys": ["ctrl+alt+up"], "command": "scroll_lines", "args": {"amount": 1.0} }, + { "keys": ["ctrl+alt+down"], "command": "scroll_lines", "args": {"amount": -1.0} }, + + { "keys": ["ctrl+shift+up"], "command": "select_lines", "args": {"forward": false} }, + { "keys": ["ctrl+shift+down"], "command": "select_lines", "args": {"forward": true} }, + + { "keys": ["super+shift+["], "command": "prev_view" }, + { "keys": ["super+shift+]"], "command": "next_view" }, + { "keys": ["super+alt+left"], "command": "prev_view" }, + { "keys": ["super+alt+right"], "command": "next_view" }, + + { "keys": ["ctrl+tab"], "command": "next_view_in_stack" }, + { "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" }, + + { "keys": ["super+a"], "command": "select_all" }, + { "keys": ["super+shift+l"], "command": "split_selection_into_lines" }, + { "keys": ["escape"], "command": "single_selection", "context": + [ + { "key": "num_selections", "operator": "not_equal", "operand": 1 } + ] + }, + { "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 } + ] + }, + { "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": "hide_auto_complete", "context": + [ + { "key": "auto_complete_visible", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["super+]"], "command": "indent" }, + { "keys": ["super+["], "command": "unindent" }, + + { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, + { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, + "context": + [ + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "replace_completion_with_next_completion", "context": + [ + { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "reindent", "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": "^$", "match_all": true }, + { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true } + ] + }, + { "keys": ["tab"], "command": "indent", "context": + [ + { "key": "text", "operator": "regex_contains", "operand": "\n" } + ] + }, + { "keys": ["tab"], "command": "next_field", "context": + [ + { "key": "has_next_field", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "commit_completion", "context": + [ + { "key": "auto_complete_visible" }, + { "key": "setting.auto_complete_commit_on_tab" } + ] + }, + + { "keys": ["shift+tab"], "command": "insert", "args": {"characters": "\t"} }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true } + ] + }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "preceding_text", "operator": "regex_match", "operand": "^[\t ]*" } + ] + }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "text", "operator": "regex_contains", "operand": "\n" } + ] + }, + { "keys": ["shift+tab"], "command": "prev_field", "context": + [ + { "key": "has_prev_field", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["super+l"], "command": "expand_selection", "args": {"to": "line"} }, + { "keys": ["super+d"], "command": "find_under_expand" }, + { "keys": ["super+k", "super+d"], "command": "find_under_expand_skip" }, + { "keys": ["super+shift+space"], "command": "expand_selection", "args": {"to": "scope"} }, + { "keys": ["ctrl+shift+m"], "command": "expand_selection", "args": {"to": "brackets"} }, + { "keys": ["ctrl+m"], "command": "move_to", "args": {"to": "brackets"} }, + { "keys": ["super+shift+j"], "command": "expand_selection", "args": {"to": "indentation"} }, + { "keys": ["super+shift+a"], "command": "expand_selection", "args": {"to": "tag"} }, + + { "keys": ["super+alt+."], "command": "close_tag" }, + + { "keys": ["ctrl+q"], "command": "toggle_record_macro" }, + { "keys": ["ctrl+shift+q"], "command": "run_macro" }, + + { "keys": ["super+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, + { "keys": ["super+shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line Before.sublime-macro"} }, + { "keys": ["enter"], "command": "commit_completion", "context": + [ + { "key": "auto_complete_visible" }, + { "key": "setting.auto_complete_commit_on_tab", "operand": false } + ] + }, + + { "keys": ["super+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, + { "keys": ["super+p"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, + { "keys": ["super+shift+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} }, + { "keys": ["super+ctrl+p"], "command": "prompt_select_project" }, + { "keys": ["super+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, + { "keys": ["ctrl+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, + + { "keys": ["super+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false} }, + { "keys": ["super+shift+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":true} }, + { "keys": ["super+f"], "command": "show_panel", "args": {"panel": "find"} }, + { "keys": ["super+alt+f"], "command": "show_panel", "args": {"panel": "replace"} }, + { "keys": ["super+alt+e"], "command": "replace_next" }, + { "keys": ["super+g"], "command": "find_next" }, + { "keys": ["super+shift+g"], "command": "find_prev" }, + { "keys": ["super+e"], "command": "slurp_find_string" }, + { "keys": ["super+shift+e"], "command": "slurp_replace_string" }, + + { "keys": ["alt+super+g"], "command": "find_under" }, + { "keys": ["shift+alt+super+g"], "command": "find_under_prev" }, + { "keys": ["ctrl+super+g"], "command": "find_all_under" }, + + { "keys": ["super+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} }, + { "keys": ["f4"], "command": "next_result" }, + { "keys": ["shift+f4"], "command": "prev_result" }, + + { "keys": ["f6"], "command": "toggle_setting", "args": {"setting": "spell_check"} }, + { "keys": ["ctrl+f6"], "command": "next_misspelling" }, + { "keys": ["ctrl+shift+f6"], "command": "prev_misspelling" }, + + { "keys": ["ctrl+super+up"], "command": "swap_line_up" }, + { "keys": ["ctrl+super+down"], "command": "swap_line_down" }, + + { "keys": ["ctrl+backspace"], "command": "delete_word", "args": { "forward": false, "sub_words": true } }, + { "keys": ["ctrl+delete"], "command": "delete_word", "args": { "forward": true, "sub_words": true } }, + + { "keys": ["super+forward_slash"], "command": "toggle_comment", "args": { "block": false } }, + { "keys": ["super+alt+forward_slash"], "command": "toggle_comment", "args": { "block": true } }, + + { "keys": ["super+j"], "command": "join_lines" }, + { "keys": ["super+shift+d"], "command": "duplicate_line" }, + + { "keys": ["ctrl+backquote"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, + + { "keys": ["ctrl+space"], "command": "auto_complete" }, + { "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context": + [ + { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, + { "key": "auto_complete_visible", "operator": "equal", "operand": false }, + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["super+alt+p"], "command": "show_scope_name" }, + { "keys": ["ctrl+shift+p"], "command": "show_scope_name" }, + + { "keys": ["f7"], "command": "build" }, + { "keys": ["super+b"], "command": "build" }, + { "keys": ["super+shift+b"], "command": "build", "args": {"variant": "Run"} }, + + { "keys": ["ctrl+t"], "command": "transpose" }, + + { "keys": ["f5"], "command": "sort_lines", "args": {"case_sensitive": false} }, + { "keys": ["ctrl+f5"], "command": "sort_lines", "args": {"case_sensitive": true} }, + + // Auto-pair quotes + { "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": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true } + ] + }, + { "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 } + ] + }, + + // Auto-pair single quotes + { "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": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true } + ] + }, + { "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 } + ] + }, + + // Auto-pair 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 } + ] + }, + { "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 } + ] + }, + + // Auto-pair square 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 } + ] + }, + { "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 } + ] + }, + + // 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 } + ] + }, + { "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 } + ] + }, + + { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": + [ + { "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": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } + ] + }, + { "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": + [ + { "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": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } + ] + }, + + { + "keys": ["super+alt+1"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1]] + } + }, + { + "keys": ["super+alt+2"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] + } + }, + { + "keys": ["super+alt+3"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.33, 0.66, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] + } + }, + { + "keys": ["super+alt+4"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.25, 0.5, 0.75, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] + } + }, + { + "keys": ["super+alt+shift+2"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] + } + }, + { + "keys": ["super+alt+shift+3"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.33, 0.66, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] + } + }, + { + "keys": ["super+alt+5"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": + [ + [0, 0, 1, 1], [1, 0, 2, 1], + [0, 1, 1, 2], [1, 1, 2, 2] + ] + } + }, + { "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } }, + { "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } }, + { "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } }, + { "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } }, + { "keys": ["ctrl+shift+1"], "command": "move_to_group", "args": { "group": 0 } }, + { "keys": ["ctrl+shift+2"], "command": "move_to_group", "args": { "group": 1 } }, + { "keys": ["ctrl+shift+3"], "command": "move_to_group", "args": { "group": 2 } }, + { "keys": ["ctrl+shift+4"], "command": "move_to_group", "args": { "group": 3 } }, + { "keys": ["ctrl+0"], "command": "focus_side_bar" }, + + { "keys": ["super+1"], "command": "select_by_index", "args": { "index": 0 } }, + { "keys": ["super+2"], "command": "select_by_index", "args": { "index": 1 } }, + { "keys": ["super+3"], "command": "select_by_index", "args": { "index": 2 } }, + { "keys": ["super+4"], "command": "select_by_index", "args": { "index": 3 } }, + { "keys": ["super+5"], "command": "select_by_index", "args": { "index": 4 } }, + { "keys": ["super+6"], "command": "select_by_index", "args": { "index": 5 } }, + { "keys": ["super+7"], "command": "select_by_index", "args": { "index": 6 } }, + { "keys": ["super+8"], "command": "select_by_index", "args": { "index": 7 } }, + { "keys": ["super+9"], "command": "select_by_index", "args": { "index": 8 } }, + { "keys": ["super+0"], "command": "select_by_index", "args": { "index": 9 } }, + + { "keys": ["f2"], "command": "next_bookmark" }, + { "keys": ["shift+f2"], "command": "prev_bookmark" }, + { "keys": ["super+f2"], "command": "toggle_bookmark" }, + { "keys": ["super+shift+f2"], "command": "clear_bookmarks" }, + { "keys": ["alt+f2"], "command": "select_all_bookmarks" }, + + { "keys": ["super+k", "super+u"], "command": "upper_case" }, + { "keys": ["super+k", "super+l"], "command": "lower_case" }, + { "keys": ["super+k", "super+space"], "command": "set_mark" }, + { "keys": ["super+k", "super+a"], "command": "select_to_mark" }, + { "keys": ["super+k", "super+w"], "command": "delete_to_mark" }, + { "keys": ["super+k", "super+x"], "command": "swap_with_mark" }, + { "keys": ["super+k", "super+g"], "command": "clear_bookmarks", "args": {"name": "mark"} }, + + { "keys": ["super+plus"], "command": "increase_font_size" }, + { "keys": ["super+equals"], "command": "increase_font_size" }, + { "keys": ["super+minus"], "command": "decrease_font_size" }, + + { "keys": ["ctrl+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } }, + + { "keys": ["ctrl+shift+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, + + { "keys": ["super+alt+q"], "command": "wrap_lines" }, + + { "keys": ["super+alt+["], "command": "fold" }, + { "keys": ["super+alt+]"], "command": "unfold" }, + { "keys": ["super+k", "super+1"], "command": "fold_by_level", "args": {"level": 1} }, + { "keys": ["super+k", "super+2"], "command": "fold_by_level", "args": {"level": 2} }, + { "keys": ["super+k", "super+3"], "command": "fold_by_level", "args": {"level": 3} }, + { "keys": ["super+k", "super+4"], "command": "fold_by_level", "args": {"level": 4} }, + { "keys": ["super+k", "super+5"], "command": "fold_by_level", "args": {"level": 5} }, + { "keys": ["super+k", "super+6"], "command": "fold_by_level", "args": {"level": 6} }, + { "keys": ["super+k", "super+7"], "command": "fold_by_level", "args": {"level": 7} }, + { "keys": ["super+k", "super+8"], "command": "fold_by_level", "args": {"level": 8} }, + { "keys": ["super+k", "super+9"], "command": "fold_by_level", "args": {"level": 9} }, + { "keys": ["super+k", "super+0"], "command": "unfold_all" }, + { "keys": ["super+k", "super+j"], "command": "unfold_all" }, + { "keys": ["super+k", "super+t"], "command": "fold_tag_attributes" }, + + { "keys": ["super+alt+o"], "command": "toggle_overwrite" }, + + { "keys": ["alt+f2"], "command": "context_menu" }, + + { "keys": ["super+alt+c"], "command": "toggle_case_sensitive", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["super+alt+r"], "command": "toggle_regex", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["super+alt+w"], "command": "toggle_whole_word", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["super+alt+a"], "command": "toggle_preserve_case", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + + // Find panel key bindings + { "keys": ["enter"], "command": "find_next", "context": + [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + + // Replace panel key bindings + { "keys": ["enter"], "command": "find_next", "context": + [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + + // Incremental find panel key bindings + { "keys": ["enter"], "command": "hide_panel", "context": + [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + + { "keys": ["super+,"], "command": "open_file", "args": {"file": "${packages}/User/Preferences.sublime-settings"} }, + + { "keys": ["super+k", "super+y"], "command": "yank" }, + { "keys": ["super+k", "super+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + { "keys": ["super+k", "super+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, + { "keys": ["super+k", "super+c"], "command": "show_at_center" }, + + // These are OS X built in commands, and don't need to be listed here, but + // doing so lets them show up in the menu + { "keys": ["ctrl+y"], "command": "yank" }, + { "keys": ["super+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, + // super+delete isn't a built in command, but makes sense anyway + { "keys": ["super+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + { "keys": ["ctrl+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + { "keys": ["ctrl+l"], "command": "show_at_center" }, + { "keys": ["ctrl+o"], "command": "insert_snippet", "args": { "contents": "$0\n" } }, + { "keys": ["ctrl+super+d"], "command": "noop" }, + { "keys": ["ctrl+super+shift+d"], "command": "noop" } +] diff --git a/sublime-text/Default/Default (OSX).sublime-mousemap b/sublime-text/Default/Default (OSX).sublime-mousemap new file mode 100644 index 0000000..d08b14d --- /dev/null +++ b/sublime-text/Default/Default (OSX).sublime-mousemap @@ -0,0 +1,98 @@ +[ + // Basic drag select + { + "button": "button1", "count": 1, + "press_command": "drag_select" + }, + { + // Select between selection and click location + "button": "button1", "modifiers": ["shift"], + "press_command": "drag_select", + "press_args": {"extend": true} + }, + { + "button": "button1", "count": 1, "modifiers": ["super"], + "press_command": "drag_select", + "press_args": {"additive": true} + }, + { + "button": "button1", "count": 1, "modifiers": ["shift", "super"], + "press_command": "drag_select", + "press_args": {"subtractive": true} + }, + + // Drag select by words + { + "button": "button1", "count": 2, + "press_command": "drag_select", + "press_args": {"by": "words"} + }, + { + "button": "button1", "count": 2, "modifiers": ["super"], + "press_command": "drag_select", + "press_args": {"by": "words", "additive": true} + }, + { + "button": "button1", "count": 2, "modifiers": ["shift", "super"], + "press_command": "drag_select", + "press_args": {"by": "words", "subtractive": true} + }, + + // Drag select by lines + { + "button": "button1", "count": 3, + "press_command": "drag_select", + "press_args": {"by": "lines"} + }, + { + "button": "button1", "count": 3, "modifiers": ["super"], + "press_command": "drag_select", + "press_args": {"by": "lines", "additive": true} + }, + { + "button": "button1", "count": 3, "modifiers": ["shift", "super"], + "press_command": "drag_select", + "press_args": {"by": "lines", "subtractive": true} + }, + + // Alt + Mouse 1 Column select + { + "button": "button1", "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"by": "columns"} + }, + { + "button": "button1", "modifiers": ["alt", "super"], + "press_command": "drag_select", + "press_args": {"by": "columns", "additive": true} + }, + { + "button": "button1", "modifiers": ["alt", "shift", "super"], + "press_command": "drag_select", + "press_args": {"by": "columns", "subtractive": true} + }, + + // Mouse 3 column select + { + "button": "button3", + "press_command": "drag_select", + "press_args": {"by": "columns"} + }, + { + "button": "button3", "modifiers": ["super"], + "press_command": "drag_select", + "press_args": {"by": "columns", "additive": true} + }, + { + "button": "button3", "modifiers": ["shift", "super"], + "press_command": "drag_select", + "press_args": {"by": "columns", "subtractive": true} + }, + + // Switch files with buttons 4 and 5 + { "button": "button4", "modifiers": [], "command": "prev_view" }, + { "button": "button5", "modifiers": [], "command": "next_view" }, + + { "button": "button2", "modifiers": [], "press_command": "context_menu" }, + { "button": "button1", "count": 1, "modifiers": ["ctrl"], "press_command": "context_menu" } +] diff --git a/sublime-text/Default/Default (Windows).sublime-keymap b/sublime-text/Default/Default (Windows).sublime-keymap new file mode 100644 index 0000000..5bde08e --- /dev/null +++ b/sublime-text/Default/Default (Windows).sublime-keymap @@ -0,0 +1,641 @@ +[ + { "keys": ["ctrl+shift+n"], "command": "new_window" }, + { "keys": ["ctrl+shift+w"], "command": "close_window" }, + { "keys": ["ctrl+o"], "command": "prompt_open_file" }, + { "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, + { "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }, + { "keys": ["ctrl+n"], "command": "new_file" }, + { "keys": ["ctrl+s"], "command": "save" }, + { "keys": ["ctrl+shift+s"], "command": "prompt_save_as" }, + { "keys": ["ctrl+f4"], "command": "close_file" }, + { "keys": ["ctrl+w"], "command": "close" }, + + { "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" }, + { "keys": ["f11"], "command": "toggle_full_screen" }, + { "keys": ["shift+f11"], "command": "toggle_distraction_free" }, + + { "keys": ["backspace"], "command": "left_delete" }, + { "keys": ["shift+backspace"], "command": "left_delete" }, + { "keys": ["ctrl+shift+backspace"], "command": "left_delete" }, + { "keys": ["delete"], "command": "right_delete" }, + { "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} }, + { "keys": ["shift+enter"], "command": "insert", "args": {"characters": "\n"} }, + + { "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+shift+v"], "command": "paste_and_indent" }, + { "keys": ["shift+delete"], "command": "cut" }, + { "keys": ["ctrl+insert"], "command": "copy" }, + { "keys": ["shift+insert"], "command": "paste" }, + { "keys": ["ctrl+x"], "command": "cut" }, + { "keys": ["ctrl+c"], "command": "copy" }, + { "keys": ["ctrl+v"], "command": "paste" }, + + { "keys": ["left"], "command": "move", "args": {"by": "characters", "forward": false} }, + { "keys": ["right"], "command": "move", "args": {"by": "characters", "forward": true} }, + { "keys": ["up"], "command": "move", "args": {"by": "lines", "forward": false} }, + { "keys": ["down"], "command": "move", "args": {"by": "lines", "forward": true} }, + { "keys": ["shift+left"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true} }, + { "keys": ["shift+right"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true} }, + { "keys": ["shift+up"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true} }, + { "keys": ["shift+down"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true} }, + + { "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} }, + { "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true} }, + { "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} }, + { "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} }, + + { "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, + { "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, + { "keys": ["alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, + { "keys": ["alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, + + { "keys": ["ctrl+alt+up"], "command": "select_lines", "args": {"forward": false} }, + { "keys": ["ctrl+alt+down"], "command": "select_lines", "args": {"forward": true} }, + + { "keys": ["pageup"], "command": "move", "args": {"by": "pages", "forward": false} }, + { "keys": ["pagedown"], "command": "move", "args": {"by": "pages", "forward": true} }, + { "keys": ["shift+pageup"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} }, + { "keys": ["shift+pagedown"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} }, + + { "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} }, + + + { "keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 1.0 } }, + { "keys": ["ctrl+down"], "command": "scroll_lines", "args": {"amount": -1.0 } }, + + { "keys": ["ctrl+pagedown"], "command": "next_view" }, + { "keys": ["ctrl+pageup"], "command": "prev_view" }, + + { "keys": ["ctrl+tab"], "command": "next_view_in_stack" }, + { "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" }, + + { "keys": ["ctrl+a"], "command": "select_all" }, + { "keys": ["ctrl+shift+l"], "command": "split_selection_into_lines" }, + { "keys": ["escape"], "command": "single_selection", "context": + [ + { "key": "num_selections", "operator": "not_equal", "operand": 1 } + ] + }, + { "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 } + ] + }, + { "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": "hide_auto_complete", "context": + [ + { "key": "auto_complete_visible", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, + { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, + "context": + [ + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "replace_completion_with_next_completion", "context": + [ + { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "reindent", "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": "^$", "match_all": true }, + { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true } + ] + }, + { "keys": ["tab"], "command": "indent", "context": + [ + { "key": "text", "operator": "regex_contains", "operand": "\n" } + ] + }, + { "keys": ["tab"], "command": "next_field", "context": + [ + { "key": "has_next_field", "operator": "equal", "operand": true } + ] + }, + { "keys": ["tab"], "command": "commit_completion", "context": + [ + { "key": "auto_complete_visible" }, + { "key": "setting.auto_complete_commit_on_tab" } + ] + }, + + { "keys": ["shift+tab"], "command": "insert", "args": {"characters": "\t"} }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true } + ] + }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "preceding_text", "operator": "regex_match", "operand": "^[\t ]*" } + ] + }, + { "keys": ["shift+tab"], "command": "unindent", "context": + [ + { "key": "text", "operator": "regex_contains", "operand": "\n" } + ] + }, + { "keys": ["shift+tab"], "command": "prev_field", "context": + [ + { "key": "has_prev_field", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["ctrl+]"], "command": "indent" }, + { "keys": ["ctrl+["], "command": "unindent" }, + + { "keys": ["insert"], "command": "toggle_overwrite" }, + + { "keys": ["ctrl+l"], "command": "expand_selection", "args": {"to": "line"} }, + { "keys": ["ctrl+d"], "command": "find_under_expand" }, + { "keys": ["ctrl+k", "ctrl+d"], "command": "find_under_expand_skip" }, + { "keys": ["ctrl+shift+space"], "command": "expand_selection", "args": {"to": "scope"} }, + { "keys": ["ctrl+shift+m"], "command": "expand_selection", "args": {"to": "brackets"} }, + { "keys": ["ctrl+m"], "command": "move_to", "args": {"to": "brackets"} }, + { "keys": ["ctrl+shift+j"], "command": "expand_selection", "args": {"to": "indentation"} }, + { "keys": ["ctrl+shift+a"], "command": "expand_selection", "args": {"to": "tag"} }, + + { "keys": ["alt+."], "command": "close_tag" }, + + { "keys": ["ctrl+q"], "command": "toggle_record_macro" }, + { "keys": ["ctrl+shift+q"], "command": "run_macro" }, + + { "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, + { "keys": ["ctrl+shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line Before.sublime-macro"} }, + { "keys": ["enter"], "command": "commit_completion", "context": + [ + { "key": "auto_complete_visible" }, + { "key": "setting.auto_complete_commit_on_tab", "operand": false } + ] + }, + + { "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+alt+p"], "command": "prompt_select_project" }, + { "keys": ["ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, + { "keys": ["ctrl+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, + { "keys": ["ctrl+;"], "command": "show_overlay", "args": {"overlay": "goto", "text": "#"} }, + + { "keys": ["ctrl+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false} }, + { "keys": ["ctrl+shift+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":true} }, + { "keys": ["ctrl+f"], "command": "show_panel", "args": {"panel": "find"} }, + { "keys": ["ctrl+h"], "command": "show_panel", "args": {"panel": "replace"} }, + { "keys": ["ctrl+shift+h"], "command": "replace_next" }, + { "keys": ["f3"], "command": "find_next" }, + { "keys": ["shift+f3"], "command": "find_prev" }, + { "keys": ["ctrl+f3"], "command": "find_under" }, + { "keys": ["ctrl+shift+f3"], "command": "find_under_prev" }, + { "keys": ["alt+f3"], "command": "find_all_under" }, + { "keys": ["ctrl+e"], "command": "slurp_find_string" }, + { "keys": ["ctrl+shift+e"], "command": "slurp_replace_string" }, + { "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} }, + { "keys": ["f4"], "command": "next_result" }, + { "keys": ["shift+f4"], "command": "prev_result" }, + + { "keys": ["f6"], "command": "toggle_setting", "args": {"setting": "spell_check"} }, + { "keys": ["ctrl+f6"], "command": "next_misspelling" }, + { "keys": ["ctrl+shift+f6"], "command": "prev_misspelling" }, + + { "keys": ["ctrl+shift+up"], "command": "swap_line_up" }, + { "keys": ["ctrl+shift+down"], "command": "swap_line_down" }, + + { "keys": ["ctrl+backspace"], "command": "delete_word", "args": { "forward": false } }, + { "keys": ["ctrl+shift+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, + + { "keys": ["ctrl+delete"], "command": "delete_word", "args": { "forward": true } }, + { "keys": ["ctrl+shift+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + + { "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } }, + { "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } }, + + { "keys": ["ctrl+j"], "command": "join_lines" }, + { "keys": ["ctrl+shift+d"], "command": "duplicate_line" }, + + { "keys": ["ctrl+`"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, + + { "keys": ["ctrl+space"], "command": "auto_complete" }, + { "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context": + [ + { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, + { "key": "auto_complete_visible", "operator": "equal", "operand": false }, + { "key": "setting.tab_completion", "operator": "equal", "operand": true } + ] + }, + + { "keys": ["ctrl+alt+shift+p"], "command": "show_scope_name" }, + + { "keys": ["f7"], "command": "build" }, + { "keys": ["ctrl+b"], "command": "build" }, + { "keys": ["ctrl+shift+b"], "command": "build", "args": {"variant": "Run"} }, + { "keys": ["ctrl+break"], "command": "exec", "args": {"kill": true} }, + + { "keys": ["ctrl+t"], "command": "transpose" }, + + { "keys": ["f9"], "command": "sort_lines", "args": {"case_sensitive": false} }, + { "keys": ["ctrl+f9"], "command": "sort_lines", "args": {"case_sensitive": true} }, + + // Auto-pair quotes + { "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": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true } + ] + }, + { "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 } + ] + }, + + // Auto-pair single quotes + { "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": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true } + ] + }, + { "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 } + ] + }, + + // Auto-pair 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 } + ] + }, + { "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 } + ] + }, + + // Auto-pair square 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 } + ] + }, + { "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 } + ] + }, + + // 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 } + ] + }, + { "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 } + ] + }, + + { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": + [ + { "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": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } + ] + }, + { "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": + [ + { "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": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } + ] + }, + + { + "keys": ["alt+shift+1"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1]] + } + }, + { + "keys": ["alt+shift+2"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] + } + }, + { + "keys": ["alt+shift+3"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.33, 0.66, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] + } + }, + { + "keys": ["alt+shift+4"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.25, 0.5, 0.75, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] + } + }, + { + "keys": ["alt+shift+8"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] + } + }, + { + "keys": ["alt+shift+9"], + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.33, 0.66, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] + } + }, + { + "keys": ["alt+shift+5"], + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": + [ + [0, 0, 1, 1], [1, 0, 2, 1], + [0, 1, 1, 2], [1, 1, 2, 2] + ] + } + }, + { "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } }, + { "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } }, + { "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } }, + { "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } }, + { "keys": ["ctrl+shift+1"], "command": "move_to_group", "args": { "group": 0 } }, + { "keys": ["ctrl+shift+2"], "command": "move_to_group", "args": { "group": 1 } }, + { "keys": ["ctrl+shift+3"], "command": "move_to_group", "args": { "group": 2 } }, + { "keys": ["ctrl+shift+4"], "command": "move_to_group", "args": { "group": 3 } }, + { "keys": ["ctrl+0"], "command": "focus_side_bar" }, + + { "keys": ["alt+1"], "command": "select_by_index", "args": { "index": 0 } }, + { "keys": ["alt+2"], "command": "select_by_index", "args": { "index": 1 } }, + { "keys": ["alt+3"], "command": "select_by_index", "args": { "index": 2 } }, + { "keys": ["alt+4"], "command": "select_by_index", "args": { "index": 3 } }, + { "keys": ["alt+5"], "command": "select_by_index", "args": { "index": 4 } }, + { "keys": ["alt+6"], "command": "select_by_index", "args": { "index": 5 } }, + { "keys": ["alt+7"], "command": "select_by_index", "args": { "index": 6 } }, + { "keys": ["alt+8"], "command": "select_by_index", "args": { "index": 7 } }, + { "keys": ["alt+9"], "command": "select_by_index", "args": { "index": 8 } }, + { "keys": ["alt+0"], "command": "select_by_index", "args": { "index": 9 } }, + + { "keys": ["f2"], "command": "next_bookmark" }, + { "keys": ["shift+f2"], "command": "prev_bookmark" }, + { "keys": ["ctrl+f2"], "command": "toggle_bookmark" }, + { "keys": ["ctrl+shift+f2"], "command": "clear_bookmarks" }, + { "keys": ["alt+f2"], "command": "select_all_bookmarks" }, + + { "keys": ["ctrl+shift+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, + + { "keys": ["alt+q"], "command": "wrap_lines" }, + + { "keys": ["ctrl+k", "ctrl+u"], "command": "upper_case" }, + { "keys": ["ctrl+k", "ctrl+l"], "command": "lower_case" }, + + { "keys": ["ctrl+k", "ctrl+space"], "command": "set_mark" }, + { "keys": ["ctrl+k", "ctrl+a"], "command": "select_to_mark" }, + { "keys": ["ctrl+k", "ctrl+w"], "command": "delete_to_mark" }, + { "keys": ["ctrl+k", "ctrl+x"], "command": "swap_with_mark" }, + { "keys": ["ctrl+k", "ctrl+y"], "command": "yank" }, + { "keys": ["ctrl+k", "ctrl+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, + { "keys": ["ctrl+k", "ctrl+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, + { "keys": ["ctrl+k", "ctrl+g"], "command": "clear_bookmarks", "args": {"name": "mark"} }, + { "keys": ["ctrl+k", "ctrl+c"], "command": "show_at_center" }, + + { "keys": ["ctrl++"], "command": "increase_font_size" }, + { "keys": ["ctrl+="], "command": "increase_font_size" }, + { "keys": ["ctrl+keypad_plus"], "command": "increase_font_size" }, + { "keys": ["ctrl+-"], "command": "decrease_font_size" }, + { "keys": ["ctrl+keypad_minus"], "command": "decrease_font_size" }, + + { "keys": ["alt+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } }, + + { "keys": ["ctrl+shift+["], "command": "fold" }, + { "keys": ["ctrl+shift+]"], "command": "unfold" }, + { "keys": ["ctrl+k", "ctrl+1"], "command": "fold_by_level", "args": {"level": 1} }, + { "keys": ["ctrl+k", "ctrl+2"], "command": "fold_by_level", "args": {"level": 2} }, + { "keys": ["ctrl+k", "ctrl+3"], "command": "fold_by_level", "args": {"level": 3} }, + { "keys": ["ctrl+k", "ctrl+4"], "command": "fold_by_level", "args": {"level": 4} }, + { "keys": ["ctrl+k", "ctrl+5"], "command": "fold_by_level", "args": {"level": 5} }, + { "keys": ["ctrl+k", "ctrl+6"], "command": "fold_by_level", "args": {"level": 6} }, + { "keys": ["ctrl+k", "ctrl+7"], "command": "fold_by_level", "args": {"level": 7} }, + { "keys": ["ctrl+k", "ctrl+8"], "command": "fold_by_level", "args": {"level": 8} }, + { "keys": ["ctrl+k", "ctrl+9"], "command": "fold_by_level", "args": {"level": 9} }, + { "keys": ["ctrl+k", "ctrl+0"], "command": "unfold_all" }, + { "keys": ["ctrl+k", "ctrl+j"], "command": "unfold_all" }, + { "keys": ["ctrl+k", "ctrl+t"], "command": "fold_tag_attributes" }, + + { "keys": ["context_menu"], "command": "context_menu" }, + + { "keys": ["alt+c"], "command": "toggle_case_sensitive", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["alt+r"], "command": "toggle_regex", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["alt+w"], "command": "toggle_whole_word", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + { "keys": ["alt+a"], "command": "toggle_preserve_case", "context": + [ + { "key": "setting.is_widget", "operator": "equal", "operand": true } + ] + }, + + // Find panel key bindings + { "keys": ["enter"], "command": "find_next", "context": + [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] + }, + + // Replace panel key bindings + { "keys": ["enter"], "command": "find_next", "context": + [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + { "keys": ["ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] + }, + + // Incremental find panel key bindings + { "keys": ["enter"], "command": "hide_panel", "context": + [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["shift+enter"], "command": "find_prev", "context": + [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + }, + { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, + "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] + } +] diff --git a/sublime-text/Default/Default (Windows).sublime-mousemap b/sublime-text/Default/Default (Windows).sublime-mousemap new file mode 100644 index 0000000..748418e --- /dev/null +++ b/sublime-text/Default/Default (Windows).sublime-mousemap @@ -0,0 +1,131 @@ +[ + // Basic drag select + { + "button": "button1", "count": 1, + "press_command": "drag_select" + }, + { + "button": "button1", "count": 1, "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"additive": true} + }, + { + "button": "button1", "count": 1, "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"subtractive": true} + }, + + // Select between selection and click location + { + "button": "button1", "modifiers": ["shift"], + "press_command": "drag_select", + "press_args": {"extend": true} + }, + { + "button": "button1", "modifiers": ["shift", "ctrl"], + "press_command": "drag_select", + "press_args": {"additive": true, "extend": true} + }, + { + "button": "button1", "modifiers": ["shift", "alt"], + "press_command": "drag_select", + "press_args": {"subtractive": true, "extend": true} + }, + + // Drag select by words + { + "button": "button1", "count": 2, + "press_command": "drag_select", + "press_args": {"by": "words"} + }, + { + "button": "button1", "count": 2, "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"by": "words", "additive": true} + }, + { + "button": "button1", "count": 2, "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"by": "words", "subtractive": true} + }, + + // Drag select by lines + { + "button": "button1", "count": 3, + "press_command": "drag_select", + "press_args": {"by": "lines"} + }, + { + "button": "button1", "count": 3, "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"by": "lines", "additive": true} + }, + { + "button": "button1", "count": 3, "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"by": "lines", "subtractive": true} + }, + + // Shift + Mouse 2 Column select + { + "button": "button2", "modifiers": ["shift"], + "press_command": "drag_select", + "press_args": {"by": "columns"} + }, + { + "button": "button2", "modifiers": ["shift", "ctrl"], + "press_command": "drag_select", + "press_args": {"by": "columns", "additive": true} + }, + { + "button": "button2", "modifiers": ["shift", "alt"], + "press_command": "drag_select", + "press_args": {"by": "columns", "subtractive": true} + }, + + // Mouse 3 column select + { + "button": "button3", + "press_command": "drag_select", + "press_args": {"by": "columns"} + }, + { + "button": "button3", "modifiers": ["ctrl"], + "press_command": "drag_select", + "press_args": {"by": "columns", "additive": true} + }, + { + "button": "button3", "modifiers": ["alt"], + "press_command": "drag_select", + "press_args": {"by": "columns", "subtractive": true} + }, + + // Simple chording: hold down mouse 2, and click mouse 1 + { + "button": "button1", "count": 1, "modifiers": ["button2"], + "command": "expand_selection", "args": {"to": "line"}, + "press_command": "drag_select" + }, + { + "button": "button1", "count": 2, "modifiers": ["button2"], + "command": "expand_selection_to_paragraph" + }, + { + "button": "button1", "count": 3, "modifiers": ["button2"], + "command": "select_all" + }, + + // Switch files with buttons 4 and 5 + { "button": "button4", "modifiers": [], "command": "prev_view" }, + { "button": "button5", "modifiers": [], "command": "next_view" }, + + // Switch files by holding down button 2, and using the scroll wheel + { "button": "scroll_down", "modifiers": ["button2"], "command": "next_view" }, + { "button": "scroll_up", "modifiers": ["button2"], "command": "prev_view" }, + + // Change font size with ctrl+scroll wheel + { "button": "scroll_down", "modifiers": ["ctrl"], "command": "decrease_font_size" }, + { "button": "scroll_up", "modifiers": ["ctrl"], "command": "increase_font_size" }, + + { "button": "button2", "modifiers": [], "command": "context_menu" } +] diff --git a/sublime-text/Default/Default.sublime-commands b/sublime-text/Default/Default.sublime-commands new file mode 100644 index 0000000..88e3318 --- /dev/null +++ b/sublime-text/Default/Default.sublime-commands @@ -0,0 +1,118 @@ +[ + { + "caption": "Word Wrap: Toggle", + "command": "toggle_setting", + "args": {"setting": "word_wrap"} + }, + { + "caption": "Convert Case: Upper Case", + "command": "upper_case" + }, + { + "caption": "Convert Case: Lower Case", + "command": "lower_case" + }, + { + "caption": "Convert Case: Title Case", + "command": "title_case" + }, + { + "caption": "Convert Case: Swap Case", + "command": "swap_case" + }, + + { "command": "toggle_comment", "args": {"block": false}, "caption": "Toggle Comment" }, + { "command": "toggle_comment", "args": {"block": true}, "caption": "Toggle Block Comment" }, + + { "command": "toggle_bookmark", "caption": "Bookmarks: Toggle" }, + { "command": "next_bookmark", "caption": "Bookmarks: Select Next" }, + { "command": "prev_bookmark", "caption": "Bookmarks: Select Previous" }, + { "command": "clear_bookmarks", "caption": "Bookmarks: Clear All" }, + { "command": "select_all_bookmarks", "caption": "Bookmarks: Select All" }, + + { "caption": "Indentation: Convert to Tabs", "command": "unexpand_tabs", "args": {"set_translate_tabs": true} }, + { "caption": "Indentation: Convert to Spaces", "command": "expand_tabs", "args": {"set_translate_tabs": true} }, + { "caption": "Indentation: Reindent Lines", "command": "reindent", "args": {"single_line": false} }, + + { "caption": "View: Toggle Side Bar", "command": "toggle_side_bar" }, + { "caption": "View: Toggle Open Files in Side Bar", "command": "toggle_show_open_files" }, + { "caption": "View: Toggle Minimap", "command": "toggle_minimap" }, + { "caption": "View: Toggle Tabs", "command": "toggle_tabs" }, + { "caption": "View: Toggle Status Bar", "command": "toggle_status_bar" }, + { "caption": "View: Toggle Menu", "command": "toggle_menu" }, + + { "caption": "Project: Save As", "command": "save_project_as" }, + { "caption": "Project: Close", "command": "close_project" }, + { "caption": "Project: Add Folder", "command": "prompt_add_folder" }, + + { "caption": "Preferences: Settings - Default", "command": "open_file", "args": {"file": "${packages}/Default/Preferences.sublime-settings"} }, + { "caption": "Preferences: Settings - User", "command": "open_file", "args": {"file": "${packages}/User/Preferences.sublime-settings"} }, + { "caption": "Preferences: Browse Packages", "command": "open_dir", "args": {"dir": "$packages"} }, + + { + "caption": "Preferences: Key Bindings - Default", + "command": "open_file", "args": + { + "file": "${packages}/Default/Default (Windows).sublime-keymap", + "platform": "Windows" + } + }, + { + "caption": "Preferences: Key Bindings - Default", + "command": "open_file", "args": + { + "file": "${packages}/Default/Default (OSX).sublime-keymap", + "platform": "OSX" + } + }, + { + "caption": "Preferences: Key Bindings - Default", + "command": "open_file", "args": + { + "file": "${packages}/Default/Default (Linux).sublime-keymap", + "platform": "Linux" + } + }, + { + "caption": "Preferences: Key Bindings - User", + "command": "open_file", "args": + { + "file": "${packages}/User/Default (Windows).sublime-keymap", + "platform": "Windows" + } + }, + { + "caption": "Preferences: Key Bindings - User", + "command": "open_file", "args": + { + "file": "${packages}/User/Default (OSX).sublime-keymap", + "platform": "OSX" + } + }, + { + "caption": "Preferences: Key Bindings - User", + "command": "open_file", "args": + { + "file": "${packages}/User/Default (Linux).sublime-keymap", + "platform": "Linux" + } + }, + + { "caption": "File: Save All", "command": "save_all" }, + { "caption": "File: Revert", "command": "revert" }, + { "caption": "File: New View into File", "command": "clone_file" }, + { "caption": "File: Close All", "command": "close_all" }, + + { "caption": "HTML: Wrap Selection With Tag", "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } }, + { "caption": "HTML: Encode Special Characters", "command": "encode_html_entities" }, + + { "caption": "Rot13 Selection", "command": "rot13" }, + + { "caption": "Sort Lines", "command": "sort_lines", "args": {"case_sensitive": false} }, + { "caption": "Sort Lines (Case Sensitive)", "command": "sort_lines", "args": {"case_sensitive": true} }, + + { "caption": "Code Folding: Unfold All", "command": "unfold_all" }, + { "caption": "Code Folding: Fold Tag Attributes", "command": "fold_tag_attributes" }, + + { "caption": "About", "command": "show_about_window" } +] diff --git a/sublime-text/Default/Delete Left Right.sublime-macro b/sublime-text/Default/Delete Left Right.sublime-macro new file mode 100644 index 0000000..e6946e6 --- /dev/null +++ b/sublime-text/Default/Delete Left Right.sublime-macro @@ -0,0 +1,4 @@ +[ + {"command": "left_delete" }, + {"command": "right_delete" } +] diff --git a/sublime-text/Default/Delete Line.sublime-macro b/sublime-text/Default/Delete Line.sublime-macro new file mode 100644 index 0000000..5fecdcb --- /dev/null +++ b/sublime-text/Default/Delete Line.sublime-macro @@ -0,0 +1,5 @@ +[ + {"command": "expand_selection", "args": {"to": "line"}}, + {"command": "add_to_kill_ring", "args": {"forward": true}}, + {"command": "left_delete"} +] diff --git a/sublime-text/Default/Delete to BOL.sublime-macro b/sublime-text/Default/Delete to BOL.sublime-macro new file mode 100644 index 0000000..9697284 --- /dev/null +++ b/sublime-text/Default/Delete to BOL.sublime-macro @@ -0,0 +1,5 @@ +[ + {"command": "move_to", "args": {"to": "bol", "extend": true}}, + {"command": "add_to_kill_ring", "args": {"forward": false}}, + {"command": "left_delete"} +] diff --git a/sublime-text/Default/Delete to EOL.sublime-macro b/sublime-text/Default/Delete to EOL.sublime-macro new file mode 100644 index 0000000..3af8234 --- /dev/null +++ b/sublime-text/Default/Delete to EOL.sublime-macro @@ -0,0 +1,5 @@ +[ + {"command": "move_to", "args": {"to": "eol", "extend": true}}, + {"command": "add_to_kill_ring", "args": {"forward": true}}, + {"command": "right_delete"} +] diff --git a/sublime-text/Default/Delete to Hard BOL.sublime-macro b/sublime-text/Default/Delete to Hard BOL.sublime-macro new file mode 100644 index 0000000..947de20 --- /dev/null +++ b/sublime-text/Default/Delete to Hard BOL.sublime-macro @@ -0,0 +1,5 @@ +[ + {"command": "move_to", "args": {"to": "hardbol", "extend": true}}, + {"command": "add_to_kill_ring", "args": {"forward": false}}, + {"command": "left_delete"} +] diff --git a/sublime-text/Default/Delete to Hard EOL.sublime-macro b/sublime-text/Default/Delete to Hard EOL.sublime-macro new file mode 100644 index 0000000..153395f --- /dev/null +++ b/sublime-text/Default/Delete to Hard EOL.sublime-macro @@ -0,0 +1,5 @@ +[ + {"command": "move_to", "args": {"to": "hardeol", "extend": true}}, + {"command": "add_to_kill_ring", "args": {"forward": true}}, + {"command": "right_delete"} +] diff --git a/sublime-text/Default/Distraction Free.sublime-settings b/sublime-text/Default/Distraction Free.sublime-settings new file mode 100644 index 0000000..ddbae8d --- /dev/null +++ b/sublime-text/Default/Distraction Free.sublime-settings @@ -0,0 +1,8 @@ +{ + "line_numbers": false, + "gutter": false, + "draw_centered": true, + "wrap_width": 80, + "word_wrap": true, + "scroll_past_end": true +} diff --git a/sublime-text/Default/Find Results.hidden-tmLanguage b/sublime-text/Default/Find Results.hidden-tmLanguage new file mode 100644 index 0000000..4488707 --- /dev/null +++ b/sublime-text/Default/Find Results.hidden-tmLanguage @@ -0,0 +1,50 @@ + + + + + name + Find Results + + patterns + + + match + ^([^ ].*):$ + captures + + 1 + + name + entity.name.filename.find-in-files + + + + + match + ^ +([0-9]+) + captures + + 1 + + name + constant.numeric.line-number.find-in-files + + + + + match + ^ +([0-9]+): + captures + + 1 + + name + constant.numeric.line-number.match.find-in-files + + + + + scopeName + text.find-in-files + + diff --git a/sublime-text/Default/Find in Files.sublime-menu b/sublime-text/Default/Find in Files.sublime-menu new file mode 100644 index 0000000..2101553 --- /dev/null +++ b/sublime-text/Default/Find in Files.sublime-menu @@ -0,0 +1,8 @@ +[ + { "command": "clear_location", "caption": "Clear" }, + { "command": "add_directory", "caption": "Add Folder" }, + { "command": "add_where_snippet", "args": {"snippet": "*.${0:txt}"}, "caption": "Add Include Filter" }, + { "command": "add_where_snippet", "args": {"snippet": "-*.${0:txt}"}, "caption": "Add Exclude Filter" }, + { "command": "add_where_snippet", "args": {"snippet": ""}, "caption": "Add Open Folders" }, + { "command": "add_where_snippet", "args": {"snippet": ""}, "caption": "Add Open Files" } +] diff --git a/sublime-text/Default/Icon.png b/sublime-text/Default/Icon.png new file mode 100644 index 0000000..82d904c Binary files /dev/null and b/sublime-text/Default/Icon.png differ diff --git a/sublime-text/Default/Ignored Packages.cache b/sublime-text/Default/Ignored Packages.cache new file mode 100644 index 0000000..27b92a5 --- /dev/null +++ b/sublime-text/Default/Ignored Packages.cache @@ -0,0 +1 @@ +["Vintage"] \ No newline at end of file diff --git a/sublime-text/Default/Indentation Rules - Comments.tmPreferences b/sublime-text/Default/Indentation Rules - Comments.tmPreferences new file mode 100644 index 0000000..8cb6749 --- /dev/null +++ b/sublime-text/Default/Indentation Rules - Comments.tmPreferences @@ -0,0 +1,13 @@ + + + + + scope + comment + settings + + preserveIndent + + + + diff --git a/sublime-text/Default/Indentation Rules - Comments.tmPreferences.cache b/sublime-text/Default/Indentation Rules - Comments.tmPreferences.cache new file mode 100644 index 0000000..fa56901 Binary files /dev/null and b/sublime-text/Default/Indentation Rules - Comments.tmPreferences.cache differ diff --git a/sublime-text/Default/Indentation Rules.tmPreferences b/sublime-text/Default/Indentation Rules.tmPreferences new file mode 100644 index 0000000..1688681 --- /dev/null +++ b/sublime-text/Default/Indentation Rules.tmPreferences @@ -0,0 +1,19 @@ + + + + + scope + source + settings + + decreaseIndentPattern + ^(.*\*/)?\s*\}[;\s]*$ + increaseIndentPattern + ^.*(\{[^}"']*)$ + disableIndentNextLinePattern + ^\s*\{[\]})]*\s*$ + indentParens + + + + diff --git a/sublime-text/Default/Indentation Rules.tmPreferences.cache b/sublime-text/Default/Indentation Rules.tmPreferences.cache new file mode 100644 index 0000000..6b34a51 Binary files /dev/null and b/sublime-text/Default/Indentation Rules.tmPreferences.cache differ diff --git a/sublime-text/Default/Indentation.sublime-menu b/sublime-text/Default/Indentation.sublime-menu new file mode 100644 index 0000000..9c49375 --- /dev/null +++ b/sublime-text/Default/Indentation.sublime-menu @@ -0,0 +1,17 @@ +[ +{ "command": "toggle_setting", "args": {"setting": "translate_tabs_to_spaces"}, "caption": "Indent Using Spaces", "checkbox": true }, + { "caption": "-" }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 1}, "caption": "Tab Width: 1", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 2}, "caption": "Tab Width: 2", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 3}, "caption": "Tab Width: 3", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 4}, "caption": "Tab Width: 4", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 5}, "caption": "Tab Width: 5", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 6}, "caption": "Tab Width: 6", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 7}, "caption": "Tab Width: 7", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 8}, "caption": "Tab Width: 8", "checkbox": true }, + { "caption": "-" }, + { "command": "detect_indentation", "caption": "Guess Settings From Buffer" }, + { "caption": "-" }, + { "command": "expand_tabs", "caption": "Convert Indentation to Spaces", "args": {"set_translate_tabs": true} }, + { "command": "unexpand_tabs", "caption": "Convert Indentation to Tabs", "args": {"set_translate_tabs": true} } + ] diff --git a/sublime-text/Default/Main.sublime-menu b/sublime-text/Default/Main.sublime-menu new file mode 100644 index 0000000..459abe7 --- /dev/null +++ b/sublime-text/Default/Main.sublime-menu @@ -0,0 +1,809 @@ +[ + { + "caption": "File", + "mnemonic": "F", + "id": "file", + "children": + [ + { "command": "new_file", "caption": "New File", "mnemonic": "N" }, + + { "command": "prompt_open_file", "caption": "Open File…", "mnemonic": "O", "platform": "!OSX" }, + { "command": "prompt_open_folder", "caption": "Open Folder…", "platform": "!OSX" }, + { "command": "prompt_open", "caption": "Open…", "platform": "OSX" }, + + { + "caption": "Open Recent", + "mnemonic": "R", + "children": + [ + { "command": "reopen_last_file", "caption": "Reopen Closed File" }, + { "caption": "-" }, + { "command": "open_recent_file", "args": {"index": 0 } }, + { "command": "open_recent_file", "args": {"index": 1 } }, + { "command": "open_recent_file", "args": {"index": 2 } }, + { "command": "open_recent_file", "args": {"index": 3 } }, + { "command": "open_recent_file", "args": {"index": 4 } }, + { "command": "open_recent_file", "args": {"index": 5 } }, + { "command": "open_recent_file", "args": {"index": 6 } }, + { "command": "open_recent_file", "args": {"index": 7 } }, + { "caption": "-" }, + { "command": "open_recent_folder", "args": {"index": 0 } }, + { "command": "open_recent_folder", "args": {"index": 1 } }, + { "command": "open_recent_folder", "args": {"index": 2 } }, + { "command": "open_recent_folder", "args": {"index": 3 } }, + { "command": "open_recent_folder", "args": {"index": 4 } }, + { "command": "open_recent_folder", "args": {"index": 5 } }, + { "command": "open_recent_folder", "args": {"index": 6 } }, + { "command": "open_recent_folder", "args": {"index": 7 } }, + { "caption": "-" }, + { "command": "clear_recent_files", "caption": "Clear Items" } + ] + }, + { + "caption": "Reopen with Encoding", + "children": + [ + { "caption": "UTF-8", "command": "reopen", "args": {"encoding": "utf-8" } }, + { "caption": "UTF-16 LE", "command": "reopen", "args": {"encoding": "utf-16 le" } }, + { "caption": "UTF-16 BE", "command": "reopen", "args": {"encoding": "utf-16 be" } }, + { "caption": "-" }, + { "caption": "Western (Windows 1252)", "command": "reopen", "args": {"encoding": "Western (Windows 1252)" } }, + { "caption": "Western (ISO 8859-1)", "command": "reopen", "args": {"encoding": "Western (ISO 8859-1)" } }, + { "caption": "Western (ISO 8859-3)", "command": "reopen", "args": {"encoding": "Western (ISO 8859-3)" } }, + { "caption": "Western (ISO 8859-15)", "command": "reopen", "args": {"encoding": "Western (ISO 8859-15)" } }, + { "caption": "Western (Mac Roman)", "command": "reopen", "args": {"encoding": "Western (Mac Roman)" } }, + { "caption": "DOS (CP 437)", "command": "reopen", "args": {"encoding": "DOS (CP 437)" } }, + { "caption": "Arabic (Windows 1256)", "command": "reopen", "args": {"encoding": "Arabic (Windows 1256)" } }, + { "caption": "Arabic (ISO 8859-6)", "command": "reopen", "args": {"encoding": "Arabic (ISO 8859-6)" } }, + { "caption": "Baltic (Windows 1257)", "command": "reopen", "args": {"encoding": "Baltic (Windows 1257)" } }, + { "caption": "Baltic (ISO 8859-4)", "command": "reopen", "args": {"encoding": "Baltic (ISO 8859-4)" } }, + { "caption": "Celtic (ISO 8859-14)", "command": "reopen", "args": {"encoding": "Celtic (ISO 8859-14)" } }, + { "caption": "Central European (Windows 1250)", "command": "reopen", "args": {"encoding": "Central European (Windows 1250)" } }, + { "caption": "Central European (ISO 8859-2)", "command": "reopen", "args": {"encoding": "Central European (ISO 8859-2)" } }, + { "caption": "Cyrillic (Windows 1251)", "command": "reopen", "args": {"encoding": "Cyrillic (Windows 1251)" } }, + { "caption": "Cyrillic (Windows 866)", "command": "reopen", "args": {"encoding": "Cyrillic (Windows 866)" } }, + { "caption": "Cyrillic (ISO 8859-5)", "command": "reopen", "args": {"encoding": "Cyrillic (ISO 8859-5)" } }, + { "caption": "Cyrillic (KOI8-R)", "command": "reopen", "args": {"encoding": "Cyrillic (KOI8-R)" } }, + { "caption": "Cyrillic (KOI8-U)", "command": "reopen", "args": {"encoding": "Cyrillic (KOI8-U)" } }, + { "caption": "Estonian (ISO 8859-13)", "command": "reopen", "args": {"encoding": "Estonian (ISO 8859-13)" } }, + { "caption": "Greek (Windows 1253)", "command": "reopen", "args": {"encoding": "Greek (Windows 1253)" } }, + { "caption": "Greek (ISO 8859-7)", "command": "reopen", "args": {"encoding": "Greek (ISO 8859-7)" } }, + { "caption": "Hebrew (Windows 1255)", "command": "reopen", "args": {"encoding": "Hebrew (Windows 1255)" } }, + { "caption": "Hebrew (ISO 8859-8)", "command": "reopen", "args": {"encoding": "Hebrew (ISO 8859-8)" } }, + { "caption": "Nordic (ISO 8859-10)", "command": "reopen", "args": {"encoding": "Nordic (ISO 8859-10)" } }, + { "caption": "Romanian (ISO 8859-16)", "command": "reopen", "args": {"encoding": "Romanian (ISO 8859-16)" } }, + { "caption": "Turkish (Windows 1254)", "command": "reopen", "args": {"encoding": "Turkish (Windows 1254)" } }, + { "caption": "Turkish (ISO 8859-9)", "command": "reopen", "args": {"encoding": "Turkish (ISO 8859-9)" } }, + { "caption": "Vietnamese (Windows 1258)", "command": "reopen", "args": {"encoding": "Vietnamese (Windows 1258)" } }, + { "caption": "-" }, + { "caption": "Hexadecimal", "command": "reopen", "args": {"encoding": "Hexadecimal" } } + ] + }, + { "command": "clone_file", "caption": "New View into File", "mnemonic": "e" }, + { "command": "save", "caption": "Save", "mnemonic": "S" }, + { + "caption": "Save with Encoding", + "children": + [ + { "caption": "UTF-8", "command": "save", "args": {"encoding": "utf-8" } }, + { "caption": "UTF-8 with BOM", "command": "save", "args": {"encoding": "utf-8 with bom" } }, + { "caption": "UTF-16 LE", "command": "save", "args": {"encoding": "utf-16 le" } }, + { "caption": "UTF-16 LE with BOM", "command": "save", "args": {"encoding": "utf-16 le with bom" } }, + { "caption": "UTF-16 BE", "command": "save", "args": {"encoding": "utf-16 be" } }, + { "caption": "UTF-16 BE with BOM", "command": "save", "args": {"encoding": "utf-16 be with bom" } }, + { "caption": "-" }, + { "caption": "Western (Windows 1252)", "command": "save", "args": {"encoding": "Western (Windows 1252)" } }, + { "caption": "Western (ISO 8859-1)", "command": "save", "args": {"encoding": "Western (ISO 8859-1)" } }, + { "caption": "Western (ISO 8859-3)", "command": "save", "args": {"encoding": "Western (ISO 8859-3)" } }, + { "caption": "Western (ISO 8859-15)", "command": "save", "args": {"encoding": "Western (ISO 8859-15)" } }, + { "caption": "Western (Mac Roman)", "command": "save", "args": {"encoding": "Western (Mac Roman)" } }, + { "caption": "DOS (CP 437)", "command": "save", "args": {"encoding": "DOS (CP 437)" } }, + { "caption": "Arabic (Windows 1256)", "command": "save", "args": {"encoding": "Arabic (Windows 1256)" } }, + { "caption": "Arabic (ISO 8859-6)", "command": "save", "args": {"encoding": "Arabic (ISO 8859-6)" } }, + { "caption": "Baltic (Windows 1257)", "command": "save", "args": {"encoding": "Baltic (Windows 1257)" } }, + { "caption": "Baltic (ISO 8859-4)", "command": "save", "args": {"encoding": "Baltic (ISO 8859-4)" } }, + { "caption": "Celtic (ISO 8859-14)", "command": "save", "args": {"encoding": "Celtic (ISO 8859-14)" } }, + { "caption": "Central European (Windows 1250)", "command": "save", "args": {"encoding": "Central European (Windows 1250)" } }, + { "caption": "Central European (ISO 8859-2)", "command": "save", "args": {"encoding": "Central European (ISO 8859-2)" } }, + { "caption": "Cyrillic (Windows 1251)", "command": "save", "args": {"encoding": "Cyrillic (Windows 1251)" } }, + { "caption": "Cyrillic (Windows 866)", "command": "save", "args": {"encoding": "Cyrillic (Windows 866)" } }, + { "caption": "Cyrillic (ISO 8859-5)", "command": "save", "args": {"encoding": "Cyrillic (ISO 8859-5)" } }, + { "caption": "Cyrillic (KOI8-R)", "command": "save", "args": {"encoding": "Cyrillic (KOI8-R)" } }, + { "caption": "Cyrillic (KOI8-U)", "command": "save", "args": {"encoding": "Cyrillic (KOI8-U)" } }, + { "caption": "Estonian (ISO 8859-13)", "command": "save", "args": {"encoding": "Estonian (ISO 8859-13)" } }, + { "caption": "Greek (Windows 1253)", "command": "save", "args": {"encoding": "Greek (Windows 1253)" } }, + { "caption": "Greek (ISO 8859-7)", "command": "save", "args": {"encoding": "Greek (ISO 8859-7)" } }, + { "caption": "Hebrew (Windows 1255)", "command": "save", "args": {"encoding": "Hebrew (Windows 1255)" } }, + { "caption": "Hebrew (ISO 8859-8)", "command": "save", "args": {"encoding": "Hebrew (ISO 8859-8)" } }, + { "caption": "Nordic (ISO 8859-10)", "command": "save", "args": {"encoding": "Nordic (ISO 8859-10)" } }, + { "caption": "Romanian (ISO 8859-16)", "command": "save", "args": {"encoding": "Romanian (ISO 8859-16)" } }, + { "caption": "Turkish (Windows 1254)", "command": "save", "args": {"encoding": "Turkish (Windows 1254)" } }, + { "caption": "Turkish (ISO 8859-9)", "command": "save", "args": {"encoding": "Turkish (ISO 8859-9)" } }, + { "caption": "Vietnamese (Windows 1258)", "command": "save", "args": {"encoding": "Vietnamese (Windows 1258)" } }, + { "caption": "-" }, + { "caption": "Hexadecimal", "command": "save", "args": {"encoding": "Hexadecimal" } } + ] + }, + { "command": "prompt_save_as", "caption": "Save As…", "mnemonic": "A" }, + { "command": "save_all", "caption": "Save All", "mnemonic": "l" }, + { "caption": "-", "id": "window" }, + { "command": "new_window", "caption": "New Window", "mnemonic": "W" }, + { "command": "close_window", "caption": "Close Window" }, + { "caption": "-", "id": "close" }, + { "command": "close", "caption": "Close File", "mnemonic": "C" }, + { "command": "revert", "caption": "Revert File", "mnemonic": "v" }, + { "command": "close_all", "caption": "Close All Files" }, + { "caption": "-", "id": "exit" }, + { "command": "exit", "mnemonic": "x" } + ] + }, + { + "caption": "Edit", + "mnemonic": "E", + "id": "edit", + "children": + [ + { "command": "undo", "mnemonic": "U" }, + { "command": "redo_or_repeat", "mnemonic": "R" }, + { + "caption": "Undo Selection", + "children": + [ + { "command": "soft_undo" }, + { "command": "soft_redo" } + ] + }, + { "caption": "-", "id": "clipboard" }, + { "command": "copy", "mnemonic": "C" }, + { "command": "cut", "mnemonic": "n" }, + { "command": "paste", "mnemonic": "P" }, + { "command": "paste_and_indent", "mnemonic": "I" }, + { "caption": "-" }, + { + "caption": "Line", "mnemonic": "L", + "id": "line", + "children": + [ + { "command": "indent" }, + { "command": "unindent" }, + { "command": "reindent", "args": {"single_line": true} }, + { "command": "swap_line_up" }, + { "command": "swap_line_down" }, + { "command": "duplicate_line" }, + { "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"}, "caption": "Delete Line" }, + { "command": "join_lines" } + ] + }, + { + "caption": "Comment", "mnemonic": "m", + "id": "comment", + "children": + [ + { "command": "toggle_comment", "args": {"block": false}, "caption": "Toggle Comment" }, + { "command": "toggle_comment", "args": {"block": true}, "caption": "Toggle Block Comment" } + ] + }, + { + "caption": "Text", "mnemonic": "T", + "id": "text", + "children": + [ + { "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line Before.sublime-macro"}, "caption": "Insert Line Before" }, + { "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"}, "caption": "Insert Line After" }, + { "caption": "-" }, + { "command": "delete_word", "args": { "forward": true }, "caption": "Delete Word Forward" }, + { "command": "delete_word", "args": { "forward": false }, "caption": "Delete Word Backward" }, + { "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"}, "caption": "Delete Line" }, + { "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"}, "caption": "Delete to End" }, + { "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"}, "caption": "Delete to Beginning" }, + { "caption": "-" }, + { "command": "transpose" } + ] + }, + { + "caption": "Tag", + "id": "tag", + "children": + [ + { "command": "close_tag" }, + { "command": "expand_selection", "args": {"to": "tag"}, "caption": "Expand Selection to Tag" }, + { "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" }, "caption": "Wrap Selection With Tag" } + ] + }, + { + "caption": "Mark", + "id": "mark", + "children": + [ + { "command": "set_mark" }, + { "command": "select_to_mark" }, + { "command": "delete_to_mark" }, + { "command": "swap_with_mark" }, + { "command": "clear_bookmarks", "args": {"name": "mark"}, "caption": "Clear Mark" }, + { "caption": "-" }, + { "command": "yank" } + ] + }, + { + "caption": "Code Folding", + "id": "fold", + "children": + [ + { "command": "fold" }, + { "command": "unfold" }, + { "command": "unfold_all", "caption": "Unfold All" }, + { "caption": "-" }, + { "caption": "Fold All", "command": "fold_by_level", "args": {"level": 1} }, + { "caption": "Fold Level 2", "command": "fold_by_level", "args": {"level": 2} }, + { "caption": "Fold Level 3", "command": "fold_by_level", "args": {"level": 3} }, + { "caption": "Fold Level 4", "command": "fold_by_level", "args": {"level": 4} }, + { "caption": "Fold Level 5", "command": "fold_by_level", "args": {"level": 5} }, + { "caption": "Fold Level 6", "command": "fold_by_level", "args": {"level": 6} }, + { "caption": "Fold Level 7", "command": "fold_by_level", "args": {"level": 7} }, + { "caption": "Fold Level 8", "command": "fold_by_level", "args": {"level": 8} }, + { "caption": "Fold Level 9", "command": "fold_by_level", "args": {"level": 9} }, + { "caption": "-" }, + { "command": "fold_tag_attributes", "caption": "Fold Tag Attributes" } + ] + }, + { + "caption": "Convert Case", "mnemonic": "a", + "id": "convert_case", + "children": + [ + { "command": "title_case", "caption": "Title Case" }, + { "command": "upper_case", "caption": "Upper Case" }, + { "command": "lower_case", "caption": "Lower Case" }, + { "command": "swap_case", "caption": "Swap Case" } + ] + }, + { + "caption": "Wrap", + "id": "wrap", + "children": + [ + { "command": "wrap_lines", "caption": "Wrap Paragraph at Ruler" }, + { "command": "wrap_lines", "args": {"width": 70}, "caption": "Wrap paragraph at 70 characters" }, + { "command": "wrap_lines", "args": {"width": 78}, "caption": "Wrap paragraph at 78 characters" }, + { "command": "wrap_lines", "args": {"width": 80}, "caption": "Wrap paragraph at 80 characters" }, + { "command": "wrap_lines", "args": {"width": 100}, "caption": "Wrap paragraph at 100 characters" }, + { "command": "wrap_lines", "args": {"width": 120}, "caption": "Wrap paragraph at 120 characters" } + ] + }, + { "command": "auto_complete", "caption": "Show Completions" }, + { "caption": "-", "id": "permute" }, + + { "command": "sort_lines", "args": {"case_sensitive": false}, "caption": "Sort Lines", "mnemonic": "S" }, + { "command": "sort_lines", "args": {"case_sensitive": true}, "caption": "Sort Lines (Case Sensitive)" }, + { + "caption": "Permute Lines", + "children": + [ + { "command": "permute_lines", "args": {"operation": "reverse"}, "caption": "Reverse" }, + { "command": "permute_lines", "args": {"operation": "unique"}, "caption": "Unique" }, + { "command": "permute_lines", "args": {"operation": "shuffle"}, "caption": "Shuffle" } + ] + }, + { + "caption": "Permute Selections", + "children": + [ + { "command": "sort_selection", "args": {"case_sensitive": false}, "caption": "Sort" }, + { "command": "sort_selection", "args": {"case_sensitive": true}, "caption": "Sort (Case Sensitive)" }, + { "command": "permute_selection", "args": {"operation": "reverse"}, "caption": "Reverse" }, + { "command": "permute_selection", "args": {"operation": "unique"}, "caption": "Unique" }, + { "command": "permute_selection", "args": {"operation": "shuffle"}, "caption": "Shuffle" } + ] + }, + { "caption": "-", "id": "end" } + ] + }, + { + "caption": "Selection", + "mnemonic": "S", + "id": "selection", + "children": + [ + { "command": "split_selection_into_lines", "caption": "Split into Lines" }, + { "command": "select_lines", "args": {"forward": false}, "caption": "Add Previous Line" }, + { "command": "select_lines", "args": {"forward": true}, "caption": "Add Next Line" }, + { "command": "single_selection" }, + { "caption": "-" }, + { "command": "select_all" }, + { "command": "expand_selection", "args": {"to": "line"}, "caption": "Expand Selection to Line" }, + { "command": "find_under_expand", "caption": "Expand Selection to Word" }, + { "command": "expand_selection_to_paragraph", "caption": "Expand Selection to Paragraph" }, + { "command": "expand_selection", "args": {"to": "scope"}, "caption": "Expand Selection to Scope" }, + { "command": "expand_selection", "args": {"to": "brackets"}, "caption": "Expand Selection to Brackets" }, + { "command": "expand_selection", "args": {"to": "indentation"}, "caption": "Expand Selection to Indentation" }, + { "command": "expand_selection", "args": {"to": "tag"}, "caption": "Expand Selection to Tag" } + ] + }, + { + "caption": "Find", + "mnemonic": "i", + "id": "find", + "children": + [ + { "command": "show_panel", "args": {"panel": "find"}, "caption": "Find…" }, + { "command": "find_next" }, + { "command": "find_prev", "caption": "Find Previous" }, + { "command": "show_panel", "args": {"panel": "incremental_find", "reverse": false}, "caption": "Incremental Find" }, + { "caption": "-" }, + { "command": "show_panel", "args": {"panel": "replace"}, "caption": "Replace…" }, + { "command": "replace_next" }, + { "caption": "-" }, + { "command": "find_under", "caption": "Quick Find" }, + { "command": "find_all_under", "caption": "Quick Find All" }, + { "command": "find_under_expand", "caption": "Quick Add Next" }, + { "command": "find_under_expand_skip", "caption": "Quick Skip Next", "platform": "!OSX" }, + { "caption": "-" }, + { "command": "slurp_find_string", "caption": "Use Selection for Find" }, + { "command": "slurp_replace_string", "caption": "Use Selection for Replace" }, + { "caption": "-" }, + { "command": "show_panel", "args": {"panel": "find_in_files"}, "caption": "Find in Files…" }, + { + "caption": "Find Results", + "mnemonic": "R", + "children": + [ + { "command": "show_panel", "args": {"panel": "output.find_results"}, "caption": "Show Results Panel" }, + { "command": "next_result" }, + { "command": "prev_result", "caption": "Previous Result" } + ] + } + ] + }, + { + "caption": "View", + "mnemonic": "V", + "id": "view", + "children": + [ + { + "caption": "Side Bar", + "id": "side_bar", + "children": + [ + { "command": "toggle_side_bar" }, + { "caption": "-" }, + { "command": "toggle_show_open_files" } + ] + }, + { "command": "toggle_minimap" }, + { "command": "toggle_tabs" }, + { "command": "toggle_status_bar" }, + { "command": "toggle_menu" }, + { "command": "show_panel", "args": {"panel": "console", "toggle": true} }, + { "caption": "-", "id": "full_screen" }, + { "command": "toggle_full_screen" }, + { "command": "toggle_distraction_free" }, + { "caption": "-", "id": "groups" }, + { + "caption": "Layout", + "mnemonic": "L", + "id": "layout", + "children": + [ + { + "caption": "Single", + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1]] + } + }, + { + "caption": "Columns: 2", + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] + } + }, + { + "caption": "Columns: 3", + "command": "set_layout", + "args": + { + "cols": [0.0, 0.33, 0.66, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] + } + }, + { + "caption": "Columns: 4", + "command": "set_layout", + "args": + { + "cols": [0.0, 0.25, 0.5, 0.75, 1.0], + "rows": [0.0, 1.0], + "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] + } + }, + { + "caption": "Rows: 2", + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] + } + }, + { + "caption": "Rows: 3", + "command": "set_layout", + "args": + { + "cols": [0.0, 1.0], + "rows": [0.0, 0.33, 0.66, 1.0], + "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] + } + }, + { + "caption": "Grid: 4", + "command": "set_layout", + "args": + { + "cols": [0.0, 0.5, 1.0], + "rows": [0.0, 0.5, 1.0], + "cells": + [ + [0, 0, 1, 1], [1, 0, 2, 1], + [0, 1, 1, 2], [1, 1, 2, 2] + ] + } + } + ] + }, + { + "caption": "Focus Group", + "mnemonic": "F", + "children": + [ + { "command": "focus_group", "args": {"group": 0}, "caption": "Group 1" }, + { "command": "focus_group", "args": {"group": 1}, "caption": "Group 2" }, + { "command": "focus_group", "args": {"group": 2}, "caption": "Group 3" }, + { "command": "focus_group", "args": {"group": 3}, "caption": "Group 4" } + ] + }, + { + "caption": "Move File To Group", + "mnemonic": "M", + "children": + [ + { "command": "move_to_group", "args": {"group": 0}, "caption": "Group 1" }, + { "command": "move_to_group", "args": {"group": 1}, "caption": "Group 2" }, + { "command": "move_to_group", "args": {"group": 2}, "caption": "Group 3" }, + { "command": "move_to_group", "args": {"group": 3}, "caption": "Group 4" } + ] + }, + { "caption": "-" }, + { + "caption": "Syntax", + "mnemonic": "S", + "id": "syntax", + "children": [ { "command": "$file_types" } ] + }, + { + "caption": "Indentation", + "mnemonic": "I", + "id": "indentation", + "children": + [ + { "command": "toggle_setting", "args": {"setting": "translate_tabs_to_spaces"}, "caption": "Indent Using Spaces", "checkbox": true }, + { "caption": "-" }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 1}, "caption": "Tab Width: 1", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 2}, "caption": "Tab Width: 2", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 3}, "caption": "Tab Width: 3", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 4}, "caption": "Tab Width: 4", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 5}, "caption": "Tab Width: 5", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 6}, "caption": "Tab Width: 6", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 7}, "caption": "Tab Width: 7", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "tab_size", "value": 8}, "caption": "Tab Width: 8", "checkbox": true }, + { "caption": "-" }, + { "command": "detect_indentation", "caption": "Guess Settings From Buffer" }, + { "caption": "-" }, + { "command": "expand_tabs", "caption": "Convert Indentation to Spaces", "args": {"set_translate_tabs": true} }, + { "command": "unexpand_tabs", "caption": "Convert Indentation to Tabs", "args": {"set_translate_tabs": true} } + ] + }, + { + "caption": "Line Endings", + "mnemonic": "n", + "id": "line_endings", + "children": + [ + { "command": "set_line_ending", "args": {"type": "windows"}, "caption": "Windows", "checkbox": true }, + { "command": "set_line_ending", "args": {"type": "unix"}, "caption": "Unix", "checkbox": true }, + { "command": "set_line_ending", "args": {"type": "cr"}, "caption": "Mac OS 9", "checkbox": true } + ] + }, + { "caption": "-", "id": "settings" }, + { "command": "toggle_setting", "args": {"setting": "word_wrap"}, "caption": "Word Wrap", "mnemonic": "w", "checkbox": true }, + { + "caption": "Word Wrap Column", + "children": + [ + { "command": "set_setting", "args": {"setting": "wrap_width", "value": 0}, "caption": "Automatic", "checkbox": true }, + { "caption": "-" }, + { "command": "set_setting", "args": {"setting": "wrap_width", "value": 70}, "caption": "70", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "wrap_width", "value": 78}, "caption": "78", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "wrap_width", "value": 80}, "caption": "80", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "wrap_width", "value": 100}, "caption": "100", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "wrap_width", "value": 120}, "caption": "120", "checkbox": true } + ] + }, + { + "caption": "Ruler", + "children": + [ + { "command": "set_setting", "args": {"setting": "rulers", "value": []}, "caption": "None", "checkbox": true }, + { "caption": "-" }, + { "command": "set_setting", "args": {"setting": "rulers", "value": [70]}, "caption": "70", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "rulers", "value": [78]}, "caption": "78", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "rulers", "value": [80]}, "caption": "80", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "rulers", "value": [100]}, "caption": "100", "checkbox": true }, + { "command": "set_setting", "args": {"setting": "rulers", "value": [120]}, "caption": "120", "checkbox": true } + ] + }, + { "caption": "-" }, + { "command": "toggle_setting", "args": {"setting": "spell_check"}, "caption": "Spell Check", "checkbox": true }, + { "command": "next_misspelling" }, + { "command": "prev_misspelling" }, + { + "caption": "Dictionary", + "children": [ { "command": "$dictionaries" } ] + } + ] + }, + { + "caption": "Goto", + "mnemonic": "G", + "id": "goto", + "children": + [ + { "command": "show_overlay", "args": {"overlay": "goto", "show_files": true}, "caption": "Goto Anything…", "mnemonic": "A" }, + { "caption": "-" }, + { "command": "show_overlay", "args": {"overlay": "goto", "text": "@"}, "caption": "Goto Symbol…" }, + // { "command": "show_overlay", "args": {"overlay": "goto", "text": "#"}, "caption": "Goto Word…" }, + { "command": "show_overlay", "args": {"overlay": "goto", "text": ":"}, "caption": "Goto Line…" }, + { "caption": "-" }, + { + "caption": "Switch File", + "mnemonic": "t", + "id": "switch_file", + "children": + [ + { "command": "next_view", "caption": "Next File" }, + { "command": "prev_view", "caption": "Previous File" }, + { "caption": "-" }, + { "command": "next_view_in_stack", "caption": "Next File in Stack" }, + { "command": "prev_view_in_stack", "caption": "Previous File in Stack" }, + { "caption": "-" }, + { "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]}, "caption": "Switch Header/Implementation", "mnemonic": "H" }, + { "caption": "-" }, + { "command": "select_by_index", "args": { "index": 0 } }, + { "command": "select_by_index", "args": { "index": 1 } }, + { "command": "select_by_index", "args": { "index": 2 } }, + { "command": "select_by_index", "args": { "index": 3 } }, + { "command": "select_by_index", "args": { "index": 4 } }, + { "command": "select_by_index", "args": { "index": 5 } }, + { "command": "select_by_index", "args": { "index": 6 } }, + { "command": "select_by_index", "args": { "index": 7 } }, + { "command": "select_by_index", "args": { "index": 8 } }, + { "command": "select_by_index", "args": { "index": 9 } } + ] + }, + { "caption": "-" }, + { + "caption": "Scroll", + "mnemonic": "S", + "id": "scroll", + "children": + [ + { "command": "show_at_center", "caption": "Scroll to Selection" }, + { "command": "scroll_lines", "args": {"amount": 1.0 }, "caption": "Line Up" }, + { "command": "scroll_lines", "args": {"amount": -1.0 }, "caption": "Line Down" } + ] + }, + { + "caption": "Bookmarks", + "mnemonic": "b", + "id": "bookmarks", + "children": + [ + { "command": "toggle_bookmark" }, + { "command": "next_bookmark" }, + { "command": "prev_bookmark" }, + { "command": "clear_bookmarks" }, + { "command": "select_all_bookmarks" }, + { "caption": "-" }, + { "command": "select_bookmark", "args": {"index": 0} }, + { "command": "select_bookmark", "args": {"index": 1} }, + { "command": "select_bookmark", "args": {"index": 2} }, + { "command": "select_bookmark", "args": {"index": 3} }, + { "command": "select_bookmark", "args": {"index": 4} }, + { "command": "select_bookmark", "args": {"index": 5} }, + { "command": "select_bookmark", "args": {"index": 6} }, + { "command": "select_bookmark", "args": {"index": 7} }, + { "command": "select_bookmark", "args": {"index": 8} }, + { "command": "select_bookmark", "args": {"index": 9} }, + { "command": "select_bookmark", "args": {"index": 10} }, + { "command": "select_bookmark", "args": {"index": 11} }, + { "command": "select_bookmark", "args": {"index": 12} }, + { "command": "select_bookmark", "args": {"index": 13} }, + { "command": "select_bookmark", "args": {"index": 14} }, + { "command": "select_bookmark", "args": {"index": 15} } + ] + }, + { "caption": "-" }, + { "command": "move_to", "args": {"to": "brackets"}, "caption": "Jump to Matching Bracket" } + ] + }, + { + "caption": "Tools", + "mnemonic": "T", + "id": "tools", + "children": + [ + { "command": "show_overlay", "args": {"overlay": "command_palette"}, "caption": "Command Palette…" }, + { "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "}, "caption": "Snippets…" }, + { "caption": "-", "id": "build" }, + { + "caption": "Build System", + "mnemonic": "u", + "children": + [ + { "command": "set_build_system", "args": { "file": "" }, "caption": "Automatic", "checkbox": true }, + { "caption": "-" }, + { "command": "set_build_system", "args": {"index": 0}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 1}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 2}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 3}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 4}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 5}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 6}, "checkbox": true }, + { "command": "set_build_system", "args": {"index": 7}, "checkbox": true }, + { "command": "$build_systems" }, + { "caption": "-" }, + { "command": "new_build_system", "caption": "New Build System…" } + ] + }, + { "command": "build", "mnemonic": "B" }, + { "command": "build", "args": {"variant": "Run"}, "mnemonic": "R" }, + { "command": "exec", "args": {"kill": true}, "caption": "Cancel Build", "mnemonic": "C" }, + { + "caption": "Build Results", + "mnemonic": "R", + "children": + [ + { "command": "show_panel", "args": {"panel": "output.exec"}, "caption": "Show Build Results", "mnemonic": "S" }, + { "command": "next_result", "mnemonic": "N" }, + { "command": "prev_result", "caption": "Previous Result", "mnemonic": "P" } + ] + }, + { "command": "toggle_save_all_on_build", "caption": "Save All on Build", "mnemonic": "A", "checkbox": true }, + { "caption": "-", "id": "macros" }, + { "command": "toggle_record_macro", "mnemonic": "M" }, + { "command": "run_macro", "caption": "Playback Macro", "mnemonic": "P" }, + { "command": "save_macro", "caption": "Save Macro…", "mnemonic": "v" }, + { + "caption": "Macros", + "children": [ { "command": "$macros" } ] + }, + { "caption": "-" }, + { "command": "new_plugin", "caption": "New Plugin…" }, + { "command": "new_snippet", "caption": "New Snippet…" }, + { "caption": "-", "id": "end" } + ] + }, + { + "caption": "Project", + "mnemonic": "P", + "id": "project", + "children": + [ + { "command": "prompt_open_project", "caption": "Open Project…", "mnemonic": "O" }, + { + "caption": "Recent Projects", + "mnemonic": "R", + "children": + [ + { "command": "open_recent_project", "args": {"index": 0 } }, + { "command": "open_recent_project", "args": {"index": 1 } }, + { "command": "open_recent_project", "args": {"index": 2 } }, + { "command": "open_recent_project", "args": {"index": 3 } }, + { "command": "open_recent_project", "args": {"index": 4 } }, + { "command": "open_recent_project", "args": {"index": 5 } }, + { "command": "open_recent_project", "args": {"index": 6 } }, + { "command": "open_recent_project", "args": {"index": 7 } }, + { "caption": "-" }, + { "command": "clear_recent_projects", "caption": "Clear Items" } + ] + }, + { "caption": "-" }, + { "command": "prompt_select_project", "caption": "Switch Project in Window…", "mnemonic": "S" }, + { "command": "save_project_as", "caption": "Save Project As…", "mnemonic": "A" }, + { "command": "close_project", "mnemonic": "C" }, + { "command": "open_file", "args": {"file": "${project}"}, "caption": "Edit Project" }, + { "caption": "-" }, + { "command": "prompt_add_folder", "caption": "Add Folder to Project…", "mnemonic": "d" }, + { "command": "close_folder_list", "caption": "Remove all Folders from Project", "mnemonic": "m" }, + { "command": "refresh_folder_list", "caption": "Refresh Folders", "mnemonic": "e" }, + { "caption": "-" }, + { "caption": "-", "id": "end" } + ] + }, + { + "caption": "Preferences", + "mnemonic": "n", + "id": "preferences", + "children": + [ + { "command": "open_dir", "args": {"dir": "$packages"}, "caption": "Browse Packages…", "mnemonic": "B" }, + { "caption": "-" }, + { "command": "open_file", "args": {"file": "${packages}/Default/Preferences.sublime-settings"}, "caption": "Settings – Default" }, + { "command": "open_file", "args": {"file": "${packages}/User/Preferences.sublime-settings"}, "caption": "Settings – User" }, + { + "caption": "Settings – More", + "children": + [ + { "command": "open_file_settings", "caption": "Syntax Specific – User" }, + { "command": "open_file", "args": {"file": "${packages}/User/Distraction Free.sublime-settings"}, "caption": "Distraction Free – User" } + ] + }, + { "caption": "-" }, + { + "command": "open_file", "args": + { + "file": "${packages}/Default/Default ($platform).sublime-keymap" + }, + "caption": "Key Bindings – Default" + }, + { + "command": "open_file", "args": + { + "file": "${packages}/User/Default ($platform).sublime-keymap" + }, + "caption": "Key Bindings – User" + }, + { "caption": "-" }, + { + "caption": "Font", + "children": + [ + { "command": "increase_font_size", "caption": "Larger" }, + { "command": "decrease_font_size", "caption": "Smaller" }, + { "caption": "-" }, + { "command": "reset_font_size", "caption": "Reset" } + ] + }, + { + "caption": "Color Scheme", + "children": [ { "command": "$color_schemes" } ] + } + ] + }, + { + "caption": "Help", + "mnemonic": "H", + "id": "help", + "children": + [ + { "command": "open_url", "args": {"url": "http://www.sublimetext.com/docs/2/"}, "caption": "Documentation" }, + { "command": "open_url", "args": {"url": "http://twitter.com/sublimehq"}, "caption": "Twitter" }, + { "caption": "-" }, + { "command": "purchase_license"}, + { "command": "show_license_window", "caption": "Enter License" }, + { "command": "remove_license"}, + { "caption": "-" }, + { "command": "show_about_window", "caption": "About Sublime Text 2", "mnemonic": "A" } + ] + } +] diff --git a/sublime-text/Default/Meta Info Summary.cache b/sublime-text/Default/Meta Info Summary.cache new file mode 100644 index 0000000..aa5d2c8 Binary files /dev/null and b/sublime-text/Default/Meta Info Summary.cache differ diff --git a/sublime-text/Default/Minimap.sublime-settings b/sublime-text/Default/Minimap.sublime-settings new file mode 100644 index 0000000..2e03071 --- /dev/null +++ b/sublime-text/Default/Minimap.sublime-settings @@ -0,0 +1,5 @@ +{ + "rulers": [], + "gutter": false, + "draw_indent_guides": false +} diff --git a/sublime-text/Default/Preferences (Linux).sublime-settings b/sublime-text/Default/Preferences (Linux).sublime-settings new file mode 100644 index 0000000..d6115ac --- /dev/null +++ b/sublime-text/Default/Preferences (Linux).sublime-settings @@ -0,0 +1,5 @@ +{ + "font_face": "Monospace", + "font_size": 12, + "mouse_wheel_switches_tabs": true +} diff --git a/sublime-text/Default/Preferences (OSX).sublime-settings b/sublime-text/Default/Preferences (OSX).sublime-settings new file mode 100644 index 0000000..5480b8a --- /dev/null +++ b/sublime-text/Default/Preferences (OSX).sublime-settings @@ -0,0 +1,9 @@ +{ + "font_face": "Menlo Regular", + "font_size": 12, + "scroll_past_end": false, + "find_selected_text": false, + "move_to_limit_on_up_down": true, + "close_windows_when_empty": true, + "show_full_path": false +} diff --git a/sublime-text/Default/Preferences (Windows).sublime-settings b/sublime-text/Default/Preferences (Windows).sublime-settings new file mode 100644 index 0000000..0eeb1f9 --- /dev/null +++ b/sublime-text/Default/Preferences (Windows).sublime-settings @@ -0,0 +1,4 @@ +{ + "font_face": "Consolas", + "font_size": 10 +} diff --git a/sublime-text/Default/Preferences.sublime-settings b/sublime-text/Default/Preferences.sublime-settings new file mode 100644 index 0000000..e815a95 --- /dev/null +++ b/sublime-text/Default/Preferences.sublime-settings @@ -0,0 +1,336 @@ +// While you can edit this file, it's best to put your changes in +// "User/Preferences.sublime-settings", which overrides the settings in here. +// +// Settings may also be placed in file type specific options files, for +// example, in Packages/Python/Python.sublime-settings for python files. +{ + // Sets the colors used within the text area + "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", + + // Note that the font_face and font_size are overriden in the platform + // specific settings file, for example, "Preferences (Linux).sublime-settings". + // Because of this, setting them here will have no effect: you must set them + // in your User File Preferences. + "font_face": "", + "font_size": 10, + + // Valid options are "no_bold", "no_italic", "no_antialias", "gray_antialias", + // "subpixel_antialias", "no_round" (OS X only) and "directwrite" (Windows only) + "font_options": [], + + // Characters that are considered to separate words + "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?", + + // Set to false to prevent line numbers being drawn in the gutter + "line_numbers": true, + + // Set to false to hide the gutter altogether + "gutter": true, + + // Spacing between the gutter and the text + "margin": 4, + + // Fold buttons are the triangles shown in the gutter to fold regions of text + "fold_buttons": true, + + // Hides the fold buttons unless the mouse is over the gutter + "fade_fold_buttons": true, + + // Columns in which to display vertical rulers + "rulers": [], + + // Set to true to turn spell checking on by default + "spell_check": false, + + // The number of spaces a tab is considered equal to + "tab_size": 2, + + // Set to true to insert spaces when tab is pressed + "translate_tabs_to_spaces": true, + + // If translate_tabs_to_spaces is true, use_tab_stops will make tab and + // backspace insert/delete up to the next tabstop + "use_tab_stops": true, + + // Set to false to disable detection of tabs vs. spaces on load + "detect_indentation": true, + + // Calculates indentation automatically when pressing enter + "auto_indent": true, + + // Makes auto indent a little smarter, e.g., by indenting the next line + // after an if statement in C. Requires auto_indent to be enabled. + "smart_indent": true, + + // Adds whitespace up to the first open bracket when indenting. Requires + // auto_indent to be enabled. + "indent_to_bracket": false, + + // Trims white space added by auto_indent when moving the caret off the + // line. + "trim_automatic_white_space": true, + + // Disables horizontal scrolling if enabled. + // May be set to true, false, or "auto", where it will be disabled for + // source code, and otherwise enabled. + "word_wrap": "auto", + + // Set to a value other than 0 to force wrapping at that column rather than the + // window width + "wrap_width": 0, + + // Set to false to prevent word wrapped lines from being indented to the same + // level + "indent_subsequent_lines": true, + + // Draws text centered in the window rather than left aligned + "draw_centered": false, + + // Controls auto pairing of quotes, brackets etc + "auto_match_enabled": true, + + // Word list to use for spell checking + "dictionary": "Packages/Language - English/en_US.dic", + + // Set to true to draw a border around the visible rectangle on the minimap. + // The color of the border will be determined by the "minimapBorder" key in + // the color scheme + "draw_minimap_border": false, + + // If enabled, will highlight any line with a caret + "highlight_line": false, + + // Valid values are "smooth", "phase", "blink", "wide" and "solid". + "caret_style": "smooth", + + // Set to false to disable underlining the brackets surrounding the caret + "match_brackets": true, + + // Set to false if you'd rather only highlight the brackets when the caret is + // next to one + "match_brackets_content": true, + + // Set to false to not highlight square brackets. This only takes effect if + // match_brackets is true + "match_brackets_square": true, + + // Set to false to not highlight curly brackets. This only takes effect if + // match_brackets is true + "match_brackets_braces": true, + + // Set to false to not highlight angle brackets. This only takes effect if + // match_brackets is true + "match_brackets_angle": false, + + // Enable visualization of the matching tag in HTML and XML + "match_tags": true, + + // Highlights other occurrences of the currently selected text + "match_selection": true, + + // Additional spacing at the top of each line, in pixels + "line_padding_top": 0, + + // Additional spacing at the bottom of each line, in pixels + "line_padding_bottom": 0, + + // Set to false to disable scrolling past the end of the buffer. + // On OS X, this value is overridden in the platform specific settings, so + // you'll need to place this line in your user settings to override it. + "scroll_past_end": true, + + // This controls what happens when pressing up or down when on the first + // or last line. + // On OS X, this value is overridden in the platform specific settings, so + // you'll need to place this line in your user settings to override it. + "move_to_limit_on_up_down": false, + + // Set to "none" to turn off drawing white space, "selection" to draw only the + // white space within the selection, and "all" to draw all white space + "draw_white_space": "selection", + + // Set to false to turn off the indentation guides. + // The color and width of the indent guides may be customized by editing + // the corresponding .tmTheme file, and specifying the colors "guide", + // "activeGuide" and "stackGuide" + "draw_indent_guides": true, + + // Controls how the indent guides are drawn, valid options are + // "draw_normal" and "draw_active". draw_active will draw the indent + // guides containing the caret in a different color. + "indent_guide_options": ["draw_normal"], + + // Set to true to removing trailing white space on save + "trim_trailing_white_space_on_save": false, + + // Set to true to ensure the last line of the file ends in a newline + // character when saving + "ensure_newline_at_eof_on_save": false, + + // Set to true to automatically save files when switching to a different file + // or application + "save_on_focus_lost": false, + + // The encoding to use when the encoding can't be determined automatically. + // ASCII, UTF-8 and UTF-16 encodings will be automatically detected. + "fallback_encoding": "UTF-8", + + // Encoding used when saving new files, and files opened with an undefined + // encoding (e.g., plain ascii files). If a file is opened with a specific + // encoding (either detected or given explicitly), this setting will be + // ignored, and the file will be saved with the encoding it was opened + // with. + "default_encoding": "UTF-8", + + // Files containing null bytes are opened as hexadecimal by default + "enable_hexadecimal_encoding": true, + + // Determines what character(s) are used to terminate each line in new files. + // Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and + // 'unix' (LF only). + "default_line_ending": "unix", + + // When enabled, pressing tab will insert the best matching completion. + // When disabled, tab will only trigger snippets or insert a tab. + // Shift+tab can be used to insert an explicit tab when tab_completion is + // enabled. + "tab_completion": true, + + // Enable auto complete to be triggered automatically when typing. + "auto_complete": true, + + // The maximum file size where auto complete will be automatically triggered. + "auto_complete_size_limit": 4194304, + + // The delay, in ms, before the auto complete window is shown after typing + "auto_complete_delay": 50, + + // Controls what scopes auto complete will be triggered in + "auto_complete_selector": "source - comment", + + // Additional situations to trigger auto complete + "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ], + + // By default, auto complete will commit the current completion on enter. + // This setting can be used to make it complete on tab instead. + // Completing on tab is generally a superior option, as it removes + // ambiguity between committing the completion and inserting a newline. + "auto_complete_commit_on_tab": false, + + // Controls if auto complete is shown when snippet fields are active. + // Only relevant if auto_complete_commit_on_tab is true. + "auto_complete_with_fields": false, + + // By default, shift+tab will only unindent if the selection spans + // multiple lines. When pressing shift+tab at other times, it'll insert a + // tab character - this allows tabs to be inserted when tab_completion is + // enabled. Set this to true to make shift+tab always unindent, instead of + // inserting tabs. + "shift_tab_unindent": false, + + // If true, the copy and cut commands will operate on the current line + // when the selection is empty, rather than doing nothing. + "copy_with_empty_selection": true, + + // If true, the selected text will be copied into the find panel when it's + // shown. + // On OS X, this value is overridden in the platform specific settings, so + // you'll need to place this line in your user settings to override it. + "find_selected_text": true, + + // When drag_text is enabled, clicking on selected text will begin a + // drag-drop operation + "drag_text": true, + + // + // User Interface Settings + // + + // The theme controls the look of Sublime Text's UI (buttons, tabs, scroll bars, etc) + "theme": "Default.sublime-theme", + + // Set to 0 to disable smooth scrolling. Set to a value between 0 and 1 to + // scroll slower, or set to larger than 1 to scroll faster + "scroll_speed": 1.0, + + // Controls side bar animation when expanding or collapsing folders + "tree_animation_enabled": true, + + // Makes tabs with modified files more visible + "highlight_modified_tabs": false, + + "show_tab_close_buttons": true, + + // Show folders in the side bar in bold + "bold_folder_labels": false, + + // OS X 10.7 only: Set to true to disable Lion style full screen support. + // Sublime Text must be restarted for this to take effect. + "use_simple_full_screen": false, + + // OS X only. Valid values are true, false, and "auto". Auto will enable + // the setting when running on a screen 2880 pixels or wider (i.e., a + // Retina display). When this setting is enabled, OpenGL is used to + // accelerate drawing. Sublime Text must be restarted for changes to take + // effect. + "gpu_window_buffer": "auto", + + // Valid values are "system", "enabled" and "disabled" + "overlay_scroll_bars": "system", + + // + // Application Behavior Settings + // + + // Exiting the application with hot_exit enabled will cause it to close + // immediately without prompting. Unsaved modifications and open files will + // be preserved and restored when next starting. + // + // Closing a window with an associated project will also close the window + // without prompting, preserving unsaved changes in the workspace file + // alongside the project. + "hot_exit": true, + + // remember_open_files makes the application start up with the last set of + // open files. Changing this to false will have no effect if hot_exit is + // true + "remember_open_files": true, + + // OS X only: When files are opened from finder, or by dragging onto the + // dock icon, this controls if a new window is created or not. + "open_files_in_new_window": true, + + // OS X only: This controls if an empty window is created at startup or not. + "create_window_at_startup": true, + + // Set to true to close windows as soon as the last file is closed, unless + // there's a folder open within the window. This is always enabled on OS X, + // changing it here won't modify the behavior. + "close_windows_when_empty": false, + + // Show the full path to files in the title bar. + // On OS X, this value is overridden in the platform specific settings, so + // you'll need to place this line in your user settings to override it. + "show_full_path": true, + + // Shows the Build Results panel when building. If set to false, the Build + // Results can be shown via the Tools/Build Results menu. + "show_panel_on_build": true, + + // Preview file contents when clicking on a file in the side bar. Double + // clicking or editing the preview will open the file and assign it a tab. + "preview_on_click": true, + + // folder_exclude_patterns and file_exclude_patterns control which files + // are listed in folders on the side bar. These can also be set on a per- + // project basis. + "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"], + "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db"], + // These files will still show up in the side bar, but won't be included in + // Goto Anything or Find in Files + "binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"], + + // List any packages to ignore here. When removing entries from this list, + // a restart may be required if the package contains plugins. + "ignored_packages": ["Vintage"] +} diff --git a/sublime-text/Default/Regex Format Widget.sublime-settings b/sublime-text/Default/Regex Format Widget.sublime-settings new file mode 100644 index 0000000..e69de29 diff --git a/sublime-text/Default/Regex Widget.sublime-settings b/sublime-text/Default/Regex Widget.sublime-settings new file mode 100644 index 0000000..cf1b634 --- /dev/null +++ b/sublime-text/Default/Regex Widget.sublime-settings @@ -0,0 +1,3 @@ +{ + "syntax": "Packages/Regular Expressions/RegExp.tmLanguage" +} diff --git a/sublime-text/Default/Side Bar Mount Point.sublime-menu b/sublime-text/Default/Side Bar Mount Point.sublime-menu new file mode 100644 index 0000000..3411b67 --- /dev/null +++ b/sublime-text/Default/Side Bar Mount Point.sublime-menu @@ -0,0 +1,4 @@ +[ + { "caption": "-", "id": "folder_commands" }, + { "caption": "Remove Folder from Project", "command": "remove_folder", "args": { "dirs": []} } +] diff --git a/sublime-text/Default/Side Bar.sublime-menu b/sublime-text/Default/Side Bar.sublime-menu new file mode 100644 index 0000000..3d308b9 --- /dev/null +++ b/sublime-text/Default/Side Bar.sublime-menu @@ -0,0 +1,11 @@ +[ + { "caption": "New File", "command": "new_file_at", "args": {"dirs": []} }, + { "caption": "Rename…", "command": "rename_path", "args": {"paths": []} }, + { "caption": "Delete File", "command": "delete_file", "args": {"files": []} }, + { "caption": "Open Containing Folder…", "command": "open_containing_folder", "args": {"files": []} }, + { "caption": "-", "id": "folder_commands" }, + { "caption": "New Folder…", "command": "new_folder", "args": {"dirs": []} }, + { "caption": "Delete Folder", "command": "delete_folder", "args": {"dirs": []} }, + { "caption": "Find in Folder…", "command": "find_in_folder", "args": {"dirs": []} }, + { "caption": "-", "id": "end" } +] diff --git a/sublime-text/Default/Startup.cache b/sublime-text/Default/Startup.cache new file mode 100644 index 0000000..8a82d70 Binary files /dev/null and b/sublime-text/Default/Startup.cache differ diff --git a/sublime-text/Default/Symbol List.tmPreferences b/sublime-text/Default/Symbol List.tmPreferences new file mode 100644 index 0000000..0eeaf41 --- /dev/null +++ b/sublime-text/Default/Symbol List.tmPreferences @@ -0,0 +1,17 @@ + + + + + name + Symbol List + scope + entity.name.function, entity.name.type, meta.toc-list + settings + + showInSymbolList + 1 + + uuid + 0A0DA1FC-59DE-4FD9-9A2C-63C6811A3C39 + + diff --git a/sublime-text/Default/Symbol List.tmPreferences.cache b/sublime-text/Default/Symbol List.tmPreferences.cache new file mode 100644 index 0000000..720f421 Binary files /dev/null and b/sublime-text/Default/Symbol List.tmPreferences.cache differ diff --git a/sublime-text/Default/Syntax Summary.cache b/sublime-text/Default/Syntax Summary.cache new file mode 100644 index 0000000..a86b80f Binary files /dev/null and b/sublime-text/Default/Syntax Summary.cache differ diff --git a/sublime-text/Default/Syntax.sublime-menu b/sublime-text/Default/Syntax.sublime-menu new file mode 100644 index 0000000..b555b7b --- /dev/null +++ b/sublime-text/Default/Syntax.sublime-menu @@ -0,0 +1,6 @@ +[ + { + "caption": "Syntax", + "children": [ { "command": "$file_types" } ] + } +] diff --git a/sublime-text/Default/Tab Context.sublime-menu b/sublime-text/Default/Tab Context.sublime-menu new file mode 100644 index 0000000..b5781f0 --- /dev/null +++ b/sublime-text/Default/Tab Context.sublime-menu @@ -0,0 +1,8 @@ +[ + { "command": "close_by_index", "args": { "group": -1, "index": -1 }, "caption": "Close" }, + { "command": "close_others_by_index", "args": { "group": -1, "index": -1 }, "caption": "Close others" }, + { "command": "close_to_right_by_index", "args": { "group": -1, "index": -1 }, "caption": "Close tabs to the right" }, + { "caption": "-" }, + { "command": "new_file" }, + { "command": "prompt_open_file", "caption": "Open file" } +] diff --git a/sublime-text/Default/Widget Context.sublime-menu b/sublime-text/Default/Widget Context.sublime-menu new file mode 100644 index 0000000..971328a --- /dev/null +++ b/sublime-text/Default/Widget Context.sublime-menu @@ -0,0 +1,7 @@ +[ + { "command": "copy" }, + { "command": "cut" }, + { "command": "paste" }, + { "caption": "-" }, + { "command": "select_all" } +] diff --git a/sublime-text/Default/Widget.sublime-settings b/sublime-text/Default/Widget.sublime-settings new file mode 100644 index 0000000..fe8c1fa --- /dev/null +++ b/sublime-text/Default/Widget.sublime-settings @@ -0,0 +1,15 @@ +{ + "rulers": [], + "translate_tabs_to_spaces": false, + "gutter": false, + "margin": 1, + "syntax": "Packages/Text/Plain text.tmLanguage", + "is_widget": true, + "word_wrap": false, + "auto_match_enabled": false, + "scroll_past_end": false, + "draw_indent_guides": false, + "draw_centered": false, + "auto_complete": false, + "match_selection": false +} diff --git a/sublime-text/Default/comment.py b/sublime-text/Default/comment.py new file mode 100644 index 0000000..b967afc --- /dev/null +++ b/sublime-text/Default/comment.py @@ -0,0 +1,233 @@ +import sublime, sublime_plugin + +def advance_to_first_non_white_space_on_line(view, pt): + while True: + c = view.substr(sublime.Region(pt, pt + 1)) + if c == " " or c == "\t": + pt += 1 + else: + break + + return pt + +def has_non_white_space_on_line(view, pt): + while True: + c = view.substr(sublime.Region(pt, pt + 1)) + if c == " " or c == "\t": + pt += 1 + else: + return c != "\n" + +def build_comment_data(view, pt): + shell_vars = view.meta_info("shellVariables", pt) + if not shell_vars: + return ([], []) + + # transform the list of dicts into a single dict + all_vars = {} + for v in shell_vars: + if 'name' in v and 'value' in v: + all_vars[v['name']] = v['value'] + + line_comments = [] + block_comments = [] + + # transform the dict into a single array of valid comments + suffixes = [""] + ["_" + str(i) for i in xrange(1, 10)] + for suffix in suffixes: + start = all_vars.setdefault("TM_COMMENT_START" + suffix) + end = all_vars.setdefault("TM_COMMENT_END" + suffix) + mode = all_vars.setdefault("TM_COMMENT_MODE" + suffix) + disable_indent = all_vars.setdefault("TM_COMMENT_DISABLE_INDENT" + suffix) + + if start and end: + block_comments.append((start, end, disable_indent == 'yes')) + block_comments.append((start.strip(), end.strip(), disable_indent == 'yes')) + elif start: + line_comments.append((start, disable_indent == 'yes')) + line_comments.append((start.strip(), disable_indent == 'yes')) + + return (line_comments, block_comments) + +class ToggleCommentCommand(sublime_plugin.TextCommand): + + def remove_block_comment(self, view, edit, comment_data, region): + (line_comments, block_comments) = comment_data + + # Call extract_scope from the midpoint of the region, as calling it + # from the start can give false results if the block comment begin/end + # markers are assigned their own scope, as is done in HTML. + whole_region = view.extract_scope(region.begin() + region.size() / 2) + + for c in block_comments: + (start, end, disable_indent) = c + start_region = sublime.Region(whole_region.begin(), + whole_region.begin() + len(start)) + end_region = sublime.Region(whole_region.end() - len(end), + whole_region.end()) + + if view.substr(start_region) == start and view.substr(end_region) == end: + # It's faster to erase the start region first + view.erase(edit, start_region) + + end_region = sublime.Region( + end_region.begin() - start_region.size(), + end_region.end() - start_region.size()) + + view.erase(edit, end_region) + return True + + return False + + def remove_line_comment(self, view, edit, comment_data, region): + (line_comments, block_comments) = comment_data + + found_line_comment = False + + start_positions = [advance_to_first_non_white_space_on_line(view, r.begin()) + for r in view.lines(region)] + + start_positions.reverse() + + for pos in start_positions: + for c in line_comments: + (start, disable_indent) = c + comment_region = sublime.Region(pos, + pos + len(start)) + if view.substr(comment_region) == start: + view.erase(edit, comment_region) + found_line_comment = True + break + + return found_line_comment + + def is_entirely_line_commented(self, view, comment_data, region): + (line_comments, block_comments) = comment_data + + start_positions = [advance_to_first_non_white_space_on_line(view, r.begin()) + for r in view.lines(region)] + + start_positions = filter(lambda p: has_non_white_space_on_line(view, p), + start_positions) + + if len(start_positions) == 0: + return False + + for pos in start_positions: + found_line_comment = False + for c in line_comments: + (start, disable_indent) = c + comment_region = sublime.Region(pos, + pos + len(start)) + if view.substr(comment_region) == start: + found_line_comment = True + if not found_line_comment: + return False + + return True + + def block_comment_region(self, view, edit, block_comment_data, region): + (start, end, disable_indent) = block_comment_data + + if region.empty(): + # Silly buggers to ensure the cursor doesn't end up after the end + # comment token + view.replace(edit, sublime.Region(region.end()), 'x') + view.insert(edit, region.end() + 1, end) + view.replace(edit, sublime.Region(region.end(), region.end() + 1), '') + view.insert(edit, region.begin(), start) + else: + view.insert(edit, region.end(), end) + view.insert(edit, region.begin(), start) + + def line_comment_region(self, view, edit, line_comment_data, region): + (start, disable_indent) = line_comment_data + + start_positions = [r.begin() for r in view.lines(region)] + start_positions.reverse() + + # Remove any blank lines from consideration, they make getting the + # comment start markers to line up challenging + non_empty_start_positions = filter(lambda p: has_non_white_space_on_line(view, p), + start_positions) + + # If all the lines are blank however, just comment away + if len(non_empty_start_positions) != 0: + start_positions = non_empty_start_positions + + if not disable_indent: + min_indent = None + + # This won't work well with mixed spaces and tabs, but really, + # don't do that! + for pos in start_positions: + indent = advance_to_first_non_white_space_on_line(view, pos) - pos + if min_indent == None or indent < min_indent: + min_indent = indent + + if min_indent != None and min_indent > 0: + start_positions = [r + min_indent for r in start_positions] + + for pos in start_positions: + view.insert(edit, pos, start) + + def add_comment(self, view, edit, comment_data, prefer_block, region): + (line_comments, block_comments) = comment_data + + if len(line_comments) == 0 and len(block_comments) == 0: + return + + if len(block_comments) == 0: + prefer_block = False + + if len(line_comments) == 0: + prefer_block = True + + if region.empty(): + if prefer_block: + # add the block comment + self.block_comment_region(view, edit, block_comments[0], region) + else: + # comment out the line + self.line_comment_region(view, edit, line_comments[0], region) + else: + if prefer_block: + # add the block comment + self.block_comment_region(view, edit, block_comments[0], region) + else: + # add a line comment to each line + self.line_comment_region(view, edit, line_comments[0], region) + + def run(self, edit, block=False): + for region in self.view.sel(): + comment_data = build_comment_data(self.view, region.begin()) + if (region.end() != self.view.size() and + build_comment_data(self.view, region.end()) != comment_data): + # region spans languages, nothing we can do + continue + + if self.remove_block_comment(self.view, edit, comment_data, region): + continue + + if self.is_entirely_line_commented(self.view, comment_data, region): + self.remove_line_comment(self.view, edit, comment_data, region) + continue + + has_line_comment = len(comment_data[0]) > 0 + + if not has_line_comment and not block and region.empty(): + # Use block comments to comment out the line + line = self.view.line(region.a) + line = sublime.Region( + advance_to_first_non_white_space_on_line(self.view, line.a), + line.b) + + # Try and remove any existing block comment now + if self.remove_block_comment(self.view, edit, comment_data, line): + continue + + self.add_comment(self.view, edit, comment_data, block, line) + continue + + # Add a comment instead + self.add_comment(self.view, edit, comment_data, block, region) diff --git a/sublime-text/Default/comment.pyc b/sublime-text/Default/comment.pyc new file mode 100644 index 0000000..f422962 Binary files /dev/null and b/sublime-text/Default/comment.pyc differ diff --git a/sublime-text/Default/copy_path.py b/sublime-text/Default/copy_path.py new file mode 100644 index 0000000..fd324c7 --- /dev/null +++ b/sublime-text/Default/copy_path.py @@ -0,0 +1,10 @@ +import sublime, sublime_plugin + +class CopyPathCommand(sublime_plugin.TextCommand): + def run(self, edit): + if len(self.view.file_name()) > 0: + sublime.set_clipboard(self.view.file_name()) + sublime.status_message("Copied file path") + + def is_enabled(self): + return self.view.file_name() and len(self.view.file_name()) > 0 diff --git a/sublime-text/Default/copy_path.pyc b/sublime-text/Default/copy_path.pyc new file mode 100644 index 0000000..4f5a648 Binary files /dev/null and b/sublime-text/Default/copy_path.pyc differ diff --git a/sublime-text/Default/delete_word.py b/sublime-text/Default/delete_word.py new file mode 100644 index 0000000..f881038 --- /dev/null +++ b/sublime-text/Default/delete_word.py @@ -0,0 +1,73 @@ +import sublime, sublime_plugin + +def clamp(xmin, x, xmax): + if x < xmin: + return xmin + if x > xmax: + return xmax + return x; + +class DeleteWordCommand(sublime_plugin.TextCommand): + + def find_by_class(self, pt, classes, forward): + if forward: + delta = 1 + end_position = self.view.size() + if pt > end_position: + pt = end_position + else: + delta = -1 + end_position = 0 + if pt < end_position: + pt = end_position + + while pt != end_position: + if self.view.classify(pt) & classes != 0: + return pt + pt += delta + + return pt + + def expand_word(self, view, pos, classes, forward): + if forward: + delta = 1 + else: + delta = -1 + ws = ["\t", " "] + + if forward: + if view.substr(pos) in ws and view.substr(pos + 1) in ws: + classes = sublime.CLASS_WORD_START | sublime.CLASS_PUNCTUATION_START | sublime.CLASS_LINE_END + else: + if view.substr(pos - 1) in ws and view.substr(pos - 2) in ws: + classes = sublime.CLASS_WORD_END | sublime.CLASS_PUNCTUATION_END | sublime.CLASS_LINE_START + + return sublime.Region(pos, self.find_by_class(pos + delta, classes, forward)) + + def run(self, edit, forward = True, sub_words = False): + + if forward: + classes = sublime.CLASS_WORD_END | sublime.CLASS_PUNCTUATION_END | sublime.CLASS_LINE_START + if sub_words: + classes |= sublime.CLASS_SUB_WORD_END + else: + classes = sublime.CLASS_WORD_START | sublime.CLASS_PUNCTUATION_START | sublime.CLASS_LINE_END + if sub_words: + classes |= sublime.CLASS_SUB_WORD_START + + new_sels = [] + for s in reversed(self.view.sel()): + if s.empty(): + new_sels.append(self.expand_word(self.view, s.b, classes, forward)) + + sz = self.view.size() + for s in new_sels: + self.view.sel().add(sublime.Region(clamp(0, s.a, sz), + clamp(0, s.b, sz))) + + self.view.run_command("add_to_kill_ring", {"forward": forward}) + + if forward: + self.view.run_command('right_delete') + else: + self.view.run_command('left_delete') diff --git a/sublime-text/Default/delete_word.pyc b/sublime-text/Default/delete_word.pyc new file mode 100644 index 0000000..36c80bb Binary files /dev/null and b/sublime-text/Default/delete_word.pyc differ diff --git a/sublime-text/Default/detect_indentation.py b/sublime-text/Default/detect_indentation.py new file mode 100644 index 0000000..9f6ae1d --- /dev/null +++ b/sublime-text/Default/detect_indentation.py @@ -0,0 +1,62 @@ +import sublime, sublime_plugin +from functools import partial + +class DetectIndentationCommand(sublime_plugin.TextCommand): + """Examines the contents of the buffer to determine the indentation + settings.""" + + def run(self, edit, show_message = True, threshold = 10): + sample = self.view.substr(sublime.Region(0, min(self.view.size(), 2**14))) + + starts_with_tab = 0 + spaces_list = [] + indented_lines = 0 + + for line in sample.split("\n"): + if not line: continue + if line[0] == "\t": + starts_with_tab += 1 + indented_lines += 1 + elif line.startswith(' '): + spaces = 0 + for ch in line: + if ch == ' ': spaces += 1 + else: break + if spaces > 1 and spaces != len(line): + indented_lines += 1 + spaces_list.append(spaces) + + evidence = [1.0, 1.0, 0.8, 0.9, 0.8, 0.9, 0.9, 0.95, 1.0] + + if indented_lines >= threshold: + if len(spaces_list) > starts_with_tab: + for indent in xrange(8, 1, -1): + same_indent = filter(lambda x: x % indent == 0, spaces_list) + if len(same_indent) >= evidence[indent] * len(spaces_list): + if show_message: + sublime.status_message("Detect Indentation: Setting indentation to " + + str(indent) + " spaces") + self.view.settings().set('translate_tabs_to_spaces', True) + self.view.settings().set('tab_size', indent) + return + + for indent in xrange(8, 1, -2): + same_indent = filter(lambda x: x % indent == 0 or x % indent == 1, spaces_list) + if len(same_indent) >= evidence[indent] * len(spaces_list): + if show_message: + sublime.status_message("Detect Indentation: Setting indentation to " + + str(indent) + " spaces") + self.view.settings().set('translate_tabs_to_spaces', True) + self.view.settings().set('tab_size', indent) + return + + elif starts_with_tab >= 0.8 * indented_lines: + if show_message: + sublime.status_message("Detect Indentation: Setting indentation to tabs") + self.view.settings().set('translate_tabs_to_spaces', False) + +class DetectIndentationEventListener(sublime_plugin.EventListener): + def on_load(self, view): + if view.settings().get('detect_indentation'): + is_at_front = view.window() != None + view.run_command('detect_indentation', {'show_message': is_at_front}) diff --git a/sublime-text/Default/detect_indentation.pyc b/sublime-text/Default/detect_indentation.pyc new file mode 100644 index 0000000..12bbe92 Binary files /dev/null and b/sublime-text/Default/detect_indentation.pyc differ diff --git a/sublime-text/Default/duplicate_line.py b/sublime-text/Default/duplicate_line.py new file mode 100644 index 0000000..3a8d37f --- /dev/null +++ b/sublime-text/Default/duplicate_line.py @@ -0,0 +1,11 @@ +import sublime, sublime_plugin + +class DuplicateLineCommand(sublime_plugin.TextCommand): + def run(self, edit): + for region in self.view.sel(): + if region.empty(): + line = self.view.line(region) + line_contents = self.view.substr(line) + '\n' + self.view.insert(edit, line.begin(), line_contents) + else: + self.view.insert(edit, region.begin(), self.view.substr(region)) diff --git a/sublime-text/Default/duplicate_line.pyc b/sublime-text/Default/duplicate_line.pyc new file mode 100644 index 0000000..4830be7 Binary files /dev/null and b/sublime-text/Default/duplicate_line.pyc differ diff --git a/sublime-text/Default/echo.py b/sublime-text/Default/echo.py new file mode 100644 index 0000000..dc7d730 --- /dev/null +++ b/sublime-text/Default/echo.py @@ -0,0 +1,5 @@ +import sublime, sublime_plugin + +class EchoCommand(sublime_plugin.ApplicationCommand): + def run(self, **kwargs): + print kwargs diff --git a/sublime-text/Default/echo.pyc b/sublime-text/Default/echo.pyc new file mode 100644 index 0000000..024cbc3 Binary files /dev/null and b/sublime-text/Default/echo.pyc differ diff --git a/sublime-text/Default/exec.py b/sublime-text/Default/exec.py new file mode 100644 index 0000000..f51f775 --- /dev/null +++ b/sublime-text/Default/exec.py @@ -0,0 +1,229 @@ +import sublime, sublime_plugin +import os, sys +import thread +import subprocess +import functools +import time + +class ProcessListener(object): + def on_data(self, proc, data): + pass + + def on_finished(self, proc): + pass + +# Encapsulates subprocess.Popen, forwarding stdout to a supplied +# ProcessListener (on a separate thread) +class AsyncProcess(object): + def __init__(self, arg_list, env, listener, + # "path" is an option in build systems + path="", + # "shell" is an options in build systems + shell=False): + + self.listener = listener + self.killed = False + + self.start_time = time.time() + + # Hide the console window on Windows + startupinfo = None + if os.name == "nt": + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + + # Set temporary PATH to locate executable in arg_list + if path: + old_path = os.environ["PATH"] + # The user decides in the build system whether he wants to append $PATH + # or tuck it at the front: "$PATH;C:\\new\\path", "C:\\new\\path;$PATH" + os.environ["PATH"] = os.path.expandvars(path).encode(sys.getfilesystemencoding()) + + proc_env = os.environ.copy() + proc_env.update(env) + for k, v in proc_env.iteritems(): + proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding()) + + self.proc = subprocess.Popen(arg_list, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, startupinfo=startupinfo, env=proc_env, shell=shell) + + if path: + os.environ["PATH"] = old_path + + if self.proc.stdout: + thread.start_new_thread(self.read_stdout, ()) + + if self.proc.stderr: + thread.start_new_thread(self.read_stderr, ()) + + def kill(self): + if not self.killed: + self.killed = True + self.proc.terminate() + self.listener = None + + def poll(self): + return self.proc.poll() == None + + def exit_code(self): + return self.proc.poll() + + def read_stdout(self): + while True: + data = os.read(self.proc.stdout.fileno(), 2**15) + + if data != "": + if self.listener: + self.listener.on_data(self, data) + else: + self.proc.stdout.close() + if self.listener: + self.listener.on_finished(self) + break + + def read_stderr(self): + while True: + data = os.read(self.proc.stderr.fileno(), 2**15) + + if data != "": + if self.listener: + self.listener.on_data(self, data) + else: + self.proc.stderr.close() + break + +class ExecCommand(sublime_plugin.WindowCommand, ProcessListener): + def run(self, cmd = [], file_regex = "", line_regex = "", working_dir = "", + encoding = "utf-8", env = {}, quiet = False, kill = False, + # Catches "path" and "shell" + **kwargs): + + if kill: + if self.proc: + self.proc.kill() + self.proc = None + self.append_data(None, "[Cancelled]") + return + + if not hasattr(self, 'output_view'): + # Try not to call get_output_panel until the regexes are assigned + self.output_view = self.window.get_output_panel("exec") + + # Default the to the current files directory if no working directory was given + if (working_dir == "" and self.window.active_view() + and self.window.active_view().file_name()): + working_dir = os.path.dirname(self.window.active_view().file_name()) + + self.output_view.settings().set("result_file_regex", file_regex) + self.output_view.settings().set("result_line_regex", line_regex) + self.output_view.settings().set("result_base_dir", working_dir) + + # Call get_output_panel a second time after assigning the above + # settings, so that it'll be picked up as a result buffer + self.window.get_output_panel("exec") + + self.encoding = encoding + self.quiet = quiet + + self.proc = None + if not self.quiet: + print "Running " + " ".join(cmd) + sublime.status_message("Building") + + show_panel_on_build = sublime.load_settings("Preferences.sublime-settings").get("show_panel_on_build", True) + if show_panel_on_build: + self.window.run_command("show_panel", {"panel": "output.exec"}) + + merged_env = env.copy() + if self.window.active_view(): + user_env = self.window.active_view().settings().get('build_env') + if user_env: + merged_env.update(user_env) + + # Change to the working dir, rather than spawning the process with it, + # so that emitted working dir relative path names make sense + if working_dir != "": + os.chdir(working_dir) + + err_type = OSError + if os.name == "nt": + err_type = WindowsError + + try: + # Forward kwargs to AsyncProcess + self.proc = AsyncProcess(cmd, merged_env, self, **kwargs) + except err_type as e: + self.append_data(None, str(e) + "\n") + self.append_data(None, "[cmd: " + str(cmd) + "]\n") + self.append_data(None, "[dir: " + str(os.getcwdu()) + "]\n") + if "PATH" in merged_env: + self.append_data(None, "[path: " + str(merged_env["PATH"]) + "]\n") + else: + self.append_data(None, "[path: " + str(os.environ["PATH"]) + "]\n") + if not self.quiet: + self.append_data(None, "[Finished]") + + def is_enabled(self, kill = False): + if kill: + return hasattr(self, 'proc') and self.proc and self.proc.poll() + else: + return True + + def append_data(self, proc, data): + if proc != self.proc: + # a second call to exec has been made before the first one + # finished, ignore it instead of intermingling the output. + if proc: + proc.kill() + return + + try: + str = data.decode(self.encoding) + except: + str = "[Decode error - output not " + self.encoding + "]\n" + proc = None + + # Normalize newlines, Sublime Text always uses a single \n separator + # in memory. + str = str.replace('\r\n', '\n').replace('\r', '\n') + + selection_was_at_end = (len(self.output_view.sel()) == 1 + and self.output_view.sel()[0] + == sublime.Region(self.output_view.size())) + self.output_view.set_read_only(False) + edit = self.output_view.begin_edit() + self.output_view.insert(edit, self.output_view.size(), str) + if selection_was_at_end: + self.output_view.show(self.output_view.size()) + self.output_view.end_edit(edit) + self.output_view.set_read_only(True) + + def finish(self, proc): + if not self.quiet: + elapsed = time.time() - proc.start_time + exit_code = proc.exit_code() + if exit_code == 0 or exit_code == None: + self.append_data(proc, ("[Finished in %.1fs]") % (elapsed)) + else: + self.append_data(proc, ("[Finished in %.1fs with exit code %d]") % (elapsed, exit_code)) + + if proc != self.proc: + return + + errs = self.output_view.find_all_results() + if len(errs) == 0: + sublime.status_message("Build finished") + else: + sublime.status_message(("Build finished with %d errors") % len(errs)) + + # Set the selection to the start, so that next_result will work as expected + edit = self.output_view.begin_edit() + self.output_view.sel().clear() + self.output_view.sel().add(sublime.Region(0)) + self.output_view.end_edit(edit) + + def on_data(self, proc, data): + sublime.set_timeout(functools.partial(self.append_data, proc, data), 0) + + def on_finished(self, proc): + sublime.set_timeout(functools.partial(self.finish, proc), 0) diff --git a/sublime-text/Default/exec.pyc b/sublime-text/Default/exec.pyc new file mode 100644 index 0000000..f2584d7 Binary files /dev/null and b/sublime-text/Default/exec.pyc differ diff --git a/sublime-text/Default/fold.py b/sublime-text/Default/fold.py new file mode 100644 index 0000000..6747e5d --- /dev/null +++ b/sublime-text/Default/fold.py @@ -0,0 +1,125 @@ +import sublime, sublime_plugin + +def fold_region_from_indent(view, r): + if r.b == view.size(): + return sublime.Region(r.a - 1, r.b) + else: + return sublime.Region(r.a - 1, r.b - 1) + +class FoldUnfoldCommand(sublime_plugin.TextCommand): + def run(self, edit): + new_sel = [] + for s in self.view.sel(): + r = s + empty_region = r.empty() + if empty_region: + r = sublime.Region(r.a - 1, r.a + 1) + + unfolded = self.view.unfold(r) + if len(unfolded) == 0: + self.view.fold(s) + elif empty_region: + for r in unfolded: + new_sel.append(r) + + if len(new_sel) > 0: + self.view.sel().clear() + for r in new_sel: + self.view.sel().add(r) + +class FoldCommand(sublime_plugin.TextCommand): + def run(self, edit): + new_sel = [] + for s in self.view.sel(): + if s.empty(): + r = self.view.indented_region(s.a) + if not r.empty(): + r = fold_region_from_indent(self.view, r) + self.view.fold(r) + new_sel.append(r) + else: + new_sel.append(s) + else: + if self.view.fold(s): + new_sel.append(s) + else: + r = self.view.indented_region(s.a) + if not r.empty(): + r = fold_region_from_indent(self.view, r) + self.view.fold(r) + new_sel.append(r) + else: + new_sel.append(s) + + self.view.sel().clear() + for r in new_sel: + self.view.sel().add(r) + +class FoldAllCommand(sublime_plugin.TextCommand): + def run(self, edit): + folds = [] + tp = 0 + size = self.view.size() + while tp < size: + s = self.view.indented_region(tp) + if not s.empty(): + r = fold_region_from_indent(self.view, s) + folds.append(r) + tp = s.b + else: + tp = self.view.full_line(tp).b + + self.view.fold(folds) + self.view.show(self.view.sel()) + + sublime.status_message("Folded " + str(len(folds)) + " regions") + +class FoldByLevelCommand(sublime_plugin.TextCommand): + def run(self, edit, level): + level = int(level) + folds = [] + tp = 0 + size = self.view.size() + while tp < size: + if self.view.indentation_level(tp) == level: + s = self.view.indented_region(tp) + if not s.empty(): + r = fold_region_from_indent(self.view, s) + folds.append(r) + tp = s.b + continue; + + tp = self.view.full_line(tp).b + + self.view.fold(folds) + self.view.show(self.view.sel()) + + sublime.status_message("Folded " + str(len(folds)) + " regions") + +class UnfoldCommand(sublime_plugin.TextCommand): + def run(self, edit): + new_sel = [] + for s in self.view.sel(): + unfold = s + if s.empty(): + unfold = sublime.Region(s.a - 1, s.a + 1) + + unfolded = self.view.unfold(unfold) + if len(unfolded) == 0 and s.empty(): + unfolded = self.view.unfold(self.view.full_line(s.b)) + + if len(unfolded) == 0: + new_sel.append(s) + else: + for r in unfolded: + new_sel.append(r) + + if len(new_sel) > 0: + self.view.sel().clear() + for r in new_sel: + self.view.sel().add(r) + +class UnfoldAllCommand(sublime_plugin.TextCommand): + def run(self, edit): + self.view.unfold(sublime.Region(0, self.view.size())) + self.view.show(self.view.sel()) diff --git a/sublime-text/Default/fold.pyc b/sublime-text/Default/fold.pyc new file mode 100644 index 0000000..56b63f6 Binary files /dev/null and b/sublime-text/Default/fold.pyc differ diff --git a/sublime-text/Default/font.py b/sublime-text/Default/font.py new file mode 100644 index 0000000..b9b5173 --- /dev/null +++ b/sublime-text/Default/font.py @@ -0,0 +1,45 @@ +import sublime, sublime_plugin + +class IncreaseFontSizeCommand(sublime_plugin.ApplicationCommand): + def run(self): + s = sublime.load_settings("Preferences.sublime-settings") + current = s.get("font_size", 10) + + if current >= 36: + current += 4 + elif current >= 24: + current += 2 + else: + current += 1 + + if current > 128: + current = 128 + s.set("font_size", current) + + sublime.save_settings("Preferences.sublime-settings") + +class DecreaseFontSizeCommand(sublime_plugin.ApplicationCommand): + def run(self): + s = sublime.load_settings("Preferences.sublime-settings") + current = s.get("font_size", 10) + # current -= 1 + + if current >= 40: + current -= 4 + elif current >= 26: + current -= 2 + else: + current -= 1 + + if current < 8: + current = 8 + s.set("font_size", current) + + sublime.save_settings("Preferences.sublime-settings") + +class ResetFontSizeCommand(sublime_plugin.ApplicationCommand): + def run(self): + s = sublime.load_settings("Preferences.sublime-settings") + s.erase("font_size") + + sublime.save_settings("Preferences.sublime-settings") diff --git a/sublime-text/Default/font.pyc b/sublime-text/Default/font.pyc new file mode 100644 index 0000000..bbb718e Binary files /dev/null and b/sublime-text/Default/font.pyc differ diff --git a/sublime-text/Default/goto_line.py b/sublime-text/Default/goto_line.py new file mode 100644 index 0000000..2ec2ea2 --- /dev/null +++ b/sublime-text/Default/goto_line.py @@ -0,0 +1,33 @@ +import sublime, sublime_plugin + +class PromptGotoLineCommand(sublime_plugin.WindowCommand): + + def run(self): + self.window.show_input_panel("Goto Line:", "", self.on_done, None, None) + pass + + def on_done(self, text): + try: + line = int(text) + if self.window.active_view(): + self.window.active_view().run_command("goto_line", {"line": line} ) + except ValueError: + pass + +class GotoLineCommand(sublime_plugin.TextCommand): + + def run(self, edit, line): + # Convert from 1 based to a 0 based line number + line = int(line) - 1 + + # Negative line numbers count from the end of the buffer + if line < 0: + lines, _ = self.view.rowcol(self.view.size()) + line = lines + line + 1 + + pt = self.view.text_point(line, 0) + + self.view.sel().clear() + self.view.sel().add(sublime.Region(pt)) + + self.view.show(pt) diff --git a/sublime-text/Default/goto_line.pyc b/sublime-text/Default/goto_line.pyc new file mode 100644 index 0000000..7294cf3 Binary files /dev/null and b/sublime-text/Default/goto_line.pyc differ diff --git a/sublime-text/Default/indentation.py b/sublime-text/Default/indentation.py new file mode 100644 index 0000000..dac7aba --- /dev/null +++ b/sublime-text/Default/indentation.py @@ -0,0 +1,168 @@ +import re +import os +import textwrap +import sublime +import sublime_plugin + +def get_tab_size(view): + return int(view.settings().get('tab_size', 8)) + +def normed_indentation_pt(view, sel, non_space=False): + """ + Calculates tab normed `visual` position of sel.begin() relative " + to start of line + + \n\t\t\t => normed_indentation_pt => 12 + \n \t\t\t => normed_indentation_pt => 12 + + Different amount of characters, same visual indentation. + """ + + tab_size = get_tab_size(view) + pos = 0 + ln = view.line(sel) + + for pt in xrange(ln.begin(), ln.end() if non_space else sel.begin()): + ch = view.substr(pt) + + if ch == '\t': + pos += tab_size - (pos % tab_size) + + elif ch.isspace(): + pos += 1 + + elif non_space: + break + else: + pos+=1 + + return pos + +def compress_column(column): + # "SS\T" + if all(c.isspace() for c in column): + column = '\t' + + # "CCSS" + elif column[-1] == ' ': + while column and column[-1] == ' ': + column.pop() + column.append('\t') + + # "CC\T" + return column + +def line_and_normed_pt(view, pt): + return ( view.rowcol(pt)[0], + normed_indentation_pt(view, sublime.Region(pt)) ) + +def pt_from_line_and_normed_pt(view, (ln, pt)): + i = start_pt = view.text_point(ln, 0) + tab_size = get_tab_size(view) + + pos = 0 + + for i in xrange(start_pt, start_pt + pt): + ch = view.substr(i) + + if ch == '\t': + pos += tab_size - (pos % tab_size) + else: + pos += 1 + + i += 1 + if pos == pt: break + + return i + +def save_selections(view, selections=None): + return [ [line_and_normed_pt(view, p) for p in (sel.a, sel.b)] + for sel in selections or view.sel() ] + +def region_from_stored_selection(view, stored): + return sublime.Region(*[pt_from_line_and_normed_pt(view, p) for p in stored]) + +def restore_selections(view, lines_and_pts): + view.sel().clear() + + for stored in lines_and_pts: + view.sel().add(region_from_stored_selection(view, stored)) + +def unexpand(the_string, tab_size, first_line_offset = 0, only_leading=True): + lines = the_string.split('\n') + compressed = [] + + for li, line in enumerate(lines): + pos = 0 + + if not li: pos += first_line_offset + + rebuilt_line = [] + column = [] + + for i, char in enumerate(line): + if only_leading and not char.isspace(): + column.extend(list(line[i:])) + break + + column.append(char) + pos += 1 + + if char == '\t': + pos += tab_size - (pos % tab_size) + + if pos % tab_size == 0: + rebuilt_line.extend(compress_column(column)) + column = [] + + rebuilt_line.extend(column) + compressed.append(''.join(rebuilt_line)) + + return '\n'.join(compressed) + +class TabCommand(sublime_plugin.TextCommand): + translate = False + + def run(self, edit, set_translate_tabs=False, whole_buffer=True, **kw): + view = self.view + + if set_translate_tabs or not self.translate: + view.settings().set('translate_tabs_to_spaces', self.translate) + + if whole_buffer or not view.has_non_empty_selection_region(): + self.operation_regions = [sublime.Region(0, view.size())] + else: + self.operation_regions = view.sel() + + sels = save_selections(view) + visible, = save_selections(view, [view.visible_region()]) + self.do(edit, **kw) + restore_selections(view, sels) + visible = region_from_stored_selection(view, visible) + view.show(visible, False) + view.run_command("scroll_lines", {"amount": 1.0 }) + +class ExpandTabs(TabCommand): + translate = True + + def do(self, edit, **kw): + view = self.view + tab_size = get_tab_size(view) + + for sel in self.operation_regions: + sel = view.line(sel) # TODO: expand tabs with non regular offsets + view.replace(edit, sel, view.substr(sel).expandtabs(tab_size)) + +class UnexpandTabs(TabCommand): + def do(self, edit, only_leading = True, **kw): + view = self.view + tab_size = get_tab_size(view) + + for sel in self.operation_regions: + the_string = view.substr(sel) + first_line_off_set = normed_indentation_pt( view, sel ) % tab_size + + compressed = unexpand( the_string, tab_size, first_line_off_set, + only_leading = only_leading ) + + view.replace(edit, sel, compressed) diff --git a/sublime-text/Default/indentation.pyc b/sublime-text/Default/indentation.pyc new file mode 100644 index 0000000..34fb693 Binary files /dev/null and b/sublime-text/Default/indentation.pyc differ diff --git a/sublime-text/Default/kill_ring.py b/sublime-text/Default/kill_ring.py new file mode 100644 index 0000000..d47639f --- /dev/null +++ b/sublime-text/Default/kill_ring.py @@ -0,0 +1,107 @@ +import sublime_plugin, sublime + +class KillRing: + def __init__(self): + self.limit = 16 + self.buffer = [None for i in xrange(self.limit)] + self.head = 0 + self.len = 0 + self.kill_points = [] + self.kill_id = 0 + + def top(self): + return self.buffer[self.head] + + def seal(self): + self.kill_points = [] + self.kill_id = 0 + + def push(self, text): + self.head = (self.head + 1) % self.limit + self.buffer[self.head] = text + if self.len < self.limit: + self.len += 1 + + def add(self, view_id, text, regions, forward): + if view_id != self.kill_id: + # view has changed, ensure the last kill ring entry will not be + # appended to + self.seal() + + begin_points = [] + end_points = [] + for r in regions: + begin_points.append(r.begin()) + end_points.append(r.end()) + + if forward: + compare_points = begin_points + else: + compare_points = end_points + + if compare_points == self.kill_points: + # Selection hasn't moved since the last kill, append/prepend the + # text to the current entry + if forward: + self.buffer[self.head] = self.buffer[self.head] + text + else: + self.buffer[self.head] = text + self.buffer[self.head] + else: + # Create a new entry in the kill ring for this text + self.push(text) + + self.kill_points = begin_points + self.kill_id = view_id + + def get(self, index): + return self.buffer[(self.head + index) % self.limit] + + def __len__(self): + return self.len + +kill_ring = KillRing() + +class YankCommand(sublime_plugin.TextCommand): + def run(self, edit): + kill_ring.seal() + text = kill_ring.top() + + lines = text.splitlines() + + regions = [r for r in self.view.sel()] + regions.reverse() + + if len(regions) > 1 and len(regions) == len(lines): + # insert one line from the top of the kill ring at each + # corresponding selection + for i in xrange(len(regions)): + s = regions[i] + line = lines[i] + num = self.view.insert(edit, s.begin(), line) + self.view.erase(edit, sublime.Region(s.begin() + num, + s.end() + num)) + else: + # insert the top of the kill ring at each selection + for s in regions: + num = self.view.insert(edit, s.begin(), text) + self.view.erase(edit, sublime.Region(s.begin() + num, + s.end() + num)) + + def is_enabled(self): + return len(kill_ring) > 0 + +class AddToKillRingCommand(sublime_plugin.TextCommand): + def run(self, edit, forward): + delta = 1 + if not forward: + delta = -1 + + text = [] + regions = [] + for s in self.view.sel(): + if s.empty(): + s = sublime.Region(s.a, s.a + delta) + text.append(self.view.substr(s)) + regions.append(s) + + kill_ring.add(self.view.id(), "\n".join(text), regions, forward) diff --git a/sublime-text/Default/kill_ring.pyc b/sublime-text/Default/kill_ring.pyc new file mode 100644 index 0000000..33cbef2 Binary files /dev/null and b/sublime-text/Default/kill_ring.pyc differ diff --git a/sublime-text/Default/mark.py b/sublime-text/Default/mark.py new file mode 100644 index 0000000..284b52c --- /dev/null +++ b/sublime-text/Default/mark.py @@ -0,0 +1,43 @@ +import sublime, sublime_plugin + +class SetMarkCommand(sublime_plugin.TextCommand): + def run(self, edit): + mark = [s for s in self.view.sel()] + self.view.add_regions("mark", mark, "mark", "dot", + sublime.HIDDEN | sublime.PERSISTENT) + +class SwapWithMarkCommand(sublime_plugin.TextCommand): + def run(self, edit): + old_mark = self.view.get_regions("mark") + + mark = [s for s in self.view.sel()] + self.view.add_regions("mark", mark, "mark", "dot", + sublime.HIDDEN | sublime.PERSISTENT) + + if len(old_mark): + self.view.sel().clear() + for r in old_mark: + self.view.sel().add(r) + +class SelectToMarkCommand(sublime_plugin.TextCommand): + def run(self, edit): + mark = self.view.get_regions("mark") + + num = min(len(mark), len(self.view.sel())) + + regions = [] + for i in xrange(num): + regions.append(self.view.sel()[i].cover(mark[i])) + + for i in xrange(num, len(self.view.sel())): + regions.append(self.view.sel()[i]) + + self.view.sel().clear() + for r in regions: + self.view.sel().add(r) + +class DeleteToMark(sublime_plugin.TextCommand): + def run(self, edit): + self.view.run_command("select_to_mark") + self.view.run_command("add_to_kill_ring", {"forward": False}) + self.view.run_command("left_delete") diff --git a/sublime-text/Default/mark.pyc b/sublime-text/Default/mark.pyc new file mode 100644 index 0000000..0ba2b3d Binary files /dev/null and b/sublime-text/Default/mark.pyc differ diff --git a/sublime-text/Default/new_templates.py b/sublime-text/Default/new_templates.py new file mode 100644 index 0000000..f288b7b --- /dev/null +++ b/sublime-text/Default/new_templates.py @@ -0,0 +1,53 @@ +import sublime, sublime_plugin +import os + +class NewBuildSystemCommand(sublime_plugin.WindowCommand): + def run(self): + v = self.window.new_file() + v.settings().set('default_dir', + os.path.join(sublime.packages_path(), 'User')) + v.set_syntax_file('Packages/JavaScript/JSON.tmLanguage') + v.set_name('untitled.sublime-build') + + template = """{ + "cmd": ["${0:make}"] +} +""" + v.run_command("insert_snippet", {"contents": template}) + + +class NewPluginCommand(sublime_plugin.WindowCommand): + def run(self): + v = self.window.new_file() + v.settings().set('default_dir', + os.path.join(sublime.packages_path(), 'User')) + v.set_syntax_file('Packages/Python/Python.tmLanguage') + + template = """import sublime, sublime_plugin + +class ExampleCommand(sublime_plugin.TextCommand): + def run(self, edit): + $0self.view.insert(edit, 0, "Hello, World!") +""" + v.run_command("insert_snippet", {"contents": template}) + + +class NewSnippetCommand(sublime_plugin.WindowCommand): + def run(self): + v = self.window.new_file() + v.settings().set('default_dir', + os.path.join(sublime.packages_path(), 'User')) + v.settings().set('default_extension', 'sublime-snippet') + v.set_syntax_file('Packages/XML/XML.tmLanguage') + + template = """ + + + + + + +""" + v.run_command("insert_snippet", {"contents": template}) diff --git a/sublime-text/Default/new_templates.pyc b/sublime-text/Default/new_templates.pyc new file mode 100644 index 0000000..0a666f4 Binary files /dev/null and b/sublime-text/Default/new_templates.pyc differ diff --git a/sublime-text/Default/open_file_settings.py b/sublime-text/Default/open_file_settings.py new file mode 100644 index 0000000..c701d94 --- /dev/null +++ b/sublime-text/Default/open_file_settings.py @@ -0,0 +1,12 @@ +import sublime, sublime_plugin +import os.path + +class OpenFileSettingsCommand(sublime_plugin.WindowCommand): + def run(self): + view = self.window.active_view() + settings_name, _ = os.path.splitext(os.path.basename(view.settings().get('syntax'))) + dir_name = os.path.join(sublime.packages_path(), 'User') + self.window.open_file(os.path.join(dir_name, settings_name + ".sublime-settings")) + + def is_enabled(self): + return self.window.active_view() != None diff --git a/sublime-text/Default/open_file_settings.pyc b/sublime-text/Default/open_file_settings.pyc new file mode 100644 index 0000000..0895b24 Binary files /dev/null and b/sublime-text/Default/open_file_settings.pyc differ diff --git a/sublime-text/Default/open_in_browser.py b/sublime-text/Default/open_in_browser.py new file mode 100644 index 0000000..042f141 --- /dev/null +++ b/sublime-text/Default/open_in_browser.py @@ -0,0 +1,13 @@ +import sublime, sublime_plugin +import webbrowser + +class OpenInBrowserCommand(sublime_plugin.TextCommand): + def run(self, edit): + if self.view.file_name(): + webbrowser.open_new_tab("file://" + self.view.file_name()) + + def is_visible(self): + return self.view.file_name() and (self.view.file_name()[-5:] == ".html" or + self.view.file_name()[-5:] == ".HTML" or + self.view.file_name()[-4:] == ".htm" or + self.view.file_name()[-4:] == ".HTM") diff --git a/sublime-text/Default/open_in_browser.pyc b/sublime-text/Default/open_in_browser.pyc new file mode 100644 index 0000000..40d0f86 Binary files /dev/null and b/sublime-text/Default/open_in_browser.pyc differ diff --git a/sublime-text/Default/paragraph.py b/sublime-text/Default/paragraph.py new file mode 100644 index 0000000..bb5fb22 --- /dev/null +++ b/sublime-text/Default/paragraph.py @@ -0,0 +1,211 @@ +import sublime, sublime_plugin +import string +import textwrap +import re +import comment + +def previous_line(view, sr): + """sr should be a Region covering the entire hard line""" + if sr.begin() == 0: + return None + else: + return view.full_line(sr.begin() - 1) + +def next_line(view, sr): + """sr should be a Region covering the entire hard line, including + the newline""" + if sr.end() == view.size(): + return None + else: + return view.full_line(sr.end()) + + +separating_line_pattern = re.compile("^[\\t ]*\\n?$") + +def is_paragraph_separating_line(view, sr): + return separating_line_pattern.match(view.substr(sr)) != None + +def has_prefix(view, line, prefix): + if not prefix: + return True + + line_start = view.substr(sublime.Region(line.begin(), + line.begin() + len(prefix))) + + return line_start == prefix + +def expand_to_paragraph(view, tp): + sr = view.full_line(tp) + if is_paragraph_separating_line(view, sr): + return sublime.Region(tp, tp) + + required_prefix = None + + # If the current line starts with a comment, only select lines that are also + # commented + (line_comments, block_comments) = comment.build_comment_data(view, tp) + dataStart = comment.advance_to_first_non_white_space_on_line(view, sr.begin()) + for c in line_comments: + (start, disable_indent) = c + comment_region = sublime.Region(dataStart, + dataStart + len(start)) + if view.substr(comment_region) == start: + required_prefix = view.substr(sublime.Region(sr.begin(), comment_region.end())) + break + + first = sr.begin() + prev = sr + while True: + prev = previous_line(view, prev) + if (prev == None or is_paragraph_separating_line(view, prev) or + not has_prefix(view, prev, required_prefix)): + break + else: + first = prev.begin() + + last = sr.end() + next = sr + while True: + next = next_line(view, next) + if (next == None or is_paragraph_separating_line(view, next) or + not has_prefix(view, next, required_prefix)): + break + else: + last = next.end() + + return sublime.Region(first, last) + +def all_paragraphs_intersecting_selection(view, sr): + paragraphs = [] + + para = expand_to_paragraph(view, sr.begin()) + if not para.empty(): + paragraphs.append(para) + + while True: + line = next_line(view, para) + if line == None or line.begin() >= sr.end(): + break; + + if not is_paragraph_separating_line(view, line): + para = expand_to_paragraph(view, line.begin()) + paragraphs.append(para) + else: + para = line + + return paragraphs + + +class ExpandSelectionToParagraphCommand(sublime_plugin.TextCommand): + def run(self, edit): + regions = [] + + for s in self.view.sel(): + regions.append(sublime.Region( + expand_to_paragraph(self.view, s.begin()).begin(), + expand_to_paragraph(self.view, s.end()).end())) + + for r in regions: + self.view.sel().add(r) + + +class WrapLinesCommand(sublime_plugin.TextCommand): + line_prefix_pattern = re.compile("^\W+") + + def extract_prefix(self, sr): + lines = self.view.split_by_newlines(sr) + if len(lines) == 0: + return None + + initial_prefix_match = self.line_prefix_pattern.match(self.view.substr( + lines[0])) + if not initial_prefix_match: + return None + + prefix = self.view.substr(sublime.Region(lines[0].begin(), + lines[0].begin() + initial_prefix_match.end())) + + for line in lines[1:]: + if self.view.substr(sublime.Region(line.begin(), + line.begin() + len(prefix))) != prefix: + return None + + return prefix + + def width_in_spaces(self, str, tab_width): + sum = 0; + for c in str: + if c == '\t': + sum += tab_width - 1 + return sum + + def run(self, edit, width=0): + if width == 0 and self.view.settings().get("wrap_width"): + try: + width = int(self.view.settings().get("wrap_width")) + except TypeError: + pass + + if width == 0 and self.view.settings().get("rulers"): + # try and guess the wrap width from the ruler, if any + try: + width = int(self.view.settings().get("rulers")[0]) + except ValueError: + pass + except TypeError: + pass + + if width == 0: + width = 78 + + # Make sure tabs are handled as per the current buffer + tab_width = 8 + if self.view.settings().get("tab_size"): + try: + tab_width = int(self.view.settings().get("tab_size")) + except TypeError: + pass + + if tab_width == 0: + tab_width == 8 + + paragraphs = [] + for s in self.view.sel(): + paragraphs.extend(all_paragraphs_intersecting_selection(self.view, s)) + + if len(paragraphs) > 0: + self.view.sel().clear() + for p in paragraphs: + self.view.sel().add(p) + + # This isn't an ideal way to do it, as we loose the position of the + # cursor within the paragraph: hence why the paragraph is selected + # at the end. + for s in self.view.sel(): + wrapper = textwrap.TextWrapper() + wrapper.expand_tabs = False + wrapper.width = width + prefix = self.extract_prefix(s) + if prefix: + wrapper.initial_indent = prefix + wrapper.subsequent_indent = prefix + wrapper.width -= self.width_in_spaces(prefix, tab_width) + + if wrapper.width < 0: + continue + + txt = self.view.substr(s) + if prefix: + txt = txt.replace(prefix, u"") + + txt = string.expandtabs(txt, tab_width) + + txt = wrapper.fill(txt) + u"\n" + self.view.replace(edit, s, txt) + + # It's unhelpful to have the entire paragraph selected, just leave the + # selection at the end + ends = [s.end() - 1 for s in self.view.sel()] + self.view.sel().clear() + for pt in ends: + self.view.sel().add(sublime.Region(pt)) diff --git a/sublime-text/Default/paragraph.pyc b/sublime-text/Default/paragraph.pyc new file mode 100644 index 0000000..b572545 Binary files /dev/null and b/sublime-text/Default/paragraph.pyc differ diff --git a/sublime-text/Default/save_on_focus_lost.py b/sublime-text/Default/save_on_focus_lost.py new file mode 100644 index 0000000..939259c --- /dev/null +++ b/sublime-text/Default/save_on_focus_lost.py @@ -0,0 +1,10 @@ +import sublime, sublime_plugin +import os.path + +class SaveOnFocusLost(sublime_plugin.EventListener): + def on_deactivated(self, view): + # The check for os.path.exists ensures that deleted files won't be resurrected + if (view.file_name() and view.is_dirty() and + view.settings().get('save_on_focus_lost') == True and + os.path.exists(view.file_name())): + view.run_command('save'); diff --git a/sublime-text/Default/save_on_focus_lost.pyc b/sublime-text/Default/save_on_focus_lost.pyc new file mode 100644 index 0000000..689d4a8 Binary files /dev/null and b/sublime-text/Default/save_on_focus_lost.pyc differ diff --git a/sublime-text/Default/scroll.py b/sublime-text/Default/scroll.py new file mode 100644 index 0000000..1d9dcaa --- /dev/null +++ b/sublime-text/Default/scroll.py @@ -0,0 +1,13 @@ +import sublime, sublime_plugin + +class ScrollToBof(sublime_plugin.TextCommand): + def run(self, edit): + self.view.show(0) + +class ScrollToEof(sublime_plugin.TextCommand): + def run(self, edit): + self.view.show(self.view.size()) + +class ShowAtCenter(sublime_plugin.TextCommand): + def run(self, edit): + self.view.show_at_center(self.view.sel()[0]) diff --git a/sublime-text/Default/scroll.pyc b/sublime-text/Default/scroll.pyc new file mode 100644 index 0000000..2a884ee Binary files /dev/null and b/sublime-text/Default/scroll.pyc differ diff --git a/sublime-text/Default/send2trash/__init__.py b/sublime-text/Default/send2trash/__init__.py new file mode 100644 index 0000000..d6fa7f0 --- /dev/null +++ b/sublime-text/Default/send2trash/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) + +# This software is licensed under the "BSD" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at +# http://www.hardcoded.net/licenses/bsd_license + +import sys + +if sys.platform == 'darwin': + from .plat_osx import send2trash +elif sys.platform == 'win32': + from .plat_win import send2trash +else: + from .plat_other import send2trash diff --git a/sublime-text/Default/send2trash/__init__.pyc b/sublime-text/Default/send2trash/__init__.pyc new file mode 100644 index 0000000..44f2792 Binary files /dev/null and b/sublime-text/Default/send2trash/__init__.pyc differ diff --git a/sublime-text/Default/send2trash/plat_osx.py b/sublime-text/Default/send2trash/plat_osx.py new file mode 100644 index 0000000..ba58b6f --- /dev/null +++ b/sublime-text/Default/send2trash/plat_osx.py @@ -0,0 +1,44 @@ +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) + +# This software is licensed under the "BSD" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at +# http://www.hardcoded.net/licenses/bsd_license + +from ctypes import cdll, byref, Structure, c_char, c_char_p +from ctypes.util import find_library + +Foundation = cdll.LoadLibrary(find_library('Foundation')) +CoreServices = cdll.LoadLibrary(find_library('CoreServices')) + +GetMacOSStatusCommentString = Foundation.GetMacOSStatusCommentString +GetMacOSStatusCommentString.restype = c_char_p +FSPathMakeRefWithOptions = CoreServices.FSPathMakeRefWithOptions +FSMoveObjectToTrashSync = CoreServices.FSMoveObjectToTrashSync + +kFSPathMakeRefDefaultOptions = 0 +kFSPathMakeRefDoNotFollowLeafSymlink = 0x01 + +kFSFileOperationDefaultOptions = 0 +kFSFileOperationOverwrite = 0x01 +kFSFileOperationSkipSourcePermissionErrors = 0x02 +kFSFileOperationDoNotMoveAcrossVolumes = 0x04 +kFSFileOperationSkipPreflight = 0x08 + +class FSRef(Structure): + _fields_ = [('hidden', c_char * 80)] + +def check_op_result(op_result): + if op_result: + msg = GetMacOSStatusCommentString(op_result).decode('utf-8') + raise OSError(msg) + +def send2trash(path): + if not isinstance(path, bytes): + path = path.encode('utf-8') + fp = FSRef() + opts = kFSPathMakeRefDoNotFollowLeafSymlink + op_result = FSPathMakeRefWithOptions(path, opts, byref(fp), None) + check_op_result(op_result) + opts = kFSFileOperationDefaultOptions + op_result = FSMoveObjectToTrashSync(byref(fp), None, opts) + check_op_result(op_result) diff --git a/sublime-text/Default/send2trash/plat_other.py b/sublime-text/Default/send2trash/plat_other.py new file mode 100644 index 0000000..ee1479b --- /dev/null +++ b/sublime-text/Default/send2trash/plat_other.py @@ -0,0 +1,154 @@ +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) + +# This software is licensed under the "BSD" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at +# http://www.hardcoded.net/licenses/bsd_license + +# This is a reimplementation of plat_other.py with reference to the +# freedesktop.org trash specification: +# [1] http://www.freedesktop.org/wiki/Specifications/trash-spec +# [2] http://www.ramendik.ru/docs/trashspec.html +# See also: +# [3] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html +# +# For external volumes this implementation will raise an exception if it can't +# find or create the user's trash directory. + +import sys +import os +import os.path as op +from datetime import datetime +import stat +from urllib import quote + +FILES_DIR = 'files' +INFO_DIR = 'info' +INFO_SUFFIX = '.trashinfo' + +# Default of ~/.local/share [3] +XDG_DATA_HOME = op.expanduser(os.environ.get('XDG_DATA_HOME', '~/.local/share')) +HOMETRASH = op.join(XDG_DATA_HOME, 'Trash') + +uid = os.getuid() +TOPDIR_TRASH = '.Trash' +TOPDIR_FALLBACK = '.Trash-' + str(uid) + +def is_parent(parent, path): + path = op.realpath(path) # In case it's a symlink + parent = op.realpath(parent) + return path.startswith(parent) + +def format_date(date): + return date.strftime("%Y-%m-%dT%H:%M:%S") + +def info_for(src, topdir): + # ...it MUST not include a ".."" directory, and for files not "under" that + # directory, absolute pathnames must be used. [2] + if topdir is None or not is_parent(topdir, src): + src = op.abspath(src) + else: + src = op.relpath(src, topdir) + + info = "[Trash Info]\n" + info += "Path=" + quote(src) + "\n" + info += "DeletionDate=" + format_date(datetime.now()) + "\n" + return info + +def check_create(dir): + # use 0700 for paths [3] + if not op.exists(dir): + os.makedirs(dir, 0o700) + +def trash_move(src, dst, topdir=None): + filename = op.basename(src) + filespath = op.join(dst, FILES_DIR) + infopath = op.join(dst, INFO_DIR) + base_name, ext = op.splitext(filename) + + counter = 0 + destname = filename + while op.exists(op.join(filespath, destname)) or op.exists(op.join(infopath, destname + INFO_SUFFIX)): + counter += 1 + destname = '%s %s%s' % (base_name, counter, ext) + + check_create(filespath) + check_create(infopath) + + os.rename(src, op.join(filespath, destname)) + f = open(op.join(infopath, destname + INFO_SUFFIX), 'w') + f.write(info_for(src, topdir)) + f.close() + +def find_mount_point(path): + # Even if something's wrong, "/" is a mount point, so the loop will exit. + # Use realpath in case it's a symlink + path = op.realpath(path) # Required to avoid infinite loop + while not op.ismount(path): + path = op.split(path)[0] + return path + +def find_ext_volume_global_trash(volume_root): + # from [2] Trash directories (1) check for a .Trash dir with the right + # permissions set. + trash_dir = op.join(volume_root, TOPDIR_TRASH) + if not op.exists(trash_dir): + return None + + mode = os.lstat(trash_dir).st_mode + # vol/.Trash must be a directory, cannot be a symlink, and must have the + # sticky bit set. + if not op.isdir(trash_dir) or op.islink(trash_dir) or not (mode & stat.S_ISVTX): + return None + + trash_dir = op.join(trash_dir, str(uid)) + try: + check_create(trash_dir) + except OSError: + return None + return trash_dir + +def find_ext_volume_fallback_trash(volume_root): + # from [2] Trash directories (1) create a .Trash-$uid dir. + trash_dir = op.join(volume_root, TOPDIR_FALLBACK) + # Try to make the directory, if we can't the OSError exception will escape + # be thrown out of send2trash. + check_create(trash_dir) + return trash_dir + +def find_ext_volume_trash(volume_root): + trash_dir = find_ext_volume_global_trash(volume_root) + if trash_dir is None: + trash_dir = find_ext_volume_fallback_trash(volume_root) + return trash_dir + +# Pull this out so it's easy to stub (to avoid stubbing lstat itself) +def get_dev(path): + return os.lstat(path).st_dev + +def send2trash(path): + # if not isinstance(path, str): + # path = str(path, sys.getfilesystemencoding()) + if not op.exists(path): + raise OSError("File not found: %s" % path) + # ...should check whether the user has the necessary permissions to delete + # it, before starting the trashing operation itself. [2] + if not os.access(path, os.W_OK): + raise OSError("Permission denied: %s" % path) + # if the file to be trashed is on the same device as HOMETRASH we + # want to move it there. + path_dev = get_dev(path) + + # If XDG_DATA_HOME or HOMETRASH do not yet exist we need to stat the + # home directory, and these paths will be created further on if needed. + trash_dev = get_dev(op.expanduser('~')) + + if path_dev == trash_dev: + topdir = XDG_DATA_HOME + dest_trash = HOMETRASH + else: + topdir = find_mount_point(path) + trash_dev = get_dev(topdir) + if trash_dev != path_dev: + raise OSError("Couldn't find mount point for %s" % path) + dest_trash = find_ext_volume_trash(topdir) + trash_move(path, dest_trash, topdir) diff --git a/sublime-text/Default/send2trash/plat_other.pyc b/sublime-text/Default/send2trash/plat_other.pyc new file mode 100644 index 0000000..2d2f7ab Binary files /dev/null and b/sublime-text/Default/send2trash/plat_other.pyc differ diff --git a/sublime-text/Default/send2trash/plat_win.py b/sublime-text/Default/send2trash/plat_win.py new file mode 100644 index 0000000..b437174 --- /dev/null +++ b/sublime-text/Default/send2trash/plat_win.py @@ -0,0 +1,55 @@ +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) + +# This software is licensed under the "BSD" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at +# http://www.hardcoded.net/licenses/bsd_license + +from ctypes import windll, Structure, byref, c_uint +from ctypes.wintypes import HWND, UINT, LPCWSTR, BOOL +import os.path as op + +shell32 = windll.shell32 +SHFileOperationW = shell32.SHFileOperationW + +class SHFILEOPSTRUCTW(Structure): + _fields_ = [ + ("hwnd", HWND), + ("wFunc", UINT), + ("pFrom", LPCWSTR), + ("pTo", LPCWSTR), + ("fFlags", c_uint), + ("fAnyOperationsAborted", BOOL), + ("hNameMappings", c_uint), + ("lpszProgressTitle", LPCWSTR), + ] + +FO_MOVE = 1 +FO_COPY = 2 +FO_DELETE = 3 +FO_RENAME = 4 + +FOF_MULTIDESTFILES = 1 +FOF_SILENT = 4 +FOF_NOCONFIRMATION = 16 +FOF_ALLOWUNDO = 64 +FOF_NOERRORUI = 1024 + +def send2trash(path): + # if not isinstance(path, str): + # path = str(path, 'mbcs') + if not op.isabs(path): + path = op.abspath(path) + fileop = SHFILEOPSTRUCTW() + fileop.hwnd = 0 + fileop.wFunc = FO_DELETE + fileop.pFrom = LPCWSTR(path + '\0') + fileop.pTo = None + fileop.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT + fileop.fAnyOperationsAborted = 0 + fileop.hNameMappings = 0 + fileop.lpszProgressTitle = None + result = SHFileOperationW(byref(fileop)) + if result: + msg = "Couldn't perform operation. Error code: %d" % result + raise OSError(msg) + diff --git a/sublime-text/Default/set_unsaved_view_name.py b/sublime-text/Default/set_unsaved_view_name.py new file mode 100644 index 0000000..57d4228 --- /dev/null +++ b/sublime-text/Default/set_unsaved_view_name.py @@ -0,0 +1,70 @@ +import sublime, sublime_plugin +import os.path +import string +import functools + +class SetUnsavedViewName(sublime_plugin.EventListener): + setting_name = False + + dropped_chars = string.whitespace + + pending = 0 + + def on_modified(self, view): + if view.file_name() or view.is_loading(): + return + + if self.setting_name: + return + + self.pending += 1 + sublime.set_timeout(functools.partial(self.update_title, view), 20) + + def update_title(self, view): + self.pending -= 1 + if self.pending != 0: + return + + if view.settings().get('set_unsaved_view_name') == False: + return + + cur_name = view.settings().get('auto_name') + view_name = view.name() + + # Only set the name for plain text files + syntax = view.settings().get('syntax') + if syntax != 'Packages/Text/Plain text.tmLanguage': + if cur_name: + # Undo any previous name that was set + view.settings().erase('auto_name') + if cur_name == view_name: + view.set_name("") + return + + # Name has been explicitly set, don't override it + if not cur_name and view_name: + return + + # Name has been explicitly changed, don't override it + if cur_name and cur_name != view.name(): + view.settings().erase('auto_name') + return + + # Don't set the names on widgets, it'll just trigger spurious + # on_modified callbacks + if view.settings().get('is_widget'): + return + + line = view.line(0) + if line.size() > 50: + line = sublime.Region(0, 50) + + first_line = view.substr(line) + + first_line = first_line.strip(self.dropped_chars) + + self.setting_name = True + view.set_name(first_line) + self.setting_name = False + + view.settings().set('auto_name', first_line) diff --git a/sublime-text/Default/set_unsaved_view_name.pyc b/sublime-text/Default/set_unsaved_view_name.pyc new file mode 100644 index 0000000..955776f Binary files /dev/null and b/sublime-text/Default/set_unsaved_view_name.pyc differ diff --git a/sublime-text/Default/side_bar.py b/sublime-text/Default/side_bar.py new file mode 100644 index 0000000..6c17cfb --- /dev/null +++ b/sublime-text/Default/side_bar.py @@ -0,0 +1,84 @@ +import sublime, sublime_plugin +import os +import functools +import send2trash + +class NewFileAtCommand(sublime_plugin.WindowCommand): + def run(self, dirs): + v = self.window.new_file() + + if len(dirs) == 1: + v.settings().set('default_dir', dirs[0]) + + def is_visible(self, dirs): + return len(dirs) == 1 + +class DeleteFileCommand(sublime_plugin.WindowCommand): + def run(self, files): + for f in files: + send2trash.send2trash(f) + + def is_visible(self, files): + return len(files) > 0 + +class NewFolderCommand(sublime_plugin.WindowCommand): + def run(self, dirs): + self.window.show_input_panel("Folder Name:", "", functools.partial(self.on_done, dirs[0]), None, None) + + def on_done(self, dir, name): + os.makedirs(os.path.join(dir, name)) + + def is_visible(self, dirs): + return len(dirs) == 1 + +class DeleteFolderCommand(sublime_plugin.WindowCommand): + def run(self, dirs): + if sublime.ok_cancel_dialog("Delete Folder?", "Delete"): + try: + for d in dirs: + send2trash.send2trash(d) + except: + sublime.status_message("Unable to delete folder") + + def is_visible(self, dirs): + return len(dirs) > 0 + +class RenamePathCommand(sublime_plugin.WindowCommand): + def run(self, paths): + branch, leaf = os.path.split(paths[0]) + v = self.window.show_input_panel("New Name:", leaf, functools.partial(self.on_done, paths[0], branch), None, None) + name, ext = os.path.splitext(leaf) + + v.sel().clear() + v.sel().add(sublime.Region(0, len(name))) + + def on_done(self, old, branch, leaf): + new = os.path.join(branch, leaf) + + try: + os.rename(old, new) + + v = self.window.find_open_file(old) + if v: + v.retarget(new) + except: + sublime.status_message("Unable to rename") + + def is_visible(self, paths): + return len(paths) == 1 + +class OpenContainingFolderCommand(sublime_plugin.WindowCommand): + def run(self, files): + branch,leaf = os.path.split(files[0]) + self.window.run_command("open_dir", {"dir": branch, "file": leaf}) + + def is_visible(self, files): + return len(files) > 0 + +class FindInFolderCommand(sublime_plugin.WindowCommand): + def run(self, dirs): + self.window.run_command("show_panel", {"panel": "find_in_files", + "where": ",".join(dirs)}) + + def is_visible(self, dirs): + return len(dirs) > 0 diff --git a/sublime-text/Default/side_bar.pyc b/sublime-text/Default/side_bar.pyc new file mode 100644 index 0000000..291d4c4 Binary files /dev/null and b/sublime-text/Default/side_bar.pyc differ diff --git a/sublime-text/Default/sort.py b/sublime-text/Default/sort.py new file mode 100644 index 0000000..812b0f5 --- /dev/null +++ b/sublime-text/Default/sort.py @@ -0,0 +1,184 @@ +import sublime, sublime_plugin +import random + +# Uglyness needed until SelectionRegions will happily compare themselves +def srcmp(a, b): + aa = a.begin(); + ba = b.begin(); + + if aa < ba: + return -1; + elif aa == ba: + return cmp(a.end(), b.end()) + else: + return 1; + +def srtcmp(ta, tb): + return srcmp(ta[0], tb[0]) + +def permute_selection(f, v, e): + regions = [s for s in v.sel() if not s.empty()] + regions.sort(srcmp) + txt = [v.substr(s) for s in regions] + txt = f(txt) + + # no sane way to handle this case + if len(txt) != len(regions): + return + + # Do the replacement in reverse order, so the character offsets don't get + # invalidated + combined = zip(regions, txt) + combined.sort(srtcmp, reverse=True) + + for x in combined: + [r, t] = x + v.replace(e, r, t) + +def case_insensitive_sort(txt): + txt.sort(lambda a, b: cmp(a.lower(), b.lower())) + return txt + +def case_sensitive_sort(txt): + txt.sort(lambda a, b: cmp(a, b)) + return txt + +def reverse_list(l): + l.reverse() + return l + +def shuffle_list(l): + random.shuffle(l) + return l + +def uniquealise_list(l): + table = {} + res = [] + for x in l: + if x not in table: + table[x] = x + res.append(x) + return res + +permute_funcs = { "reverse" : reverse_list, + "shuffle" : shuffle_list, + "unique" : uniquealise_list } + +def unique_selection(v): + regions = [s for s in v.sel() if not s.empty()] + regions.sort(srcmp) + + dupregions = [] + table = {} + for r in regions: + txt = v.substr(r) + if txt not in table: + table[txt] = r + else: + dupregions.append(r) + + dupregions.reverse() + for r in dupregions: + v.erase(e, r) + +def shrink_wrap_region( view, region ): + a, b = region.begin(), region.end() + + for a in xrange(a, b): + if not view.substr(a).isspace(): + break + + for b in xrange(b-1, a, -1): + if not view.substr(b).isspace(): + b += 1 + break + + return sublime.Region(a, b) + +def shrinkwrap_and_expand_non_empty_selections_to_entire_line(v): + sw = shrink_wrap_region + regions = [] + + for sel in v.sel(): + if not sel.empty(): + regions.append(v.line(sw(v, v.line(sel)))) + v.sel().subtract(sel) + + for r in regions: + v.sel().add(r) + +def permute_lines(f, v, e): + shrinkwrap_and_expand_non_empty_selections_to_entire_line(v) + + regions = [s for s in v.sel() if not s.empty()] + if not regions: + regions = [sublime.Region(0, v.size())] + + regions.sort(srcmp, reverse=True) + + for r in regions: + txt = v.substr(r) + lines = txt.splitlines() + lines = f(lines) + + v.replace(e, r, u"\n".join(lines)) + +def has_multiple_non_empty_selection_region(v): + return len([s for s in v.sel() if not s.empty()]) > 1 + +class SortLinesCommand(sublime_plugin.TextCommand): + def run(self, edit, case_sensitive=False, + reverse=False, + remove_duplicates=False): + view = self.view + + if case_sensitive: + permute_lines(case_sensitive_sort, view, edit) + else: + permute_lines(case_insensitive_sort, view, edit) + + if reverse: + permute_lines(reverse_list, view, edit) + + if remove_duplicates: + permute_lines(uniquealise_list, view, edit) + +class SortSelectionCommand(sublime_plugin.TextCommand): + def run(self, edit, case_sensitive=False, + reverse=False, + remove_duplicates=False): + + view = self.view + + permute_selection( + case_sensitive_sort if case_sensitive else case_insensitive_sort, + view, edit) + + if reverse: + permute_selection(reverse_list, view, edit) + + if remove_duplicates: + unique_selection(view, edit) + + def is_enabled(self, **kw): + return has_multiple_non_empty_selection_region(self.view) + +class PermuteLinesCommand(sublime_plugin.TextCommand): + def run(self, edit, operation='shuffle'): + permute_lines(permute_funcs[operation], self.view, edit) + +class PermuteSelectionCommand(sublime_plugin.TextCommand): + def run(self, edit, operation='shuffle'): + view = self.view + + if operation == "reverse": + permute_selection(reverse_list, view, edit) + + elif operation == "shuffle": + permute_selection(shuffle_list, view, edit) + + elif operation == "unique": + unique_selection(view, edit) + + def is_enabled(self, **kw): + return has_multiple_non_empty_selection_region(self.view) diff --git a/sublime-text/Default/sort.pyc b/sublime-text/Default/sort.pyc new file mode 100644 index 0000000..479c74c Binary files /dev/null and b/sublime-text/Default/sort.pyc differ diff --git a/sublime-text/Default/swap_line.py b/sublime-text/Default/swap_line.py new file mode 100644 index 0000000..97841ee --- /dev/null +++ b/sublime-text/Default/swap_line.py @@ -0,0 +1,110 @@ +import sublime, sublime_plugin + + +def expand_to_line(view, region): + """ + As view.full_line, but doesn't expand to the next line if a full line is + already selected + """ + if not (region.a == region.b) and view.substr(region.end() - 1) == '\n': + return sublime.Region(view.line(region).begin(), region.end()) + else: + return view.full_line(region) + + +def extract_line_blocks(view): + blocks = [expand_to_line(view, s) for s in view.sel()] + if len(blocks) == 0: + return blocks + + # merge any adjacent blocks + merged_blocks = [blocks[0]] + for block in blocks[1:]: + last_block = merged_blocks[-1] + if block.begin() <= last_block.end(): + merged_blocks[-1] = sublime.Region(last_block.begin(), block.end()) + else: + merged_blocks.append(block) + + return merged_blocks + +class SwapLineUpCommand(sublime_plugin.TextCommand): + + def run(self, edit): + blocks = extract_line_blocks(self.view) + + # No selection + if len(blocks) == 0: + return + + # Already at BOF + if blocks[0].begin() == 0: + return + + # Add a trailing newline if required, the logic is simpler if every line + # ends with a newline + add_trailing_newline = (self.view.substr(self.view.size() - 1) != '\n') and blocks[-1].b == self.view.size() + if add_trailing_newline: + # The insert can cause the selection to move. This isn't wanted, so + # reset the selection if it has moved to EOF + sel = [r for r in self.view.sel()] + self.view.insert(edit, self.view.size(), '\n') + if self.view.sel()[-1].end() == self.view.size(): + # Selection has moved, restore the previous selection + self.view.sel().clear() + for r in sel: + self.view.sel().add(r) + + # Fix up any block that should now include this newline + blocks[-1] = sublime.Region(blocks[-1].a, blocks[-1].b + 1) + + # Process in reverse order + blocks.reverse() + for b in blocks: + prev_line = self.view.full_line(b.begin() - 1) + self.view.insert(edit, b.end(), self.view.substr(prev_line)) + self.view.erase(edit, prev_line) + + if add_trailing_newline: + # Remove the added newline + self.view.erase(edit, sublime.Region(self.view.size() - 1, self.view.size())) + + # Ensure the selection is visible + self.view.show(self.view.sel(), False) + +class SwapLineDownCommand(sublime_plugin.TextCommand): + + def run(self, edit): + blocks = extract_line_blocks(self.view) + + # No selection + if len(blocks) == 0: + return + + # Already at EOF + if blocks[-1].end() == self.view.size(): + return + + # Add a trailing newline if required, the logic is simpler if every line + # ends with a newline + add_trailing_newline = (self.view.substr(self.view.size() - 1) != '\n') + if add_trailing_newline: + # No block can be at EOF (checked above), so no need to fix up the + # blocks + self.view.insert(edit, self.view.size(), '\n') + + # Process in reverse order + blocks.reverse() + for b in blocks: + next_line = self.view.full_line(b.end()) + contents = self.view.substr(next_line) + + self.view.erase(edit, next_line) + self.view.insert(edit, b.begin(), contents) + + if add_trailing_newline: + # Remove the added newline + self.view.erase(edit, sublime.Region(self.view.size() - 1, self.view.size())) + + # Ensure the selection is visible + self.view.show(self.view.sel(), False) diff --git a/sublime-text/Default/swap_line.pyc b/sublime-text/Default/swap_line.pyc new file mode 100644 index 0000000..1069a66 Binary files /dev/null and b/sublime-text/Default/swap_line.pyc differ diff --git a/sublime-text/Default/switch_file.py b/sublime-text/Default/switch_file.py new file mode 100644 index 0000000..60fa7e3 --- /dev/null +++ b/sublime-text/Default/switch_file.py @@ -0,0 +1,42 @@ +import sublime, sublime_plugin +import os.path +import platform + +def compare_file_names(x, y): + if platform.system() == 'Windows' or platform.system() == 'Darwin': + return x.lower() == y.lower() + else: + return x == y + +class SwitchFileCommand(sublime_plugin.WindowCommand): + def run(self, extensions=[]): + if not self.window.active_view(): + return + + fname = self.window.active_view().file_name() + if not fname: + return + + path = os.path.dirname(fname) + base, ext = os.path.splitext(fname) + + start = 0 + count = len(extensions) + + if ext != "": + ext = ext[1:] + + for i in xrange(0, len(extensions)): + if compare_file_names(extensions[i], ext): + start = i + 1 + count -= 1 + break + + for i in xrange(0, count): + idx = (start + i) % len(extensions) + + new_path = base + '.' + extensions[idx] + + if os.path.exists(new_path): + self.window.open_file(new_path) + break diff --git a/sublime-text/Default/switch_file.pyc b/sublime-text/Default/switch_file.pyc new file mode 100644 index 0000000..9648a6c Binary files /dev/null and b/sublime-text/Default/switch_file.pyc differ diff --git a/sublime-text/Default/transform.py b/sublime-text/Default/transform.py new file mode 100644 index 0000000..a194513 --- /dev/null +++ b/sublime-text/Default/transform.py @@ -0,0 +1,38 @@ +import string +import sublime +import sublime_plugin + +class Transformer(sublime_plugin.TextCommand): + def run(self, edit): + self.transform(self.transformer[0], self.view, edit) + + def transform(self, f, view, edit): + for s in view.sel(): + if s.empty(): + s = view.word(s) + + txt = f(view.substr(s)) + view.replace(edit, s, txt) + +class SwapCaseCommand(Transformer): + transformer = string.swapcase, + +class UpperCaseCommand(Transformer): + transformer = string.upper, + +class LowerCaseCommand(Transformer): + transformer = string.lower, + +class TitleCaseCommand(Transformer): + transformer = lambda s: string.capwords(s, " "), + +def rot13(ch): + o = ord(ch) + if o >= ord('a') and o <= ord('z'): + return unichr((o - ord('a') + 13) % 26 + ord('a')) + if o >= ord('A') and o <= ord('Z'): + return unichr((o - ord('A') + 13) % 26 + ord('A')) + return ch + +class Rot13Command(Transformer): + transformer = lambda s: "".join([rot13(ch) for ch in s]), diff --git a/sublime-text/Default/transform.pyc b/sublime-text/Default/transform.pyc new file mode 100644 index 0000000..cf94c1f Binary files /dev/null and b/sublime-text/Default/transform.pyc differ diff --git a/sublime-text/Default/transpose.py b/sublime-text/Default/transpose.py new file mode 100644 index 0000000..e3a8a4d --- /dev/null +++ b/sublime-text/Default/transpose.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +#coding: utf8 +#################################### IMPORTS ################################### + +# Std Libs +import re + +try: + from itertools import izip +except ImportError: # Python 3 coming Feb? + from itertools import zip as izip + +# Sublime Libs +import sublime +import sublime_plugin + +#################################### HELPERS ################################### + +def notify_nothing(): + sublime.status_message('Nothing to transpose') + +def full_region(region): + return ( sublime.Region(region.begin(), region.begin() + 1) + if region.empty() else region ) + +def perform_transposition(edit, view, trans, init_sel): + " assumes trans is already reverse sorted sequence of regions" + view.sel().subtract(init_sel) + + for i, (sel, substr) in enumerate(izip(trans, + reversed([view.substr(s) for s in trans])) ): + view.replace(edit, sel, substr) + if not i: view.sel().add(init_sel) + +def transpose_selections(edit, view): + for sel in view.sel(): + word_sel = view.word(sel) + word_extents = (wb, we) = (word_sel.begin(), word_sel.end()) + transpose_words = sel.end() in word_extents + + #" wora! arst" + if transpose_words: + if sel.end() == we: + next = view.find('\w', word_sel.end()) + if next is None: continue + trans = [ view.word(next), word_sel ] + else: + if wb == 0: continue + for pt in xrange(wb-1, -1, -1): + if re.match('\w', view.substr(pt)): break + trans = [ word_sel, view.word(pt) ] + else: + p1 = max(0, sel.begin() -1) + character_behind_region = sublime.Region(p1) + #" a!a" + trans = [ full_region(sel), full_region(character_behind_region)] + + perform_transposition(edit, view, trans, sel) + +def rotate_selections(edit, view): + # TODO: ??? + for sel in view.sel(): + if sel.empty(): view.sel().add(view.word(sel)) + + sels = list(reversed(view.sel())) + + strings = [ view.substr(s) for s in sels ] + strings.append(strings.pop(0)) + + for sel, substr in izip(sels, strings): + view.replace(edit, sel, substr) + +################################### COMMANDS ################################### + +class Transpose(sublime_plugin.TextCommand): + """ + - empty selection, cursor within a word: transpose characters + - empty selection, cursor at the end of a word: transpose words + - multiple selections, all empty: as above + + - multiple selections, at least one non-empty: rotate contents of selections + (i.e., each selection takes on the contents of the selection before it) + + - single non-empty selection: do nothing + + """ + + def run(self, edit, **kw): + if not self.enabled(): return notify_nothing() + + view = self.view + sels = view.sel() + nsels = len(sels) + + if nsels > 1 and view.has_non_empty_selection_region(): + rotate_selections(edit, view) + else: + transpose_selections(edit, view) + + def enabled(self): + sels = self.view.sel() + return not (len(sels) == 1 and not sels[0].empty()) \ No newline at end of file diff --git a/sublime-text/Default/transpose.pyc b/sublime-text/Default/transpose.pyc new file mode 100644 index 0000000..20b224a Binary files /dev/null and b/sublime-text/Default/transpose.pyc differ diff --git a/sublime-text/Default/trim_trailing_white_space.py b/sublime-text/Default/trim_trailing_white_space.py new file mode 100644 index 0000000..96aa0ec --- /dev/null +++ b/sublime-text/Default/trim_trailing_white_space.py @@ -0,0 +1,19 @@ +import sublime, sublime_plugin + +class TrimTrailingWhiteSpace(sublime_plugin.EventListener): + def on_pre_save(self, view): + if view.settings().get("trim_trailing_white_space_on_save") == True: + trailing_white_space = view.find_all("[\t ]+$") + trailing_white_space.reverse() + edit = view.begin_edit() + for r in trailing_white_space: + view.erase(edit, r) + view.end_edit(edit) + +class EnsureNewlineAtEof(sublime_plugin.EventListener): + def on_pre_save(self, view): + if view.settings().get("ensure_newline_at_eof_on_save") == True: + if view.size() > 0 and view.substr(view.size() - 1) != '\n': + edit = view.begin_edit() + view.insert(edit, view.size(), "\n") + view.end_edit(edit) diff --git a/sublime-text/Default/trim_trailing_white_space.pyc b/sublime-text/Default/trim_trailing_white_space.pyc new file mode 100644 index 0000000..dd8b608 Binary files /dev/null and b/sublime-text/Default/trim_trailing_white_space.pyc differ diff --git a/sublime-text/User/Default (Linux).sublime-keymap b/sublime-text/User/Default (Linux).sublime-keymap new file mode 100644 index 0000000..0d4f101 --- /dev/null +++ b/sublime-text/User/Default (Linux).sublime-keymap @@ -0,0 +1,2 @@ +[ +] diff --git a/sublime-text/User/Default (OSX).sublime-keymap b/sublime-text/User/Default (OSX).sublime-keymap new file mode 100644 index 0000000..0d4f101 --- /dev/null +++ b/sublime-text/User/Default (OSX).sublime-keymap @@ -0,0 +1,2 @@ +[ +] diff --git a/sublime-text/User/Default (Windows).sublime-keymap b/sublime-text/User/Default (Windows).sublime-keymap new file mode 100644 index 0000000..0d4f101 --- /dev/null +++ b/sublime-text/User/Default (Windows).sublime-keymap @@ -0,0 +1,2 @@ +[ +] diff --git a/sublime-text/User/Preferences.sublime-settings b/sublime-text/User/Preferences.sublime-settings new file mode 100644 index 0000000..4925c0f --- /dev/null +++ b/sublime-text/User/Preferences.sublime-settings @@ -0,0 +1,3 @@ +{ + "color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme" +}