33 lines
818 B
Bash
33 lines
818 B
Bash
# zellij
|
|
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="${PROJECT_NAME:-/}"
|
|
|
|
if (( ${+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}" --session "${name}"
|
|
fi
|
|
}
|
|
fi
|