aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tmux/.local
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-09-18 18:47:16 -0500
committerToby Vincent <tobyv13@gmail.com>2022-09-18 18:47:16 -0500
commitae7b80615c604bd1f49c5143bd933bffb672241c (patch)
tree2b5ea14a3a4739c2ad11d7d9a54bebe359ef04d2 /tmux/.local
parent6ac3592217f2a1cdfe27d07c541d0cc99805daa4 (diff)
feat(tmux): improve sessionizer preview
Diffstat (limited to 'tmux/.local')
-rwxr-xr-xtmux/.local/bin/tmux-sessionizer11
1 files changed, 7 insertions, 4 deletions
diff --git a/tmux/.local/bin/tmux-sessionizer b/tmux/.local/bin/tmux-sessionizer
index 87ad760..e23cac8 100755
--- a/tmux/.local/bin/tmux-sessionizer
+++ b/tmux/.local/bin/tmux-sessionizer
@@ -25,11 +25,14 @@ else
stat -c %Y:"$path" "$path"
fi' | sort -r | cut -d':' -f2)"
- output="$(printf %s\\n "$DIRS" |
- fzf-tmux -p -- --print-query -d/ --with-nth -2.. --preview="$FZF_PREVIEW_COMMAND {}" |
+ output="$(printf %s\\n "$DIRS" | fzf-tmux -p -- --print-query -d/ --with-nth -2.. \
+ --preview="$FZF_PREVIEW_COMMAND ||
+ printf 'Create new project:\n %s' {q} |
+ sed 's|^ \([^/~][^/]*\)\$| $HOME/\1|' |
+ sed 's/^ //'" |
tr -s '\n' ':')"
- query="$(printf %s\\n "$output" | cut -d':' -f1)"
+ query="$(printf %s\\n "$output" | cut -d':' -f1 | sed "s|^\(..*\)\$|$HOME/\1|")"
selection="$(printf %s\\n "$output" | cut -d':' -f2)"
path="${selection:-$query}"
@@ -38,7 +41,7 @@ fi
if [ -z "$path" ]; then
exit 0
elif [ ! -d "$path" ]; then
- mkdir -p "$1"
+ mkdir -p "$path"
fi
name=$(basename "$path" | tr . _)