├── .no-sublime-package ├── .python-version ├── Context.sublime-menu ├── Default.sublime-commands ├── Find Results.sublime-syntax ├── LICENSE ├── Preferences.sublime-settings-hints ├── README.md ├── Side Bar.sublime-menu ├── Syntax Test Results.sublime-menu ├── Tab Context.sublime-menu ├── block.py ├── encoding.py ├── line_endings.py ├── package_settings.py ├── tabs.py ├── toggle.py └── view_resource.py /.no-sublime-package: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deathaxe/sublime-commands/991c08f271a7dc36f8839d99b4e9526e6b56c9b8/.no-sublime-package -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.8 -------------------------------------------------------------------------------- /Context.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { "command": "open_context_url" }, 3 | { "command": "goto_definition", "caption": "Goto Definition" }, 4 | { "command": "goto_reference", "caption": "Goto Reference" }, 5 | { "caption": "-", "id": "diff" }, 6 | { "command": "toggle_inline_diff" }, 7 | { "command": "revert_hunk", "caption": "Revert Diff Hunk" }, 8 | { "command": "sublime_merge_line_history", "caption": "Line History…" }, 9 | { "caption": "-", "id": "clipboard" }, 10 | { "command": "cut" }, 11 | { "command": "copy" }, 12 | { "command": "paste" }, 13 | { "caption": "-", "id": "selection" }, 14 | { "command": "select_all" }, 15 | { "caption": "-", "id": "end" } 16 | ] 17 | -------------------------------------------------------------------------------- /Default.sublime-commands: -------------------------------------------------------------------------------- 1 | [ 2 | // File Menu 3 | { "caption": "File: New File", "command": "new_file" }, 4 | 5 | // File Menu -> Open 6 | { "caption": "File: Open File", "command": "prompt_open_file" }, 7 | { "caption": "File: Open Folder", "command": "prompt_open_folder" }, 8 | { "caption": "File: Clone View", "command": "clone_file" }, 9 | { "caption": "File: Split View", "command": "clone_file", "args": {"add_to_selection": true, "retain_viewport_position": true} }, 10 | { "caption": "File: Reopen Closed File", "command": "reopen_last_file" }, 11 | { "caption": "File: Reopen File with Encoding", "command": "reopen_encoding"}, 12 | { "caption": "File: Reopen File as Image", "command": "force_reopen_as", "args": {"type": "image"}, }, 13 | { "caption": "File: Reopen File as Text", "command": "force_reopen_as", "args": {"type": "text"}, }, 14 | 15 | // File Menu -> Save 16 | { "caption": "File: Save", "command": "save", "args": { "async": true } }, 17 | { "caption": "File: Save As…", "command": "prompt_save_as" }, 18 | { "caption": "File: Save All", "command": "save_all" }, 19 | { "caption": "File: Save with Encoding", "command": "save_encoding"}, 20 | { "caption": "File: Set Encoding", "command": "set_encoding"}, 21 | { "caption": "File: Set Line Endings", "command": "set_line_endings" }, 22 | { "caption": "File: Print…", "command": "html_print" }, 23 | 24 | // File Menu -> Close/Revert 25 | { "caption": "File: Rename File", "command": "rename_file" }, 26 | { "caption": "File: Revert", "command": "revert" }, 27 | { "caption": "File: Close", "command": "close" }, 28 | { "caption": "File: Close All", "command": "close_all" }, 29 | 30 | // File Menu -> Window 31 | { "caption": "Window: New Window", "command": "new_window" }, 32 | { "caption": "Window: Close Window", "command": "close_window" }, 33 | { "caption": "Exit Sublime Text", "command": "exit" }, 34 | 35 | // Edit 36 | { "caption": "Edit: Undo", "command": "undo" }, 37 | { "caption": "Edit: Redo or Repeat", "command": "redo_or_repeat" }, 38 | { "caption": "Edit: Copy", "command": "copy" }, 39 | { "caption": "Edit: Copy as HTML", "command": "copy_as_html", "args": {"enclosing_tags": true, "font_size": false} }, 40 | { "caption": "Edit: Cut", "command": "cut" }, 41 | { "caption": "Edit: Paste", "command": "paste" }, 42 | { "caption": "Edit: Paste and Indent", "command": "paste_and_indent" }, 43 | { "caption": "Edit: Paste from History", "command": "paste_from_history" }, 44 | { "caption": "Edit: Indent", "command": "indent" }, 45 | { "caption": "Edit: Unindent", "command": "unindent" }, 46 | { "caption": "Edit: Delete Next Sub Word", "command": "delete_word", "args": {"forward": true, "sub_words": true} }, 47 | { "caption": "Edit: Delete Previous Sub Word", "command": "delete_word", "args": {"forward": false, "sub_words": true} }, 48 | { "caption": "Edit: Delete Next Word", "command": "delete_word", "args": {"forward": true, "sub_words": false} }, 49 | { "caption": "Edit: Delete Previous Word", "command": "delete_word", "args": {"forward": false, "sub_words": false} }, 50 | { "caption": "Edit: Swap Line Up", "command": "swap_line_up" }, 51 | { "caption": "Edit: Swap Line Down", "command": "swap_line_down" }, 52 | { "caption": "Edit: Duplicate Line", "command": "duplicate_line" }, 53 | { "caption": "Edit: Join Lines", "command": "join_lines" }, 54 | { "caption": "Edit: Delete Line", "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} }, 55 | { "caption": "Edit: Delete to End", "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard EOL.sublime-macro"} }, 56 | { "caption": "Edit: Delete to Beginning", "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"} }, 57 | { "caption": "Edit: Trim Trailing White Space", "command": "trim_trailing_white_space" }, 58 | 59 | { "caption": "Edit: Wrap Lines", "command": "wrap_lines" }, 60 | { "caption": "Edit: Wrap Lines at 70 characters", "command": "wrap_lines", "args": {"width": 70} }, 61 | { "caption": "Edit: Wrap Lines at 72 characters", "command": "wrap_lines", "args": {"width": 72} }, 62 | { "caption": "Edit: Wrap Lines at 78 characters", "command": "wrap_lines", "args": {"width": 78} }, 63 | { "caption": "Edit: Wrap Lines at 80 characters", "command": "wrap_lines", "args": {"width": 80} }, 64 | { "caption": "Edit: Wrap Lines at 100 characters", "command": "wrap_lines", "args": {"width": 100} }, 65 | { "caption": "Edit: Wrap Lines at 120 characters", "command": "wrap_lines", "args": {"width": 120} }, 66 | 67 | { "caption": "Convert Case: Upper Case", "command": "upper_case" }, 68 | { "caption": "Convert Case: Lower Case", "command": "lower_case" }, 69 | { "caption": "Convert Case: Title Case", "command": "title_case" }, 70 | { "caption": "Convert Case: Swap Case", "command": "swap_case" }, 71 | { "caption": "Convert Case: lowerCamelCase", "command": "convert_ident_case", "args": {"case": "title", "first_case": "lower"} }, 72 | { "caption": "Convert Case: UpperCamelCase", "command": "convert_ident_case", "args": {"case": "title"} }, 73 | { "caption": "Convert Case: snake_case", "command": "convert_ident_case", "args": {"separator": "_", "case": "lower"} }, 74 | { "caption": "Convert Case: kebab-case", "command": "convert_ident_case", "args": {"separator": "-", "case": "lower"} }, 75 | 76 | { "caption": "Toggle Comment", "command": "toggle_comment", "args": {"block": false} }, 77 | { "caption": "Toggle Block Comment", "command": "toggle_comment", "args": {"block": true} }, 78 | 79 | // Bookmarks 80 | { "caption": "Bookmarks: Toggle", "command": "toggle_bookmark" }, 81 | { "caption": "Bookmarks: Select Next", "command": "next_bookmark" }, 82 | { "caption": "Bookmarks: Select Previous", "command": "prev_bookmark" }, 83 | { "caption": "Bookmarks: Clear All", "command": "clear_bookmarks" }, 84 | { "caption": "Bookmarks: Select All", "command": "select_all_bookmarks" }, 85 | { "caption": "Bookmarks: Select 0", "command": "select_bookmark", "args": {"index": 0} }, 86 | { "caption": "Bookmarks: Select 1", "command": "select_bookmark", "args": {"index": 1} }, 87 | { "caption": "Bookmarks: Select 2", "command": "select_bookmark", "args": {"index": 2} }, 88 | { "caption": "Bookmarks: Select 3", "command": "select_bookmark", "args": {"index": 3} }, 89 | { "caption": "Bookmarks: Select 4", "command": "select_bookmark", "args": {"index": 4} }, 90 | { "caption": "Bookmarks: Select 5", "command": "select_bookmark", "args": {"index": 5} }, 91 | { "caption": "Bookmarks: Select 6", "command": "select_bookmark", "args": {"index": 6} }, 92 | { "caption": "Bookmarks: Select 7", "command": "select_bookmark", "args": {"index": 7} }, 93 | { "caption": "Bookmarks: Select 8", "command": "select_bookmark", "args": {"index": 8} }, 94 | { "caption": "Bookmarks: Select 9", "command": "select_bookmark", "args": {"index": 9} }, 95 | { "caption": "Bookmarks: Select 10", "command": "select_bookmark", "args": {"index": 10} }, 96 | { "caption": "Bookmarks: Select 11", "command": "select_bookmark", "args": {"index": 11} }, 97 | { "caption": "Bookmarks: Select 12", "command": "select_bookmark", "args": {"index": 12} }, 98 | { "caption": "Bookmarks: Select 13", "command": "select_bookmark", "args": {"index": 13} }, 99 | { "caption": "Bookmarks: Select 14", "command": "select_bookmark", "args": {"index": 14} }, 100 | { "caption": "Bookmarks: Select 15", "command": "select_bookmark", "args": {"index": 15} }, 101 | 102 | // Marks 103 | { "caption": "Mark: Set Mark", "command": "set_mark" }, 104 | { "caption": "Mark: Select to Mark", "command": "select_to_mark" }, 105 | { "caption": "Mark: Delete to Mark", "command": "delete_to_mark" }, 106 | { "caption": "Mark: Swap with Mark", "command": "swap_with_mark" }, 107 | { "caption": "Mark: Clear Mark", "command": "clear_bookmarks", "args": {"name": "mark"} }, 108 | { "caption": "Mark: Yank", "command": "yank" }, 109 | 110 | // Selection 111 | { "caption": "Selection: Split into Lines", "command": "split_selection_into_lines" }, 112 | { "caption": "Selection: Add Previous Line", "command": "select_lines", "args": {"forward": false} }, 113 | { "caption": "Selection: Add Next Line", "command": "select_lines", "args": {"forward": true} }, 114 | { "caption": "Selection: Single Selection", "command": "single_selection" }, 115 | { "caption": "Selection: Invert Selection", "command": "invert_selection" }, 116 | { "caption": "Selection: Select All", "command": "select_all" }, 117 | { "caption": "Selection: Expand Smart", "command": "expand_selection", "args": {"to": "smart"} }, 118 | { "caption": "Selection: Expand to Line Upward", "command": "expand_selection", "args": {"to": "line_prev"} }, 119 | { "caption": "Selection: Expand to Line", "command": "expand_selection", "args": {"to": "line"} }, 120 | { "caption": "Selection: Expand to Word", "command": "expand_selection", "args": {"to": "word"} }, 121 | { "caption": "Selection: Expand to Block", "command": "expand_selection_to_paragraph" }, 122 | { "caption": "Selection: Expand to Paragraph", "command": "expand_selection_to_paragraph", "args": {"markup_aware": true} }, 123 | { "caption": "Selection: Expand to Scope", "command": "expand_selection", "args": {"to": "scope"} }, 124 | { "caption": "Selection: Expand to Brackets", "command": "expand_selection", "args": {"to": "brackets"} }, 125 | { "caption": "Selection: Expand to Indentation", "command": "expand_selection", "args": {"to": "indentation"} }, 126 | { "caption": "Selection: Expand to Tag", "command": "expand_selection", "args": {"to": "tag"} }, 127 | { "caption": "Selection: Undo Selection", "command": "soft_undo" }, 128 | { "caption": "Selection: Redo Selection", "command": "soft_redo" }, 129 | 130 | // History 131 | { "caption": "History: Revert Hunk", "command": "revert_hunk" }, 132 | { "caption": "History: Revert Modification", "command": "revert_modification" }, 133 | { "caption": "History: Next Modification", "command": "next_modification" }, 134 | { "caption": "History: Previous Modification", "command": "prev_modification" }, 135 | { "caption": "History: Toggle Inline Diff", "command": "toggle_inline_diff" }, 136 | 137 | // Code Folding 138 | { "caption": "Code Folding: Fold", "command": "fold" }, 139 | { "caption": "Code Folding: Fold All", "command": "fold_all" }, 140 | { "caption": "Code Folding: Unfold", "command": "unfold" }, 141 | { "caption": "Code Folding: Unfold All", "command": "unfold_all" }, 142 | { "caption": "Code Folding: Fold Tag Attributes", "command": "fold_tag_attributes" }, 143 | { "caption": "Code Folding: by Level 1", "command": "fold_by_level", "args": {"level": 1} }, 144 | { "caption": "Code Folding: by Level 2", "command": "fold_by_level", "args": {"level": 2} }, 145 | { "caption": "Code Folding: by Level 3", "command": "fold_by_level", "args": {"level": 3} }, 146 | { "caption": "Code Folding: by Level 4", "command": "fold_by_level", "args": {"level": 4} }, 147 | { "caption": "Code Folding: by Level 5", "command": "fold_by_level", "args": {"level": 5} }, 148 | { "caption": "Code Folding: by Level 6", "command": "fold_by_level", "args": {"level": 6} }, 149 | { "caption": "Code Folding: by Level 7", "command": "fold_by_level", "args": {"level": 7} }, 150 | { "caption": "Code Folding: by Level 8", "command": "fold_by_level", "args": {"level": 8} }, 151 | { "caption": "Code Folding: by Level 9", "command": "fold_by_level", "args": {"level": 9} }, 152 | 153 | // Indentation 154 | { "caption": "Indentation: Guess Settings From Buffer", "command": "detect_indentation" }, 155 | { "caption": "Indentation: Tab Width: 1", "command": "set_setting", "args": {"setting": "tab_size", "value": 1} }, 156 | { "caption": "Indentation: Tab Width: 2", "command": "set_setting", "args": {"setting": "tab_size", "value": 2} }, 157 | { "caption": "Indentation: Tab Width: 3", "command": "set_setting", "args": {"setting": "tab_size", "value": 3} }, 158 | { "caption": "Indentation: Tab Width: 4", "command": "set_setting", "args": {"setting": "tab_size", "value": 4} }, 159 | { "caption": "Indentation: Tab Width: 5", "command": "set_setting", "args": {"setting": "tab_size", "value": 5} }, 160 | { "caption": "Indentation: Tab Width: 6", "command": "set_setting", "args": {"setting": "tab_size", "value": 6} }, 161 | { "caption": "Indentation: Tab Width: 7", "command": "set_setting", "args": {"setting": "tab_size", "value": 7} }, 162 | { "caption": "Indentation: Tab Width: 8", "command": "set_setting", "args": {"setting": "tab_size", "value": 8} }, 163 | { "caption": "Indentation: Use Spaces", "command": "toggle_setting", "args": {"setting": "translate_tabs_to_spaces"} }, 164 | { "caption": "Indentation: Convert to Tabs", "command": "unexpand_tabs", "args": {"set_translate_tabs": true} }, 165 | { "caption": "Indentation: Convert to Spaces", "command": "expand_tabs", "args": {"set_translate_tabs": true} }, 166 | { "caption": "Indentation: Reindent Lines", "command": "reindent", "args": {"single_line": false} }, 167 | 168 | // View 169 | { "caption": "View: Toggle Gutter", "command": "toggle_setting", "args": {"setting": "gutter"} }, 170 | { "caption": "View: Toggle Line Numbers", "command": "toggle_setting", "args": {"setting": "line_numbers"} }, 171 | { "caption": "View: Reveal Current File in Side Bar", "command": "reveal_in_side_bar" }, 172 | { "caption": "View: Increase Font Size", "command": "increase_font_size" }, 173 | { "caption": "View: Decrease Font Size", "command": "decrease_font_size" }, 174 | { "caption": "View: Reset Font Size", "command": "reset_font_size" }, 175 | 176 | // View Ruler 177 | { "caption": "View: Hide Ruler", "command": "set_setting", "args": {"setting": "rulers", "value": []} }, 178 | { "caption": "View: Ruler at Column 70", "command": "set_setting", "args": {"setting": "rulers", "value": [70]} }, 179 | { "caption": "View: Ruler at Column 72", "command": "set_setting", "args": {"setting": "rulers", "value": [72]} }, 180 | { "caption": "View: Ruler at Column 78", "command": "set_setting", "args": {"setting": "rulers", "value": [78]} }, 181 | { "caption": "View: Ruler at Column 80", "command": "set_setting", "args": {"setting": "rulers", "value": [80]} }, 182 | { "caption": "View: Ruler at Column 100", "command": "set_setting", "args": {"setting": "rulers", "value": [100]} }, 183 | { "caption": "View: Ruler at Column 120", "command": "set_setting", "args": {"setting": "rulers", "value": [120]} }, 184 | 185 | // View Word Wrap 186 | { "caption": "View: Toggle Word Wrap", "command": "toggle_setting", "args": {"setting": "word_wrap"} }, 187 | { "caption": "View: Word Wrap at Automatic Column", "command": "set_setting", "args": {"setting": "wrap_width", "value": 0} }, 188 | { "caption": "View: Word Wrap at Column 70", "command": "set_setting", "args": {"setting": "wrap_width", "value": 70} }, 189 | { "caption": "View: Word Wrap at Column 72", "command": "set_setting", "args": {"setting": "wrap_width", "value": 72} }, 190 | { "caption": "View: Word Wrap at Column 78", "command": "set_setting", "args": {"setting": "wrap_width", "value": 78} }, 191 | { "caption": "View: Word Wrap at Column 80", "command": "set_setting", "args": {"setting": "wrap_width", "value": 80} }, 192 | { "caption": "View: Word Wrap at Column 100", "command": "set_setting", "args": {"setting": "wrap_width", "value": 100} }, 193 | { "caption": "View: Word Wrap at Column 120", "command": "set_setting", "args": {"setting": "wrap_width", "value": 120} }, 194 | 195 | // View Layouts 196 | { 197 | "caption": "View Layout: Single", 198 | "command": "set_layout", 199 | "args": 200 | { 201 | "cols": [0.0, 1.0], 202 | "rows": [0.0, 1.0], 203 | "cells": [[0, 0, 1, 1]] 204 | } 205 | }, 206 | { 207 | "caption": "View Layout: 2 Columns", 208 | "command": "set_layout", 209 | "args": 210 | { 211 | "cols": [0.0, 0.5, 1.0], 212 | "rows": [0.0, 1.0], 213 | "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] 214 | } 215 | }, 216 | { 217 | "caption": "View Layout: 3 Columns", 218 | "command": "set_layout", 219 | "args": 220 | { 221 | "cols": [0.0, 0.33, 0.66, 1.0], 222 | "rows": [0.0, 1.0], 223 | "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] 224 | } 225 | }, 226 | { 227 | "caption": "View Layout: 4 Columns", 228 | "command": "set_layout", 229 | "args": 230 | { 231 | "cols": [0.0, 0.25, 0.5, 0.75, 1.0], 232 | "rows": [0.0, 1.0], 233 | "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] 234 | } 235 | }, 236 | { 237 | "caption": "View Layout: 2 Rows", 238 | "command": "set_layout", 239 | "args": 240 | { 241 | "cols": [0.0, 1.0], 242 | "rows": [0.0, 0.5, 1.0], 243 | "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] 244 | } 245 | }, 246 | { 247 | "caption": "View Layout: 3 Rows", 248 | "command": "set_layout", 249 | "args": 250 | { 251 | "cols": [0.0, 1.0], 252 | "rows": [0.0, 0.33, 0.66, 1.0], 253 | "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] 254 | } 255 | }, 256 | { 257 | "caption": "View Layout: Grid", 258 | "command": "set_layout", 259 | "args": 260 | { 261 | "cols": [0.0, 0.5, 1.0], 262 | "rows": [0.0, 0.5, 1.0], 263 | "cells": 264 | [ 265 | [0, 0, 1, 1], [1, 0, 2, 1], 266 | [0, 1, 1, 2], [1, 1, 2, 2] 267 | ] 268 | } 269 | }, 270 | { 271 | "caption": "View Layout: 3 Cols (with 2 rows in 3rd col)", 272 | "command": "set_layout", 273 | "args": 274 | { 275 | "cols": [0.0, 0.4, 0.8, 1.0], 276 | "rows": [0.0, 0.5, 1.0], 277 | "cells": 278 | [ 279 | [0, 0, 1, 2], [1, 0, 2, 2], 280 | [2, 0, 3, 1], [2, 1, 3, 2] 281 | ] 282 | } 283 | }, 284 | { 285 | "caption": "View Layout: 4 Cols (with 2 rows in 3rd col)", 286 | "command": "set_layout", 287 | "args": 288 | { 289 | "cols": [0.0, 0.25, 0.5, 0.75, 1.0], 290 | "rows": [0.0, 0.6, 1.0], 291 | "cells": 292 | [ 293 | [0, 0, 1, 2], [1, 0, 2, 2], [2, 0, 3, 2], 294 | [3, 0, 4, 1], [3, 1, 4, 2] 295 | ] 296 | } 297 | }, 298 | 299 | // View Groups 300 | { "caption": "Group: Move to New Group", "command": "new_pane"}, 301 | { "caption": "Group: New Group", "command": "new_pane", "args": {"move": false}}, 302 | { "caption": "Group: Close Group", "command": "close_pane"}, 303 | 304 | // View Focus Group 305 | { "caption": "Group: Focus Next Group", "command": "focus_neighboring_group"}, 306 | { "caption": "Group: Focus Previous Group", "command": "focus_neighboring_group", "args": {"forward": false}}, 307 | { "caption": "Group: Focus Group 1", "command": "focus_group", "args": {"group": 0}}, 308 | { "caption": "Group: Focus Group 2", "command": "focus_group", "args": {"group": 1}}, 309 | { "caption": "Group: Focus Group 3", "command": "focus_group", "args": {"group": 2}}, 310 | { "caption": "Group: Focus Group 4", "command": "focus_group", "args": {"group": 3}}, 311 | { "caption": "Group: Focus Group 5", "command": "focus_group", "args": {"group": 4}}, 312 | { "caption": "Group: Focus Group 6", "command": "focus_group", "args": {"group": 5}}, 313 | { "caption": "Group: Focus Group 7", "command": "focus_group", "args": {"group": 6}}, 314 | { "caption": "Group: Focus Group 8", "command": "focus_group", "args": {"group": 7}}, 315 | 316 | // View Move File To Group 317 | { "caption": "Move View: To Next Group", "command": "move_to_neighboring_group"}, 318 | { "caption": "Move View: To Previous Group", "command": "move_to_neighboring_group", "args": {"forward": false}}, 319 | { "caption": "Move View: To Group 1", "command": "move_to_group", "args": {"group": 0}}, 320 | { "caption": "Move View: To Group 2", "command": "move_to_group", "args": {"group": 1}}, 321 | { "caption": "Move View: To Group 3", "command": "move_to_group", "args": {"group": 2}}, 322 | { "caption": "Move View: To Group 4", "command": "move_to_group", "args": {"group": 3}}, 323 | { "caption": "Move View: To Group 5", "command": "move_to_group", "args": {"group": 4}}, 324 | { "caption": "Move View: To Group 6", "command": "move_to_group", "args": {"group": 5}}, 325 | { "caption": "Move View: To Group 7", "command": "move_to_group", "args": {"group": 6}}, 326 | { "caption": "Move View: To Group 8", "command": "move_to_group", "args": {"group": 7}}, 327 | 328 | // View Spell Check 329 | { "caption": "Spelling: Spell Check", "command": "toggle_setting", "args": {"setting": "spell_check"} }, 330 | { "caption": "Spelling: Next Misspelling", "command": "next_misspelling" }, 331 | { "caption": "Spelling: Previous Misspelling", "command": "prev_misspelling" }, 332 | 333 | // Find 334 | { "caption": "Find…", "command": "show_panel", "args": {"panel": "find", "reverse": false} }, 335 | { "caption": "Find Next", "command": "find_next" }, 336 | { "caption": "Find Previous","command": "find_prev" }, 337 | { "caption": "Incremental Find", "command": "show_panel", "args": {"panel": "incremental_find", "reverse": false} }, 338 | { "caption": "Replace…", "command": "show_panel", "args": {"panel": "replace", "reverse": false} }, 339 | { "caption": "Replace Next", "command": "replace_next" }, 340 | { "caption": "Quick Find", "command": "find_under" }, 341 | { "caption": "Quick Find All", "command": "find_all_under" }, 342 | { "caption": "Quick Add Next", "command": "find_under_expand" }, 343 | { "caption": "Quick Skip Next","command": "find_under_expand_skip", "platform": "!OSX" }, 344 | { "caption": "Use Selection for Find", "command": "slurp_find_string" }, 345 | { "caption": "Use Selection for Replace", "command": "slurp_replace_string" }, 346 | { "caption": "Find in Files…", "command": "show_panel", "args": {"panel": "find_in_files"} }, 347 | 348 | // Goto 349 | { "caption": "Goto: Anything…", "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, 350 | { "caption": "Goto: Symbol…", "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, 351 | { "caption": "Goto: Word…", "command": "show_overlay", "args": {"overlay": "goto", "text": "#"} }, 352 | { "caption": "Goto: Symbol in Project…", "command": "goto_symbol_in_project" }, 353 | { "caption": "Goto: Definition…", "command": "goto_definition" }, 354 | { "caption": "Goto: Reference…", "command": "goto_reference" }, 355 | { "caption": "Goto: Line…", "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, 356 | { "caption": "Goto: Jump Back", "command": "jump_back" }, 357 | { "caption": "Goto: Jump Forward", "command": "jump_forward" }, 358 | { "caption": "Goto: Selection", "command": "show_at_center" }, 359 | { "caption": "Goto: Matching Bracket", "command": "move_to", "args": {"to": "brackets"} }, 360 | { "caption": "Switch: Next File", "command": "next_view" }, 361 | { "caption": "Switch: Previous File", "command": "prev_view" }, 362 | { "caption": "Switch: Next File in Stack", "command": "next_view_in_stack" }, 363 | { "caption": "Switch: Previous File in Stack", "command": "prev_view_in_stack" }, 364 | { "caption": "Switch Header/Implementation", "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} }, 365 | 366 | // Project 367 | { "caption": "Project: Open", "command": "prompt_open_project_or_workspace" }, 368 | { "caption": "Project: Switch", "command": "prompt_switch_project_or_workspace" }, 369 | { "caption": "Project: Quick Switch Project…", "command": "prompt_select_workspace" }, 370 | { "caption": "Project: Clear Recent Projects", "command": "clear_recent_projects_and_workspaces" }, 371 | { "caption": "Project: Clear Missing Recent Projects", "command": "clear_missing_recent_projects_and_workspaces" }, 372 | { "caption": "Project: Save As…", "command": "save_project_and_workspace_as" }, 373 | { "caption": "Project: Edit Project", "command": "open_file", "args": {"file": "${project}"} }, 374 | { "caption": "Project: Close", "command": "close_workspace" }, 375 | { "caption": "Project: New Workspace for Project", "command": "new_window_for_project" }, 376 | { "caption": "Project: Save Workspace As…", "command": "save_workspace_as" }, 377 | { "caption": "Project: Add Folder", "command": "prompt_add_folder" }, 378 | { "caption": "Project: Remove all Folders from Project", "command": "close_folder_list" }, 379 | { "caption": "Project: Refresh Folders", "command": "refresh_folder_list" }, 380 | 381 | // Preferences 382 | { "caption": "Install Package Control", "command": "install_package_control" }, 383 | { "caption": "Preferences: Browse Packages", "command": "open_dir", "args": {"dir": "$packages"} }, 384 | { 385 | "caption": "Preferences: Settings", 386 | "command": "edit_settings", "args": 387 | { 388 | "base_file": "${packages}/Default/Preferences.sublime-settings", 389 | "default": "// Settings in here override those in \"Default/Preferences.sublime-settings\",\n// and are overridden in turn by syntax-specific settings.\n{\n\t$0\n}\n" 390 | } 391 | }, 392 | { "caption": "Preferences: Settings – Syntax Specific", "command": "edit_syntax_settings" }, 393 | { "caption": "Preferences: Settings – Distraction Free", "command": "edit_settings", "args": { 394 | "base_file": "${packages}/Default/Distraction Free.sublime-settings", 395 | "default": "// Settings in here override those in \"Default/Distraction Free.sublime-settings\",\n// and are overridden in turn by syntax-specific settings.\n{\n\t$0\n}\n" 396 | } 397 | }, 398 | { "caption": "Preferences: Key Bindings", "command": "edit_settings", "args": { 399 | "base_file": "${packages}/Default/Default ($platform).sublime-keymap", 400 | "default": "[\n\t$0\n]\n" 401 | } 402 | }, 403 | { "caption": "Preferences: Mouse Bindings", "command": "edit_settings", "args": { 404 | "base_file": "${packages}/Default/Default ($platform).sublime-mousemap", 405 | "default": "[\n\t$0\n]\n" 406 | } 407 | }, 408 | 409 | // UI Preferences 410 | { "caption": "UI: Choose Font", "command": "choose_font" }, 411 | { "caption": "UI: Select Color Scheme", "command": "select_color_scheme" }, 412 | { "caption": "UI: Select Theme", "command": "select_theme" }, 413 | { "caption": "UI: Customize Color Scheme", "command": "customize_color_scheme" }, 414 | { "caption": "UI: Customize Theme", "command": "customize_theme" }, 415 | { "caption": "UI: Show Console", "command": "show_panel", "args": {"panel": "console"} }, 416 | { "caption": "UI: Toggle Full Screen", "command": "toggle_full_screen" }, 417 | { "caption": "UI: Toggle Distraction Free Mode", "command": "toggle_distraction_free" }, 418 | { "caption": "UI: Toggle Side Bar", "command": "toggle_side_bar" }, 419 | { "caption": "UI: Toggle Open Files in Side Bar", "command": "toggle_show_open_files" }, 420 | { "caption": "UI: Toggle Minimap", "command": "toggle_minimap" }, 421 | { "caption": "UI: Toggle Tabs", "command": "toggle_tabs" }, 422 | { "caption": "UI: Toggle Status Bar", "command": "toggle_status_bar" }, 423 | { "caption": "UI: Toggle Menu", "command": "toggle_menu" }, 424 | 425 | { "caption": "HTML: Wrap Selection With Tag", "command": "insert_snippet", "args": { "name": "Packages/XML/Snippets/xml-long-tag.sublime-snippet" } }, 426 | { "caption": "HTML: Encode Special Characters", "command": "encode_html_entities" }, 427 | 428 | { "caption": "Rot13 Selection", "command": "rot13" }, 429 | 430 | // Permute Lines 431 | { "caption": "Permute Lines: Sort ", "command": "sort_lines", "args": {"case_sensitive": false} }, 432 | { "caption": "Permute Lines: Sort (Case Sensitive)", "command": "sort_lines", "args": {"case_sensitive": true} }, 433 | { "caption": "Permute Lines: Reverse", "command": "permute_lines", "args": {"operation": "reverse"} }, 434 | { "caption": "Permute Lines: Unique", "command": "permute_lines", "args": {"operation": "unique"} }, 435 | { "caption": "Permute Lines: Shuffle", "command": "permute_lines", "args": {"operation": "shuffle"} }, 436 | 437 | // Permute Selections 438 | { "caption": "Permute Selections: Sort", "command": "sort_selection", "args": {"case_sensitive": false} }, 439 | { "caption": "Permute Selections: Sort (Case Sensitive)", "command": "sort_selection", "args": {"case_sensitive": true} }, 440 | { "caption": "Permute Selections: Reverse", "command": "permute_selection", "args": {"operation": "reverse"} }, 441 | { "caption": "Permute Selections: Unique", "command": "permute_selection", "args": {"operation": "unique"} }, 442 | { "caption": "Permute Selections: Shuffle", "command": "permute_selection", "args": {"operation": "shuffle"} }, 443 | 444 | // Tools 445 | { "caption": "Build: Run Build", "command": "build", "args": {"variant": "Run"} }, 446 | { "caption": "Build: Show Results", "command": "show_panel", "args": {"panel": "output.exec"} }, 447 | { "caption": "Macro: Record Macro", "command": "toggle_record_macro" }, 448 | { "caption": "Macro: Playback Macro", "command": "run_macro" }, 449 | { "caption": "Macro: Save Macro…", "command": "save_macro" }, 450 | { "caption": "New Plugin…", "command": "new_plugin" }, 451 | { "caption": "New Snippet…", "command": "new_snippet" }, 452 | { "caption": "New Syntax…", "command": "new_syntax" }, 453 | 454 | // Tools Developement 455 | { "caption": "Plugin Development: Profile Events", "command": "profile_plugins" }, 456 | { "caption": "Plugin Development: Convert Syntax to .sublime-syntax", "command": "convert_syntax" }, 457 | { "caption": "Plugin Development: Convert Color Scheme to .sublime-color-scheme", "command": "convert_color_scheme" }, 458 | { "caption": "Plugin Development: Toggle Log Built Sytems", "command": "toggle_log_built_systems" }, 459 | { "caption": "Plugin Development: Toggle Log Commands", "command": "toggle_log_commands" }, 460 | { "caption": "Plugin Development: Toggle Log Control Tree", "command": "toggle_log_control_tree" }, 461 | { "caption": "Plugin Development: Toggle Log Input", "command": "toggle_log_input" }, 462 | { "caption": "Plugin Development: Toggle Log Indexing", "command": "toggle_log_indexing" }, 463 | { "caption": "Plugin Development: Toggle Log Result Regex", "command": "toggle_log_result_regex" }, 464 | { "caption": "Plugin Development: Toggle Draw Debug", "command": "toggle_draw_debug" }, 465 | 466 | // Help 467 | { "caption": "Help: Documentation", "command": "open_url", "args": {"url": "https://www.sublimetext.com/docs/"} }, 468 | { "caption": "Help: Indexing Status", "command": "show_progress_window" }, 469 | { "caption": "Help: Check for Updates", "command": "update_check", "platform": "!Linux" }, 470 | { "caption": "Help: Changelog", "command": "show_changelog" }, 471 | { "caption": "Help: About", "command": "show_about_window" }, 472 | 473 | // Command Pallet only 474 | { "caption": "Arithmetic", "command": "arithmetic" }, 475 | { "caption": "Preferences", "command": "edit_package_settings" }, 476 | { "caption": "View Package File", "command": "view_resource" }, 477 | 478 | // Sublime Merge Integration 479 | { "caption": "Sublime Merge: Open Repository", "command": "sublime_merge_open_repo" }, 480 | { "caption": "Sublime Merge: File History", "command": "sublime_merge_file_history" }, 481 | { "caption": "Sublime Merge: Folder History", "command": "sublime_merge_folder_history" }, 482 | { "caption": "Sublime Merge: Blame File", "command": "sublime_merge_blame_file" }, 483 | 484 | // Extra 485 | { "caption": "Show White Spaces: In Selection", "command": "set_setting", "args": { "setting": "draw_white_space", "value": "selection" } }, 486 | { "caption": "Show White Spaces: All", "command": "set_setting", "args": { "setting": "draw_white_space", "value": "all" } }, 487 | ] 488 | -------------------------------------------------------------------------------- /Find Results.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | # http://www.sublimetext.com/docs/syntax.html 4 | name: Find Results 5 | hidden: true 6 | scope: text.find-in-files 7 | contexts: 8 | main: 9 | - match: ^([^ ].*:\n)$ 10 | captures: 11 | 1: entity.name.filename.find-in-files 12 | - match: ^( +[0-9]+) 13 | captures: 14 | 1: constant.numeric.line-number.find-in-files 15 | - match: ^( +[0-9]+)(:)(.+\n)$ 16 | captures: 17 | 1: constant.numeric.line-number.match.find-in-files 18 | 2: punctuation.line-number.match.find-in-files 19 | 3: match.find-in-files 20 | - match: ^( +\.{2,10})$ 21 | captures: 22 | 1: constant.numeric.line-number.find-in-files 23 | - match: ^Searching (\d+) file(?:s)? for (".+")(.+)?$ 24 | scope: header.find-in-files 25 | captures: 26 | 1: variable.total_files_count.find-in-files 27 | 2: string.query.find-in-files 28 | - match: ^(\d+) match(?:es)? (?:across|in) (\d+) file(?:s)?\n 29 | scope: footer.find-in-files 30 | captures: 31 | 1: variable.matched_count.find-in-files 32 | 2: variable.matched_files_count.find-in-files 33 | 3: sep.find-in-files 34 | - match: ^(0) matches\n 35 | scope: footer.find-in-files 36 | captures: 37 | 1: variable.no_matches.find-in-files 38 | - match: ^(0) matches 39 | captures: 40 | 1: variable.no_matches.find-in-files 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Preferences.sublime-settings-hints: -------------------------------------------------------------------------------- 1 | // This file contains information about some hidden settings 2 | // which are used by PackageDev to provide completions. 3 | { 4 | // Controls whether to clear selections, if anything is selected 5 | // in another window or application. 6 | "clear_selection": false, 7 | 8 | // Renders text in a tokenization debug mode. It can be used for 9 | // syntax development to make sure all words are tokenized as 10 | // expected. 11 | "draw_debug": false, 12 | 13 | // Renders autocompletion suggestions as phantom directly after 14 | // the caret instead of popping up the completion panel. 15 | "mini_auto_complete": false, 16 | 17 | // Controls whether to display an automatically generated name 18 | // on a view's tab control based on its content. 19 | // If `false` tabs of unsaved files always display "untitled". 20 | "set_unsaved_view_name": true, 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sublime Commands 2 | 3 | Sublime Text's command palette misses most of the internal commands exposed by the main menu. 4 | 5 | Packages like [Missing Commands](https://github.com/fjl/Sublime-Missing-Palette-Commands) therefore provide all commands not located in Sublime Text's _Default_ package. 6 | 7 | This package provides a merged and hopefully complete Default.sublime-commands which is intended to be placed into the _Default_ package. 8 | 9 | 10 | ##### Warning and Disclaimer 11 | 12 | As this package partially overwrites the _Default.sublime-package_ package provided by Sublime Text out of the box, the original content will be completely hidden. 13 | 14 | If you encounter any issues don't therefore blame the core devs but first try to remove this package. 15 | 16 | The package author tries his best to keep up to date with the ongoing development but can't provide any warranty. 17 | 18 | 19 | ##### Package Control 20 | 21 | As this package is and will never be added to the official [packagecontrol.io](https://packagecontrol.io/) for official reasons, you need to add the following settings to your _User/Package Control.sublime-settings_ if you want Package Control to keep this package up to date for you. 22 | 23 | ```json 24 | { 25 | "repositories": [ 26 | "https://github.com/deathaxe/sublime-commands" 27 | ], 28 | "package_name_map": { 29 | "sublime-commands": "Default" 30 | } 31 | } 32 | ``` 33 | 34 | Save the settings file. 35 | Open command palette, select _Package Control: Install Package_, search for _Default_ and install it. 36 | 37 | ##### Manual Setup 38 | 39 | If you want to use it to override ST's commands you'll need to clone this repo into Sublime Text's _Packages_ path as _Default_ 40 | 41 | ##### OSX 42 | 43 | ```sh 44 | #!/usr/bin/env bash 45 | cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/ 46 | git clone https://github.com/deathaxe/sublime-commands "Default" 47 | ``` 48 | 49 | 50 | ##### Linux 51 | 52 | ```sh 53 | cd ~/.config/sublime-text-3/Packages 54 | git clone https://github.com/deathaxe/sublime-commands "Default" 55 | ``` 56 | 57 | 58 | ##### Windows 59 | 60 | ```dos 61 | cd "%APPDATA%\Sublime Text 3\Packages" 62 | git clone https://github.com/deathaxe/sublime-commands "Default" 63 | ``` 64 | -------------------------------------------------------------------------------- /Side Bar.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { "caption": "-", "id": "file_commands" }, 3 | { "caption": "New File", "command": "new_file_at", "args": {"dirs": []} }, 4 | { "caption": "Rename…", "command": "rename_path", "args": {"paths": []} }, 5 | { "caption": "Delete File", "command": "delete_file", "args": {"files": [], "prompt": false} }, 6 | { "caption": "-", "id": "folder_commands" }, 7 | { "caption": "New Folder…", "command": "new_folder", "args": {"dirs": []} }, 8 | { "caption": "Delete Folder", "command": "delete_folder", "args": {"dirs": [], "prompt": true} }, 9 | { "caption": "Find in Folder…", "command": "find_in_folder", "args": {"dirs": []} }, 10 | { "caption": "-", "id": "open_commands" }, 11 | { "caption": "Reveal Link Source", "command": "reveal_link_source", "args": {"dirs": []} }, 12 | { "caption": "Open Containing Folder…", "command": "open_containing_folder", "args": {"files": []} }, 13 | { "caption": "-", "id": "repo_commands" }, 14 | { "caption": "Open Git Repository…", "command": "sublime_merge_open_repo", "args": {"paths": []}}, 15 | { "caption": "Folder History…", "command": "sublime_merge_folder_history", "args": {"paths": []}}, 16 | { "caption": "File History…", "command": "sublime_merge_file_history", "args": {"files": []}}, 17 | { "caption": "Blame File…", "command": "sublime_merge_blame_file", "args": {"files": []}}, 18 | { "caption": "-", "id": "end" } 19 | ] 20 | -------------------------------------------------------------------------------- /Syntax Test Results.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { "command": "open_context_url" }, 3 | { "caption": "-" }, 4 | { "command": "next_result" }, 5 | { "command": "prev_result" }, 6 | { "caption": "-" }, 7 | { "command": "cut" }, 8 | { "command": "copy" }, 9 | { "command": "paste" }, 10 | { "caption": "-" }, 11 | { "command": "select_all" } 12 | ] 13 | -------------------------------------------------------------------------------- /Tab Context.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { "caption": "-", "id": "tab" }, 3 | { 4 | "caption": "Close Tab", 5 | "mnemonic": "C", 6 | "command": "close_selected", 7 | "args": { "group": -1 } 8 | }, 9 | { 10 | "caption": "Close All Tabs", 11 | "mnemonic": "A", 12 | "command": "close_all_in_group", 13 | "args": { "group": -1 } 14 | }, 15 | { 16 | "caption": "Close Other Tabs", 17 | "mnemonic": "O", 18 | "command": "close_others_by_index", 19 | "args": { "group": -1, "index": -1 } 20 | }, 21 | { 22 | "caption": "Close Selected Tabs", 23 | "command": "close_selected", 24 | "args": {"group": -1, "index": -1} 25 | }, 26 | { 27 | "caption": "Close Unselected Tabs", 28 | "command": "close_unselected", 29 | "args": {"group": -1, "index": -1} 30 | }, 31 | { 32 | "caption": "Close Tabs to the Left", 33 | "mnemonic": "L", 34 | "command": "close_to_left_by_index", 35 | "args": { "group": -1, "index": -1 } 36 | }, 37 | { 38 | "caption": "Close Tabs to the Right", 39 | "mnemonic": "R", 40 | "command": "close_to_right_by_index", 41 | "args": { "group": -1, "index": -1 } 42 | }, 43 | { 44 | "caption": "Close Unmodified Tabs", 45 | "mnemonic": "U", 46 | "command": "close_unmodified", 47 | "args": { "group": -1, "index": -1 } 48 | }, 49 | { 50 | "caption": "Close Unmodified Tabs to the Left", 51 | "mnemonic": "m", 52 | "command": "close_unmodified_to_left_by_index", 53 | "args": { "group": -1, "index": -1 } 54 | }, 55 | { 56 | "caption": "Close Unmodified Tabs to the Right", 57 | "mnemonic": "n", 58 | "command": "close_unmodified_to_right_by_index", 59 | "args": { "group": -1, "index": -1 } 60 | }, 61 | { 62 | "caption": "Close Deleted Files", 63 | "mnemonic": "D", 64 | "command": "close_deleted_files", 65 | "args": { "group": -1 } 66 | }, 67 | 68 | { "caption": "-", "id": "view" }, 69 | // { 70 | // "caption": "New File", 71 | // "mnemonic": "N", 72 | // "command": "new_file" 73 | // }, 74 | // { 75 | // "caption": "Open File", 76 | // "mnemonic": "O", 77 | // "command": "prompt_open_file" 78 | // }, 79 | { 80 | "caption": "Split View", 81 | "mnemonic": "S", 82 | "command": "clone_file", 83 | "args": { "add_to_selection": true, "group": -1, "index": -1 } 84 | }, 85 | 86 | { "caption": "-", "id": "file" }, 87 | 88 | { 89 | "caption": "Copy File Path", 90 | "mnemonic": "F", 91 | "command": "copy_path" 92 | }, 93 | { 94 | "caption": "Reveal in Side Bar", 95 | "mnemonic": "", 96 | "command": "reveal_in_side_bar" 97 | }, 98 | { 99 | "caption": "Open in Browser", 100 | "mnemonic": "B", 101 | "command": "open_in_browser" 102 | }, 103 | { 104 | "caption": "Open Containing Folder…", 105 | "mnemonic": "", 106 | "command": "open_dir", 107 | "args": {"dir": "$file_path", "file": "$file_name"} 108 | }, 109 | 110 | { "caption": "-", "id": "repo_commands" }, 111 | { 112 | "caption": "Open Repository…", 113 | "mnemonic": "", 114 | "command": "sublime_merge_open_repo" 115 | }, 116 | { 117 | "caption": "File History…", 118 | "mnemonic": "", 119 | "command": "sublime_merge_file_history" 120 | }, 121 | { 122 | "caption": "Blame File…", 123 | "mnemonic": "", 124 | "command": "sublime_merge_blame_file" 125 | }, 126 | 127 | { "caption": "-", "id": "end" } 128 | ] 129 | -------------------------------------------------------------------------------- /block.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | 4 | 5 | def next_line(view, pt): 6 | return view.line(pt).b + 1 7 | 8 | 9 | def prev_line(view, pt): 10 | return view.line(pt).a - 1 11 | 12 | 13 | def is_ws(str): 14 | for ch in str: 15 | if ch not in ' \t': 16 | return False 17 | return True 18 | 19 | 20 | def indented_block(view, r): 21 | if r.empty(): 22 | if r.a == view.size(): 23 | return False 24 | 25 | nl = next_line(view, r.a) 26 | nr = view.indented_region(nl) 27 | if nr.a < nl: 28 | nr.a = nl 29 | 30 | this_indent = view.indentation_level(r.a) 31 | next_indent = view.indentation_level(nl) 32 | 33 | ok = this_indent + 1 <= next_indent 34 | 35 | if not ok: 36 | prev_indent = view.indentation_level(prev_line(view, r.a)) 37 | 38 | # Mostly handle the case where the user has just pressed enter, and the 39 | # auto indent will update the indentation to something that will trigger 40 | # the block behavior when { is pressed 41 | line_str = view.substr(view.line(r.a)) 42 | if is_ws(line_str) and len(view.get_regions("autows")) > 0: 43 | ok = prev_indent + 1 == this_indent and this_indent == next_indent 44 | 45 | if ok: 46 | # ensure that every line of nr is indented more than nl 47 | l = next_line(view, nl) 48 | while l < nr.b: 49 | if view.indentation_level(l) < next_indent: 50 | return False 51 | l = next_line(view, l) 52 | return True 53 | 54 | return False 55 | 56 | 57 | class BlockContext(sublime_plugin.EventListener): 58 | def on_query_context(self, view, key, operator, operand, match_all): 59 | if key != "indented_block": 60 | return None 61 | 62 | if operator != sublime.OP_EQUAL and operator != sublime.OP_NOT_EQUAL: 63 | return False 64 | 65 | is_all = True 66 | is_any = False 67 | 68 | for r in view.sel(): 69 | if operator == sublime.OP_EQUAL: 70 | b = (operand == indented_block(view, r)) 71 | else: 72 | b = (operand != indented_block(view, r)) 73 | 74 | if b: 75 | is_any = True 76 | else: 77 | is_all = False 78 | 79 | return is_all if match_all else is_any 80 | 81 | 82 | class WrapBlockCommand(sublime_plugin.TextCommand): 83 | def run(self, edit, begin, end): 84 | view = self.view 85 | view.run_command('insert', {'characters': begin}) 86 | 87 | for r in reversed(view.sel() or []): 88 | if r.empty(): 89 | 90 | nr = view.indented_region(next_line(view, r.a)) 91 | 92 | slvl = view.indentation_level(r.a) 93 | elvl = view.indentation_level(nr.b) 94 | 95 | end_line = view.substr(view.line(nr.b)).strip() 96 | 97 | # Insert `end` if it does not exist at the end of the indented 98 | # block with the same indention level. 99 | if slvl != elvl or not end_line.startswith(end): 100 | 101 | begin_line = view.substr(view.line(r.a)) 102 | 103 | ws = "" 104 | for ch in begin_line: 105 | if ch not in ' \t': 106 | break 107 | ws += ch 108 | 109 | if nr.b == view.size() and view.substr(nr.b - 1) != "\n": 110 | view.insert(edit, nr.b, "\n" + ws + end + "\n") 111 | else: 112 | view.insert(edit, nr.b, ws + end + "\n") 113 | -------------------------------------------------------------------------------- /encoding.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | 4 | 5 | class EncodingInputHandler(sublime_plugin.ListInputHandler): 6 | 7 | def name(self): 8 | return "encoding" 9 | 10 | def placeholder(self): 11 | return "text encoding" 12 | 13 | def list_items(self): 14 | return [ 15 | item["args"]["encoding"] 16 | for item in sublime.decode_value(sublime.load_resource( 17 | "Packages/Default/Encoding.sublime-menu"))[0]["children"] 18 | if "args" in item 19 | ] 20 | 21 | 22 | class ReopenEncodingCommand(sublime_plugin.WindowCommand): 23 | 24 | def input_description(self): 25 | return "Reopen with" 26 | 27 | def input(self, args): 28 | if "encoding" not in args: 29 | return EncodingInputHandler() 30 | return None 31 | 32 | def run(self, encoding): 33 | self.window.run_command("reopen", {"encoding": encoding}) 34 | 35 | 36 | class SaveEncodingCommand(sublime_plugin.WindowCommand): 37 | 38 | def input_description(self): 39 | return "Save with" 40 | 41 | def input(self, args): 42 | if "encoding" not in args: 43 | return EncodingInputHandler() 44 | return None 45 | 46 | def run(self, encoding): 47 | self.window.run_command("save", {"async": True, "encoding": encoding}) 48 | 49 | 50 | class SetEncodingCommand(sublime_plugin.WindowCommand): 51 | 52 | def input_description(self): 53 | return "Set Encoding" 54 | 55 | def input(self, args): 56 | if "encoding" not in args: 57 | return EncodingInputHandler() 58 | return None 59 | 60 | def run(self, encoding): 61 | self.window.run_command("set_encoding", {"encoding": encoding}) 62 | -------------------------------------------------------------------------------- /line_endings.py: -------------------------------------------------------------------------------- 1 | import sublime_plugin 2 | 3 | # dictionary of valid line endings 4 | LINE_ENDINGS = { 5 | 'windows': "Windows\tCRLF", 6 | 'unix': "Unix\tLF", 7 | 'cr': "MacOS\tCR" 8 | } 9 | 10 | 11 | def description(type): 12 | return LINE_ENDINGS.get(type.lower(), type) 13 | 14 | 15 | class TypeInputHandler(sublime_plugin.ListInputHandler): 16 | 17 | def __init__(self, line_endings): 18 | super().__init__() 19 | self.old_endings = line_endings 20 | 21 | def placeholder(self): 22 | return "Select Line Endings" 23 | 24 | def preview(self, new_endings): 25 | if self.old_endings.lower() == new_endings.lower(): 26 | return "Line endings are set to '{}'.".format( 27 | description(self.old_endings)) 28 | return "Change line endings from '{}' to '{}'.".format( 29 | description(self.old_endings), description(new_endings)) 30 | 31 | def list_items(self): 32 | values = list(LINE_ENDINGS.keys()) 33 | return ( 34 | [[LINE_ENDINGS[value], value] for value in values], 35 | values.index(self.old_endings.lower()) 36 | ) 37 | 38 | 39 | class SetLineEndings(sublime_plugin.TextCommand): 40 | """A replacement command for the builtin `set_line_ending`. 41 | 42 | This class provides an input handler to list the available line endings 43 | in the command palette using an `ListInputHanlder` rather then listing all 44 | the values as separate commands. 45 | """ 46 | 47 | def is_checked(self, type): 48 | return type.lower() == self.view.line_endings().lower() 49 | 50 | def description(self, type): 51 | return description(type) 52 | 53 | def input_description(self): 54 | return "Line Endings:" 55 | 56 | def input(self, args): 57 | if "type" not in args: 58 | return TypeInputHandler(self.view.line_endings()) 59 | return None 60 | 61 | def run(self, edit, type): 62 | self.view.set_line_endings(type) 63 | -------------------------------------------------------------------------------- /package_settings.py: -------------------------------------------------------------------------------- 1 | import re 2 | import os 3 | 4 | import sublime 5 | import sublime_plugin 6 | 7 | PACKAGES = "${packages}/" 8 | 9 | # The pattern to extract the path and basename of a file without OS pattern. 10 | SETTINGS_RE = re.compile( 11 | r"(?i)Packages/(.+?)/(.+/)?(.+?)(\.sublime-settings)") 12 | 13 | 14 | class BaseFileInputHandler(sublime_plugin.ListInputHandler): 15 | 16 | def name(self): 17 | return "base_file" 18 | 19 | def placeholder(self): 20 | return "Settings File" 21 | 22 | def list_items(self): 23 | 24 | # create filter for syntax-specific settings 25 | syntaxes = set() 26 | for f in sublime.find_resources('*.sublime-syntax') + \ 27 | sublime.find_resources('*.tmLanguage'): 28 | name, _ = os.path.splitext(os.path.basename(f)) 29 | syntaxes.add(name) 30 | 31 | items = [] 32 | names = set() 33 | for f in sublime.find_resources('*.sublime-settings'): 34 | package, path, name, ext = SETTINGS_RE.match(f).groups() 35 | if package != 'User' and name not in names and name not in syntaxes: 36 | item = "".join((package, "/", path or "", name, ext)) 37 | items.append((item, PACKAGES + item)) 38 | names.add(name) 39 | 40 | items.sort() 41 | return items 42 | 43 | 44 | class EditPackageSettingsCommand(sublime_plugin.WindowCommand): 45 | 46 | def input_description(self): 47 | return "Preferences" 48 | 49 | def input(self, args): 50 | if "base_file" not in args: 51 | if "user_file" in args: 52 | del args["user_file"] 53 | return BaseFileInputHandler() 54 | return None 55 | 56 | def run(self, base_file): 57 | self.window.run_command( 58 | "edit_settings", { 59 | "base_file": base_file, 60 | 'default': ( 61 | '// These settings override Default settings ' 62 | 'for the package\n{\n\t$0\n}\n') 63 | }) 64 | 65 | 66 | class SyntaxSettingsInputHandler(sublime_plugin.ListInputHandler): 67 | 68 | def __init__(self, syntax): 69 | self.syntax = syntax 70 | 71 | def name(self): 72 | return "syntax" 73 | 74 | def placeholder(self): 75 | return "Syntax Name" 76 | 77 | def list_items(self): 78 | items = set() 79 | selected = None 80 | for f in sublime.find_resources('*.sublime-syntax') + \ 81 | sublime.find_resources('*.tmLanguage'): 82 | name, _ = os.path.splitext(os.path.basename(f)) 83 | if name == self.syntax: 84 | item = (name + " (this view)", name) 85 | selected = item 86 | else: 87 | item = (name, name) 88 | items.add(item) 89 | 90 | items = list(items) 91 | items.sort() 92 | return (items, items.index(selected)) if selected else items 93 | 94 | 95 | class EditSyntaxSettingsCommand(sublime_plugin.WindowCommand): 96 | 97 | def input_description(self): 98 | return "Syntax Settings" 99 | 100 | def input(self, args): 101 | if "syntax" not in args: 102 | try: 103 | settings = self.window.active_view().settings() 104 | syntax, _ = os.path.splitext(os.path.basename(settings.get('syntax'))) 105 | except: 106 | syntax = None 107 | return SyntaxSettingsInputHandler(syntax) 108 | return None 109 | 110 | def run(self, syntax): 111 | self.window.run_command( 112 | 'edit_settings', 113 | { 114 | 'base_file': '${packages}/Default/Preferences.sublime-settings', 115 | 'user_file': os.path.join(sublime.packages_path(), 'User', syntax + '.sublime-settings'), 116 | 'default': ( 117 | '// These settings override both User and Default settings ' 118 | 'for the %s syntax\n{\n\t$0\n}\n') % syntax 119 | }) 120 | 121 | def is_enabled(self): 122 | return True 123 | -------------------------------------------------------------------------------- /tabs.py: -------------------------------------------------------------------------------- 1 | import sublime_plugin 2 | 3 | 4 | class CloseAllInGroupCommand(sublime_plugin.WindowCommand): 5 | def run(self, group): 6 | for view in self.window.views_in_group(group): 7 | view.close() 8 | 9 | 10 | class CloseToLeftByIndexCommand(sublime_plugin.WindowCommand): 11 | 12 | def run(self, group = -1, index = -1): 13 | for view in self.window.views_in_group(group)[:index]: 14 | view.close() 15 | 16 | def is_enabled(self, group, index): 17 | return index > 0 18 | 19 | 20 | class CloseUnmodifiedToLeftByIndexCommand(sublime_plugin.WindowCommand): 21 | 22 | def run(self, group = -1, index = -1): 23 | for view in self.window.views_in_group(group)[:index]: 24 | if not view.is_dirty(): 25 | view.close() 26 | 27 | def is_enabled(self, group, index): 28 | return index > 0 29 | -------------------------------------------------------------------------------- /toggle.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | 4 | HAVE_GET_LOG_STATE = int(sublime.version()) >= 4099 5 | 6 | 7 | class ToggleLogBuiltSystemsCommand(sublime_plugin.ApplicationCommand): 8 | 9 | def __init__(self): 10 | self.flag = False 11 | 12 | def run(self): 13 | if HAVE_GET_LOG_STATE: 14 | self.flag = not sublime.get_log_build_systems() 15 | else: 16 | self.flag = not self.flag 17 | sublime.log_build_systems(self.flag) 18 | sublime.status_message('log_build_systems -> %s' % str(self.flag)) 19 | 20 | 21 | class ToggleLogCommandsCommand(sublime_plugin.ApplicationCommand): 22 | 23 | def __init__(self): 24 | self.flag = False 25 | 26 | def run(self): 27 | if HAVE_GET_LOG_STATE: 28 | self.flag = not sublime.get_log_commands() 29 | else: 30 | self.flag = not self.flag 31 | sublime.log_commands(self.flag) 32 | sublime.status_message('log_commands -> %s' % str(self.flag)) 33 | 34 | 35 | class ToggleLogControlTreeCommand(sublime_plugin.ApplicationCommand): 36 | 37 | def __init__(self): 38 | self.flag = False 39 | 40 | def is_enabled(self): 41 | return hasattr(sublime, 'log_control_tree') 42 | 43 | def run(self): 44 | if HAVE_GET_LOG_STATE: 45 | self.flag = not sublime.get_log_control_tree() 46 | else: 47 | self.flag = not self.flag 48 | sublime.log_control_tree(self.flag) 49 | sublime.status_message('log_control_tree -> %s' % str(self.flag)) 50 | 51 | 52 | class ToggleLogInputCommand(sublime_plugin.ApplicationCommand): 53 | 54 | def __init__(self): 55 | self.flag = False 56 | 57 | def run(self): 58 | if HAVE_GET_LOG_STATE: 59 | self.flag = not sublime.get_log_input() 60 | else: 61 | self.flag = not self.flag 62 | sublime.log_input(self.flag) 63 | sublime.status_message('log_input -> %s' % str(self.flag)) 64 | 65 | 66 | class ToggleLogIndexingCommand(sublime_plugin.ApplicationCommand): 67 | 68 | def __init__(self): 69 | self.flag = False 70 | 71 | def run(self): 72 | if HAVE_GET_LOG_STATE: 73 | self.flag = not sublime.get_log_indexing() 74 | else: 75 | self.flag = not self.flag 76 | sublime.log_indexing(self.flag) 77 | sublime.status_message('log_indexing -> %s' % str(self.flag)) 78 | 79 | 80 | class ToggleLogResultRegexCommand(sublime_plugin.ApplicationCommand): 81 | 82 | def __init__(self): 83 | self.flag = False 84 | 85 | def run(self): 86 | if HAVE_GET_LOG_STATE: 87 | self.flag = not sublime.get_log_result_regex() 88 | else: 89 | self.flag = not self.flag 90 | sublime.log_result_regex(self.flag) 91 | sublime.status_message('log_result_regex -> %s' % str(self.flag)) 92 | 93 | 94 | class TogglePreferenceCommand(sublime_plugin.ApplicationCommand): 95 | 96 | def run(self, setting, persist=True): 97 | pref = sublime.load_settings("Preferences.sublime-settings") 98 | pref.set(setting, not pref.get(setting, False)) 99 | if persist: 100 | sublime.save_settings("Preferences.sublime-settings") 101 | 102 | 103 | class ToggleDrawDebug(sublime_plugin.TextCommand): 104 | def run(self, edit): 105 | settings = self.view.settings() 106 | settings.set("draw_debug", not settings.get("draw_debug", False)) 107 | -------------------------------------------------------------------------------- /view_resource.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | 4 | 5 | class ResourceNameInputHandler(sublime_plugin.ListInputHandler): 6 | 7 | def name(self): 8 | return "name" 9 | 10 | def placeholder(self): 11 | return "Name" 12 | 13 | def list_items(self): 14 | settings = sublime.load_settings("Preferences.sublime-settings") 15 | exclude = set(f + '/' for f in settings.get("folder_exclude_patterns", [])) 16 | 17 | PACKAGES = "Packages/" 18 | start = len(PACKAGES) 19 | return [ 20 | f[start:] for f in sublime.find_resources('') 21 | if f.startswith(PACKAGES) 22 | and not f.endswith('.sublime-package') 23 | and not any(fe in f for fe in exclude) 24 | ] 25 | 26 | 27 | class ViewResourceCommand(sublime_plugin.WindowCommand): 28 | def run(self, name): 29 | self.window.run_command("open_file", {"file": "${packages}/" + name}) 30 | 31 | def input(self, args): 32 | if "name" not in args: 33 | return ResourceNameInputHandler() 34 | return None 35 | --------------------------------------------------------------------------------