commit e56de76462b03f7fa1e8b3ea6df19a8c2456270d (patch)
parent 685a74b777544c45b397f776ad15475a1077e728
Author: Alex Karle <alex@alexkarle.com>
Date: Sun, 27 Feb 2022 19:06:53 -0500
plumb: Add support for man(1) pages
Inspired by watching videos of the acme(1) plumber!
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/.tmux.conf b/.tmux.conf
@@ -33,6 +33,7 @@ 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 "^[^ :@#]*:[0-9]*:.*"
bind-key P copy-mode \; send-keys -X search-backward "[^ :@#]*/[^:@# ]*"
+bind-key M copy-mode \; send-keys -X search-backward "[^ :@#]*\\([1-9]\\)"
# bind G into git-grep word under cursor (use with F above)
bind-key G copy-mode \; send-keys -X select-word \; \
diff --git a/bin/plumb b/bin/plumb
@@ -37,7 +37,10 @@ case "$ITEM" in
http*) xdg-open "$ITEM" ;;
[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*) \
tmuxdo "git show $ITEM 2>&1 | less" ;;
- [a-zA-Z0-9.]*:[0-9]*:*) tmuxdo "fned \"$ITEM\"" ;;
+ [a-zA-Z0-9._-]*:[0-9]*:*) tmuxdo "fned \"$ITEM\"" ;;
+ [a-zA-Z0-9._-]*\([1-9]\))
+ PAGE=${ITEM%%\([1-9]\)}
+ tmuxdo "man \"$PAGE\"" ;;
*)
if [ -d "$ITEM" ]; then
tmuxdo "cd $ITEM && $SHELL"