« get me outta code hell

st4: hsmusic: cmd+b for bold - dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-20 10:09:03 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-20 10:24:22 -0400
commitce07094014be6cfdba4d1b6ad335d21ca7856486 (patch)
treef65494e2e3bcd4c9e622f9da60acfd755b4b95b2
parentdcc97ff380b85f42a4c93da46eb2fcc3dc366a49 (diff)
st4: hsmusic: cmd+b for bold
this implementation from panacea
-rw-r--r--apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap7
-rw-r--r--apps/Sublime Text 4/Packages/User/HSMusic Editing.py7
2 files changed, 14 insertions, 0 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 7d4faff..bcf66c0 100644
--- a/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap
+++ b/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap
@@ -50,4 +50,11 @@
 			{ "key": "overlay_has_focus", "operator": "not_equal" },
 		],
 	},
+
+	{ "keys": ["super+b"],
+		"command": "wrap_text_bold",
+		"context": [
+			{ "key": "project_name", "operator": "regex_contains", "operand": "HSMusic" }
+		],
+	},
 ]
diff --git a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
index 232ecd3..6daa032 100644
--- a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
+++ b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
@@ -241,6 +241,13 @@ class EnterExitWikiTagCommand(_CursorAdaptiveCommand):
     else:
       return ('wrap', '[[', ']]', 'left')
 
+class WrapTextBoldCommand(_CursorAdaptiveCommand):
+  def handle_region(self, region):
+    if region.a == region.b:
+      return ('insert', 'right', '<b></b>', 4)
+    else:
+      return ('wrap', '<b>', '</b>', 'right')
+
 class ExitWikiTagCommand(_CursorAdaptiveCommand):
   def handle_region(self, region):
     rest_of_tag = _match_rest_of_tag_in_progress(self.view, region)