dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 685a74b777544c45b397f776ad15475a1077e728 (patch)
parent 1c4ac443935a0b06d77b184f3492ecdd3cecec8c
Author: Alex Karle <alex@alexkarle.com>
Date:   Sun, 27 Feb 2022 16:57:20 -0500

plumb: Handle directories and files differently

Plus, tilde expansion using awk!

Diffstat:
Mbin/plumb | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bin/plumb b/bin/plumb @@ -31,12 +31,18 @@ tmuxdo() { # only accept first argument (by whitespace) read ITEM -ITEM=$(echo "$ITEM" | awk '{ print $1 }') +ITEM=$(echo "$ITEM" | awk '{ sub("^~", ENVIRON["HOME"], $1); print $1 }') 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\"" ;; - *) tmuxdo "vi $ITEM" ;; + *) + if [ -d "$ITEM" ]; then + tmuxdo "cd $ITEM && $SHELL" + elif [ -e "$ITEM" ]; then + tmuxdo "vi $ITEM" + fi + ;; esac