« get me outta code hell

dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.tmux.conf3
-rw-r--r--.zshrc3
-rw-r--r--apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap11
-rw-r--r--apps/Sublime Text 4/Packages/User/HSMusic Editing.py43
-rw-r--r--apps/Sublime Text 4/Packages/User/Preferences.sublime-settings1
-rw-r--r--apps/krita/krita-shortcuts.shortcuts26
-rw-r--r--userstuff/hsmusic/Switch HSMusic websites.user.js4
7 files changed, 84 insertions, 7 deletions
diff --git a/.tmux.conf b/.tmux.conf
index 04760e3..89a5d4b 100644
--- a/.tmux.conf
+++ b/.tmux.conf
@@ -8,6 +8,9 @@ set -sg escape-time 0
 set -g status-style bg=colour235,fg=colour249
 set-window-option -g window-status-current-style fg=colour251,bright
 
+set -g set-titles on
+set -g set-titles-string "#S: #W"
+
 bind '"' split-window -c "#{pane_current_path}"
 bind % split-window -h -c "#{pane_current_path}"
 bind c new-window -c "#{pane_current_path}"
diff --git a/.zshrc b/.zshrc
index e185d87..25d0ef6 100644
--- a/.zshrc
+++ b/.zshrc
@@ -118,6 +118,9 @@ export PATH
 # -- cli shenanigans --
 
 alias tm='tmux attach \; choose-tree -s && exit'
+alias grc='git rebase --continue'
+alias grs='git show $(cat .git/REBASE_HEAD)'
+alias gri='git rebase --interactive --autosquash'
 
 # -- file management utilities --
 
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 3c842f5..4a5f8bb 100644
--- a/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap
+++ b/apps/Sublime Text 4/Packages/User/Default (OSX).sublime-keymap
@@ -5,6 +5,12 @@
 	{ "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 },
@@ -15,6 +21,11 @@
 	{ "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)
 
diff --git a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
index a31cf06..9b8c369 100644
--- a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
+++ b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
@@ -189,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)
 
@@ -199,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)
@@ -218,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)))
 
@@ -244,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(" "))
@@ -276,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/Preferences.sublime-settings b/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings
index f943b86..897f1ed 100644
--- a/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings
+++ b/apps/Sublime Text 4/Packages/User/Preferences.sublime-settings
@@ -3,6 +3,7 @@
 	"font_size": 15,
 
 	"show_git_status": false,
+	"hide_new_tab_button": true,
 
 	"highlight_line": true,
 	"scroll_past_end": true,
diff --git a/apps/krita/krita-shortcuts.shortcuts b/apps/krita/krita-shortcuts.shortcuts
new file mode 100644
index 0000000..3ca342f
--- /dev/null
+++ b/apps/krita/krita-shortcuts.shortcuts
@@ -0,0 +1,26 @@
+[Shortcuts]
+KisToolSelectElliptical=none
+KisToolSelectOutline=U
+KisToolTransform=S
+KritaFill/KisToolFill=F; B
+KritaSelected/KisToolColorSampler=O
+KritaShape/KisToolBrush=P
+KritaShape/KisToolEllipse=none
+KritaTransform/KisToolMove=M
+RenameCurrentLayer=F2; R
+convert-to-path=none
+create_quick_group=Meta+G
+decrease_brush_size=Shift+[
+edit_redo=Ctrl+Shift+Z; Shift+J
+edit_undo=Ctrl+Z; J
+eraser_preset_action=K
+fullscreen=Meta+Ctrl+F
+increase_brush_size=Shift+]
+increase_opacity=none
+make_brush_color_darker=none
+pathpoint-join=none
+rotate_canvas_left=[
+rotate_canvas_right=]
+show_color_history=none
+show_common_colors=none
+toggle_layer_visibility=N
diff --git a/userstuff/hsmusic/Switch HSMusic websites.user.js b/userstuff/hsmusic/Switch HSMusic websites.user.js
index 47c2d0b..a36a138 100644
--- a/userstuff/hsmusic/Switch HSMusic websites.user.js
+++ b/userstuff/hsmusic/Switch HSMusic websites.user.js
@@ -59,12 +59,12 @@ customNavLink('L', 'http://localhost:8002');
 customNavLink('P', 'https://preview.hsmusic.wiki');
 customNavLink('R', 'https://hsmusic.wiki');
 
-let match = location.href.match(/album\/([^/]*)/);
+let match = location.href.match(/\/album\/([^/]*)/);
 if (match) {
     customNavLink('G', () => `https://github.com/hsmusic/hsmusic-data/tree/preview/album/${match[1]}.yaml`);
 }
 
-match = location.href.match(/track\/([^/]*)/);
+match = location.href.match(/\/track\/([^/]*)/);
 if (match) {
     const directory = getComputedStyle(document.body).getPropertyValue('--album-directory');
     customNavLink('G', () => `https://github.com/hsmusic/hsmusic-data/tree/preview/album/${directory}.yaml`);