Shorten and sort directory paths
This commit is contained in:
parent
a50ea1d336
commit
3b7af684c0
3 changed files with 38 additions and 0 deletions
|
@ -26,6 +26,9 @@ stdenv.mkDerivation {
|
||||||
url = "https://patch-diff.githubusercontent.com/raw/ThePrimeagen/tmux-sessionizer/pull/2.patch";
|
url = "https://patch-diff.githubusercontent.com/raw/ThePrimeagen/tmux-sessionizer/pull/2.patch";
|
||||||
sha256 = "sha256-4/4rzve49T3FHnl9WWUPJVcb0NQojMQjIVnEZGwVAsY=";
|
sha256 = "sha256-4/4rzve49T3FHnl9WWUPJVcb0NQojMQjIVnEZGwVAsY=";
|
||||||
})
|
})
|
||||||
|
|
||||||
|
./shorten-suggested-paths.patch
|
||||||
|
./sort-suggestions.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
22
pkgs/tmux-sessionizer/shorten-suggested-paths.patch
Normal file
22
pkgs/tmux-sessionizer/shorten-suggested-paths.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
diff --git a/tmux-sessionizer b/tmux-sessionizer
|
||||||
|
index 8fa4153..3e607d7 100755
|
||||||
|
--- a/tmux-sessionizer
|
||||||
|
+++ b/tmux-sessionizer
|
||||||
|
@@ -22,13 +22,16 @@ hydrate() {
|
||||||
|
if [[ $# -eq 1 ]]; then
|
||||||
|
selected=$1
|
||||||
|
else
|
||||||
|
- selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | fzf)
|
||||||
|
+ selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | sed "s|$HOME/||" | fzf)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $selected ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
+# Add Home path back.
|
||||||
|
+selected="$HOME/$selected"
|
||||||
|
+
|
||||||
|
selected_name=$(basename "$selected" | tr . _)
|
||||||
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
13
pkgs/tmux-sessionizer/sort-suggestions.patch
Normal file
13
pkgs/tmux-sessionizer/sort-suggestions.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/tmux-sessionizer b/tmux-sessionizer
|
||||||
|
index 3e607d7..27729b1 100755
|
||||||
|
--- a/tmux-sessionizer
|
||||||
|
+++ b/tmux-sessionizer
|
||||||
|
@@ -22,7 +22,7 @@ hydrate() {
|
||||||
|
if [[ $# -eq 1 ]]; then
|
||||||
|
selected=$1
|
||||||
|
else
|
||||||
|
- selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | sed "s|$HOME/||" | fzf)
|
||||||
|
+ selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | sed "s|$HOME/||" | sort | fzf)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $selected ]]; then
|
Loading…
Add table
Add a link
Reference in a new issue