1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 03:14:55 +02:00

adding scripts/zs

This commit is contained in:
Henrik Hautakoski 2024-08-25 16:08:19 +02:00
parent 8af67be13a
commit f087422bbf

20
scripts/zs Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
LAYOUT=code
if [[ $# -eq 1 ]]; then
selected=$(realpath $1)
else
DIRECTORIES=$(cat ~/.tmuxs | sed "s&^\~&${HOME}&g")
selected=$(find ${DIRECTORIES} -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
zellij --layout "$LAYOUT" \
attach -c "$selected_name" \
options --default-cwd "$selected"