dotfiles/zsh.d/zellij.zsh
2025-04-23 09:44:36 -05:00

35 lines
757 B
Bash

# zellij
if (( $+commands[zellij] )); then
# Uncomment to start/exit zellij automatically
# ZELLIJ_AUTO_ATTACH=true
# ZELLIJ_AUTO_EXIT=true
# eval "$(zellij setup --generate-auto-start zsh)"
if (( $+commands[sk] )); then
function za {
local zj_sessions=$(zellij list-sessions -ns)
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
# Name tabs after current working directory
if [[ -v ZELLIJ ]]; then
function zrt {
zellij action rename-tab "${PWD##*/}"
}
function znt {
zellij action new-tab
}
chpwd_functions+=( zrt )
fi
fi