Add zellij attach helper
This commit is contained in:
parent
bf741014c2
commit
0eb7102c7e
@ -3,6 +3,21 @@ if (( $+commands[zellij] )); then
|
||||
ZELLIJ_AUTO_ATTACH=true
|
||||
eval "$(zellij setup --generate-auto-start zsh)"
|
||||
|
||||
|
||||
if (( $+commands[sk] )); then
|
||||
za() {
|
||||
local zj_sessions=$(zellij list-sessions)
|
||||
local no_sessions=$(echo "${zj_sessions}" | wc -l)
|
||||
|
||||
if [ "${no_sessions}" -ge 2 ]; then
|
||||
zellij attach \
|
||||
"$(echo "${zj_sessions}" | sk)"
|
||||
else
|
||||
zellij attach -c
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
ide() {
|
||||
local layout="${ZELLIJ_LAYOUT:-${HOME}/.config/zellij/layouts/project.kdl}"
|
||||
local name="${PWD##*/}"
|
||||
@ -12,7 +27,7 @@ if (( $+commands[zellij] )); then
|
||||
# FIXME: https://github.com/zellij-org/zellij/issues/2299
|
||||
zellij action new-tab --layout "${layout}" --cwd "${PWD}" --name "${name}"
|
||||
else
|
||||
zellij --layout "${layout}" $@
|
||||
zellij --layout "${layout}" --session "${name}"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user