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 8075d6c..417c65d 100644
--- a/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap
+++ b/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap
@@ -22,6 +22,7 @@
"command": "enter_exit_wiki_tag",
"context": [
{ "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" },
+ { "key": "file_name", "operator": "regex_contains", "operand": "yaml" },
],
},
@@ -29,6 +30,7 @@
"command": "enter_exit_wiki_tag",
"context": [
{ "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" },
+ { "key": "file_name", "operator": "regex_contains", "operand": "yaml" },
],
},
@@ -36,6 +38,7 @@
"command": "space_in_wiki_tag",
"context": [
{ "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" },
+ { "key": "file_name", "operator": "regex_contains", "operand": "yaml" },
],
},
@@ -43,6 +46,7 @@
"command": "space_in_wiki_tag",
"context": [
{ "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" },
+ { "key": "file_name", "operator": "regex_contains", "operand": "yaml" },
],
},
@@ -50,6 +54,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" },
],
@@ -59,6 +64,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" },
],
@@ -68,6 +74,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..a31cf06 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',)
|