Shorten directory paths
All checks were successful
/ check (push) Successful in 1m34s

This commit is contained in:
Oliver Davies 2025-07-15 09:49:11 +01:00
parent e3caa91477
commit 722a5814fa
2 changed files with 25 additions and 0 deletions

View file

@ -31,5 +31,7 @@ stdenv.mkDerivation {
sha256 = "sha256-AtaOlV2JSeR0BmDsfuv8ZFbu5G0vz4RdUPY4ZF4UqQc=";
url = "https://patch-diff.githubusercontent.com/raw/ThePrimeagen/tmux-sessionizer/pull/23.patch";
})
./shorten-paths.patch
];
}

View file

@ -0,0 +1,23 @@
diff --git a/tmux-sessionizer b/tmux-sessionizer
index 036d2a3..cd11500 100755
--- a/tmux-sessionizer
+++ b/tmux-sessionizer
@@ -252,7 +252,7 @@ find_dirs() {
if [[ -d "$path" ]]; then
while IFS= read -r dir; do
dir_list+=("$dir")
- done < <(find "$path" -mindepth 1 -maxdepth "$depth" -path '*/.git' -prune -o -type d -print)
+ done < <(find "$path" -mindepth 1 -maxdepth "$depth" -path '*/.git' -prune -o -type d -print | sed "s#$HOME/##" )
fi
done
@@ -341,6 +341,9 @@ fi
if [[ "$selected" =~ ^\[TMUX\]\ (.+)$ ]]; then
selected="${BASH_REMATCH[1]}"
+else
+ # Re-add the Home directory back to the selected path.
+ selected="$HOME/$selected"
fi
selected_name=$(basename "$selected" | tr . _)