dotfiles/zsh.d/zellij.zsh

34 lines
838 B
Bash
Raw Normal View History

# zellij
if (( $+commands[zellij] )); then
ZELLIJ_AUTO_ATTACH=true
eval "$(zellij setup --generate-auto-start zsh)"
2023-04-11 20:53:57 +00:00
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##*/}"
local name="${name:-/}"
if (( ${+ZELLIJ} )); then
# FIXME: https://github.com/zellij-org/zellij/issues/2299
zellij action new-tab --layout "${layout}" --cwd "${PWD}" --name "${name}"
else
2023-04-11 20:53:57 +00:00
zellij --layout "${layout}" --session "${name}"
fi
}
fi