diff options
Diffstat (limited to 'apps/Sublime Text 4/Packages')
5 files changed, 379 insertions, 15 deletions
diff --git a/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap b/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap index 7426757..1fbc901 100644 --- a/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap +++ b/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap @@ -2,15 +2,31 @@ { "keys": ["ctrl+tab"], "command": "next_view" }, { "keys": ["ctrl+shift+tab"], "command": "prev_view" }, { "keys": ["super+alt+s"], "command": "toggle_side_bar" }, + { "keys": ["super+shift+s"], "command": "save_all" }, { "keys": ["super+shift+d"], "command": "clone_file" }, { "keys": ["ctrl+f"], "command": "distraction_free_window" }, + { "keys": ["super+r"], "command": "toggle_overwrite", "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.plain" }, + ], + }, + { "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line.sublime-macro"}, "context": [ { "key": "overlay_has_focus", "operator": "equal", "operand": false }, ], }, + { "keys": ["ctrl+super+k"], "command": "next_bookmark" }, + { "keys": ["ctrl+shift+super+k"], "command": "prev_bookmark" }, + { "keys": ["super+k"], "command": "toggle_bookmark", "args": {"toggle_line": true } }, + + { "keys": ["super+shift+l"], "command": "lower_case" }, + { "keys": ["super+shift+u"], "command": "upper_case" }, + + { "keys": ["super+shift+e"], "command": "replace_all" }, + // HSMusic wiki tag editing // (bind caps lock to f16 in Karabiner-Elements) @@ -18,6 +34,7 @@ "command": "enter_exit_wiki_tag", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, ], }, @@ -25,6 +42,7 @@ "command": "enter_exit_wiki_tag", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, ], }, @@ -32,6 +50,7 @@ "command": "space_in_wiki_tag", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, ], }, @@ -39,6 +58,7 @@ "command": "space_in_wiki_tag", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, ], }, @@ -46,6 +66,7 @@ "command": "exit_wiki_tag", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, { "key": "panel_has_focus", "operator": "not_equal" }, { "key": "overlay_has_focus", "operator": "not_equal" }, ], @@ -55,6 +76,7 @@ "command": "bold_wiki_text", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, { "key": "panel_has_focus", "operator": "not_equal" }, { "key": "overlay_has_focus", "operator": "not_equal" }, ], @@ -64,6 +86,7 @@ "command": "insert_line_break_in_wiki_text", "context": [ { "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }, + { "key": "file_name", "operator": "regex_contains", "operand": "\\.yaml" }, { "key": "panel_has_focus", "operator": "not_equal" }, { "key": "overlay_has_focus", "operator": "not_equal" }, ], diff --git a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py index 41c6408..9b8c369 100644 --- a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py +++ b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py @@ -22,6 +22,25 @@ class ProjectSpecificKeyBinding(sublime_plugin.EventListener): elif operator == sublime.QueryOperator.NOT_REGEX_CONTAINS: return not re.search(operand, current_project_name) +class FileSpecificKeyBinding(sublime_plugin.EventListener): + def on_query_context(self, view, key, operator, operand, match_all): + current_file_name = view.file_name() + + if not current_file_name: + return None + + if key != "file_name" and os.path.isfile(current_file_name): + return None + + if operator == sublime.OP_EQUAL: + return current_file_name == operand + elif operator == sublime.OP_NOT_EQUAL: + return current_file_name != operand + elif operator == sublime.QueryOperator.REGEX_CONTAINS: + return re.search(operand, current_file_name) + elif operator == sublime.QueryOperator.NOT_REGEX_CONTAINS: + return not re.search(operand, current_file_name) + class _CursorAdaptiveCommand(sublime_plugin.TextCommand): handle_region_fallback = ('keep',) @@ -170,7 +189,7 @@ def _normalize_region(region): def _match_tag_in_progress(view, region): region = _normalize_region(region) to_start = sublime.Region(view.line(region).a, region.a) - match = re.search('(\[\[(?:(?!]]|\|).)*)$', view.substr(to_start)) + match = re.search(r'(\[\[(?:(?!]]|\|).)*)$', view.substr(to_start)) if match: return match.group(1) @@ -180,13 +199,13 @@ def _match_regex_ahead_same_line(view, region, regex): return re.search(regex, view.substr(to_end)) def _match_rest_of_tag_in_progress(view, region): - regex = '^((?:(?!\[\[).)*]])' + regex = r'^((?:(?!\[\[).)*]])' match = _match_regex_ahead_same_line(view, region, regex) if match: return match.group(1) def _match_through_closing_html_tag(view, region, tag): - regex = f'^(.*?</{tag}>)' + regex = rf'^(.*?</{tag}>)' match = _match_regex_ahead_same_line(view, region, regex) if match: return match.group(1) @@ -199,7 +218,7 @@ def _consider_reference_cycle(view, region, cycle): rest_of_tag = _match_rest_of_tag_in_progress(view, region) - rest_of_ref = re.search('^((?:(?!\|).)*:)', rest_of_tag) + rest_of_ref = re.search(r'^((?:(?!\|).)*:)', rest_of_tag) if rest_of_ref: return ('move', len(rest_of_ref.group(1))) @@ -225,6 +244,35 @@ def _consider_reference_cycle(view, region, cycle): else: return ('insert', 'right', next_ref + ':', 0) +def _consider_transform_url(view, region): + region = _normalize_region(region) + selected_text = view.substr(region) + + start_through_selection = sublime.Region(view.line(region).a, region.b) + match = re.search(r'https?://\S+$', view.substr(start_through_selection)) + + if not match: + return None + + # We don't have a convenient way to just replace a selection in one move, + # so just move to the end of the selection and try again next time... + if selected_text: + return ('collapse_move', len(selected_text)) + + url = match.group(0) + link = None + + hsm = r'(?:https://(?:preview\.|staging\.)?hsmusic\.wiki/|http://localhost:\d+/)' + + match = re.search(hsm + r'(album|track|artist|group|tag|flash)/(.+?)/', url) + if match: + link = f'[[{match.group(1)}:{match.group(2)}]]' + + if not link: + return None + + return ('replace_left', len(url), link, 0, 'right') + def _guess_directory(name): directory = name directory = "-".join(directory.split(" ")) @@ -257,11 +305,15 @@ class ExitWikiTagCommand(_CursorAdaptiveCommand): if rest_of_tag: return ('collapse_move', len(rest_of_tag)) + transform_url_action = _consider_transform_url(self.view, region) + if transform_url_action: + return transform_url_action + region = _normalize_region(region) to_start = sublime.Region(self.view.line(region).a, region.a) to_end = sublime.Region(region.a, self.view.line(region).b) if to_start.a != to_start.b and to_end.a != to_end.b: - match = re.search('.*?([).,:;!?][).,:;!?"\']*|\\s(?=[(\'"])|[\'"](?=\\s|$)|$)', self.view.substr(to_end)) + match = re.search(r'.*?([).,:;!?][).,:;!?"\']*|\\s(?=[(\'"])|[\'"](?=\\s|$)|$)', self.view.substr(to_end)) if match: return ('collapse_move', len(match.group(0))) diff --git a/apps/Sublime Text 4/Packages/User/Jellybeams - Nebula.sublime-color-scheme b/apps/Sublime Text 4/Packages/User/Jellybeams - Nebula.sublime-color-scheme new file mode 100644 index 0000000..29766df --- /dev/null +++ b/apps/Sublime Text 4/Packages/User/Jellybeams - Nebula.sublime-color-scheme @@ -0,0 +1,274 @@ +/* + * Jellybeams - Nebula: Based on Stephen Underwood's theme (sphvn). + * Jellybeams: Based on NanoTech's theme Jellybeans for vim. + */ +{ + "name": "Jellybeams - Nebula", + + "variables": { + "black": "#151515", + "white": "#E6E6D1", + + "bright": "#FFFFE8", + + "dim": "#CACAB8", + "dim": "#BABAAA", + + "string": "#99AD6A", + "number": "#7EAFC4", + "variable": "#FFB964", + "keyword": "#C0C2B0", + "invalid": "red", + }, + + "globals": { + "foreground": "var(white)", + "background": "var(black)", + "caret": "#B0D0F0", + "line_highlight": "#83689448", + + "gutter_foreground": "#E8E8D374", + + "selection": "#71597FA8", + "selection_foreground": "#FFFFE8", + "selection_border": "#FFFFFF", + + "highlight": "#FFFFFF", + + "brackets_options": "foreground bold underline glow", + "brackets_foreground": "white", + "bracket_contents_options": "", + "bracket_contents_foreground": "var(white)", + }, + + "rules": [ + // Universal rules + + { + "scope": "comment", + "foreground": "var(bright)", + "font_style": "italic", + }, + + { + "scope": "comment.block", + "foreground": "var(dim)", + "font_style": "italic", + }, + + { + "scope": "constant.language.boolean.true", + "foreground": "#B96BF7", + }, + + { + "scope": "constant.language.boolean.false", + "foreground": "#FE4A4A", + }, + + { + "scope": "constant.language.null", + "foreground": "#FF2672", + }, + + { + "scope": "invalid", + "foreground": "var(invalid)", + }, + + { + "scope": "keyword.control", + "foreground": "var(keyword)", + }, + + { + "scope": "keyword.declaration", + "foreground": "var(keyword)", + }, + + { + "scope": "storage.modifier", + "foreground": "var(keyword)", + }, + + // Language - CSS + + { + "scope": "comment.block.css", + "foreground": "var(bright)", + "font_style": "italic" + }, + + { + "scope": "entity.other.layer.css", + "foreground": "var(variable)", + }, + + // Language - Fastly VCL + + { + "scope": "meta.string.vcl.fastly", + "foreground": "var(string)", + }, + + {"scope": "constant.numeric.vcl.fastly", "foreground": "var(number)"}, + {"scope": "constant.numeric.float.decimal.vcl.fastly", "foreground": "var(number)"}, + {"scope": "constant.numeric.float.hexadecimal.vcl.fastly", "foreground": "var(number)"}, + {"scope": "constant.numeric.integer.decimal.vcl.fastly", "foreground": "var(number)"}, + {"scope": "constant.numeric.integer.hexadecimal.vcl.fastly", "foreground": "var(number)"}, + + { + "scope": "entity.name.subroutine.vcl.fastly", + "foreground": "var(variable)", + }, + + { + "scope": "storage.type.vcl.fastly", + "foreground": "var(dim)", + }, + + // Language - HTML + + { + "scope": "meta.tag.block.any.html", + "foreground": "var(dim)", + }, + + { + "scope": "meta.tag.inline.any.html", + "foreground": "var(dim)", + }, + + { + "scope": "meta.tag.inline.any.html meta.path.url.html string", + "foreground": "var(string)", + }, + + { + "scope": "meta.toc-list.id.html string", + "foreground": "var(variable)", + }, + + // Language - Python + + { + "scope": "meta.string.python", + "foreground": "var(string)", + }, + + { + "scope": "meta.interpolation.python", + "foreground": "color(var(white) lightness(70%) saturation(25%))", + "font_style": "bold" + }, + + // Language - JavaScript + + { + "scope": "meta.string.js", + "foreground": "var(string)", + }, + + { + "scope": "meta.string.template.js", + "foreground": "var(string)", + }, + + { + "scope": "punctuation.definition.string.begin.js", + "foreground": "color(var(string) lightness(40%))", + }, + + { + "scope": "punctuation.definition.string.end.js", + "foreground": "color(var(string) lightness(40%))", + }, + + { + "scope": "source.js.embedded - string.regexp.js", + "foreground": "color(var(white) lightness(70%) saturation(25%))", + "font_style": "bold" + }, + + { + "scope": "keyword.declaration.function.arrow.js", + "foreground": "var(white)", + }, + + { + "scope": "keyword.control.import.vcl.fastly", + "foreground": "var(white)", + "font_style": "bold" + }, + + // JavaScript - additional keywords + + {"scope": "storage.modifier.js", "foreground": "var(keyword)"}, + {"scope": "storage.modifier.extends.js", "foreground": "var(keyword)"}, + + // JavaScript - imports and exports + + { + "scope": "meta.import.js string", + "foreground": "var(white)", + }, + + { + "scope": "meta.export.js meta.binding.name.js - meta.function", + "foreground": "var(variable)", + }, + + // JavaScript - function and class names + + { + "scope": "entity.name.function.js - meta.function meta.block", + "foreground": "var(variable)", + }, + + { + "scope": "entity.name.class.js", + "foreground": "var(bright)", + }, + + { + "scope": "meta.function-call.arguments.js entity.name.function.js", + "foreground": "var(white)", + }, + + // JavaScript - first level of mapping keys in class exports + + { + "scope": "meta.export.js meta.class.js meta.mapping.key.js - meta.mapping.js meta.mapping.js - meta.for.js", + "foreground": "var(variable)", + }, + + { + "scope": "meta.export.js meta.class.js meta.mapping.js meta.mapping.js meta.mapping.key.js", + "foreground": "var(white)", + }, + + { + "scope": "meta.export.js meta.class.js meta.function.parameters.js meta.mapping.key.js", + "foreground": "var(white)", + }, + + { + "scope": "meta.export.js meta.class.js meta.mapping.js meta.mapping.js entity.name.function.js", + "foreground": "var(white)", + }, + + // Language - JSON + + { + "scope": "meta.string.json", + "foreground": "var(string)", + }, + + // Language - Regular Expression + + { + "scope": "entity.name.other.group.regexp", + "foreground": "var(variable)", + }, + ], +} diff --git a/apps/Sublime Text 4/Packages/User/Markdown.sublime-settings b/apps/Sublime Text 4/Packages/User/Markdown.sublime-settings index 282ef1a..50c3d10 100644 --- a/apps/Sublime Text 4/Packages/User/Markdown.sublime-settings +++ b/apps/Sublime Text 4/Packages/User/Markdown.sublime-settings @@ -1,5 +1,9 @@ // These settings override both User and Default settings for the Markdown syntax { + "rulers": [80], + "ruler_style": "stippled", + "wrap_width": 78, + "mini_diff": false, "match_brackets": false, "auto_match_enabled": false, @@ -14,6 +18,5 @@ "caret_extra_bottom": 2, "caret_extra_width": 0, - "light_color_scheme": "Bass D-O.sublime-color-scheme", - // "color_scheme": "MarkdownEditor.sublime-color-scheme", + "color_scheme": "Packages/Colorsublime - Themes/Humane.tmTheme", } diff --git a/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings b/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings index c520bcf..620b166 100644 --- a/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings +++ b/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings @@ -1,14 +1,23 @@ { "font_face": "Input Mono Narrow", - "font_size": 15, + "font_size": 12, + "line_padding_top": 2, + "line_padding_bottom": 2, "show_git_status": false, + "hide_new_tab_button": true, + + "overlay_scroll_bars": "disable", + "use_find_clipboard": false, "highlight_line": true, "scroll_past_end": true, "scroll_context_lines": 6, "indent_guide_options": ["draw_active"], + "folder_exclude_patterns": [".git", ".Trash", ".Trash-*", ".tap", "node_modules"], + "binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip", "*.avif"], + "trim_trailing_white_space_on_save": "not_on_caret", "ensure_newline_at_eof_on_save": true, @@ -16,6 +25,12 @@ "wrap_width_style": "min", "draw_white_space": ["selection", "trailing"], + "always_show_minimap_viewport": true, + "draw_minimap_border": true, + "minimap_horizontal_scrolling": false, + + "caret_style": "smooth", + "tab_completion": false, "mini_diff": "auto", "auto_complete": true, @@ -29,15 +44,12 @@ "ignored_packages": [ + "CursorRuler", "Vintage", ], "theme": "Adaptive.sublime-theme", - "color_scheme": "Packages/Colorsublime - Themes/Jellybeams.tmTheme", - "dark_color_scheme": "Packages/Theme - Afterglow/Afterglow-twilight.tmTheme", - "light_color_scheme": "Celeste.sublime-color-scheme", - - // MarkdownEditing preferences - "mde.auto_fold_link.enabled": false, - "mde.list_indent_bullets": [], + "color_scheme": "auto", + "dark_color_scheme": "Packages/User/Jellybeams - Nebula.sublime-color-scheme", + "light_color_scheme": "Packages/Github Color Theme/GitHub.tmTheme", } |