commit 1a368194c6979a7a17371e13b5182b0017cf8766 (patch)
parent 8a18ad8088e61b139feea6bcb893cd3a1710582c
Author: Alex Karle <alex@alexkarle.com>
Date: Fri, 25 Feb 2022 23:13:39 -0500
tmux: Add hotkeys to search for plumb-able content
This was something I did (rather poorly) in my old config. Where
the old config used some hack of "begin-selection", "search-forward",
etc to highlight the URL... I realized I can just search via regex!
In addition, I don't need to bind the H key both to the prefix and
in copy mode, I can use n/N once I make the first search.
TL;DR: it's another example of the rewrite being cleaner.
AND, while last time the only action was to copy it so I could reuse
it (either immediately in the browser pasting the URL or by using
prefix-] to paste), the plumb(1) command makes it super slick to
pop open a new split!
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/.tmux.conf b/.tmux.conf
@@ -26,6 +26,12 @@ bind-key C-l select-pane -R
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind-key -T copy-mode-vi v send-keys -X begin-selection
+# hotkeys to search for plumb-able content
+bind-key H copy-mode \; send-keys -X search-backward "http[^ ]*"
+bind-key S copy-mode \; send-keys -X search-backward "[a-f0-9]{6,40}"
+bind-key F copy-mode \; send-keys -X search-backward "[^ :]*:[^ ]*"
+bind-key P copy-mode \; send-keys -X search-backward "[^ :@#]*/[^:@# ]*"
+
# Use | and - for more intuitive splits (in the same location!)
bind-key | split-window -c "#{pane_current_path}" -h
bind-key - split-window -c "#{pane_current_path}" -v
@@ -43,5 +49,4 @@ set-option -g message-style bg=#EAFFFF,fg=#000000
set-option -g mode-style bg=#EEEE9E,fg=#000000
set-option -g copy-mode-match-style bg=#EEEE9E,fg=#000000
set-option -g copy-mode-mark-style bg=#EEEE9E,fg=#000000
-set-option -g copy-mode-current-match-style bg=#EAFFEA,fg=#000000
-
+set-option -g copy-mode-current-match-style bg=#6aa7a8,fg=#000000