Open cyruseuros opened 7 months ago
I asked Claud to translate the comp.fish to zsh and I got this
# Function to list sessions
_zellij_list_sessions() {
zellij list-sessions --short --no-formatting 2>/dev/null
}
# Function to list aliases
_zellij_list_aliases() {
zellij list-aliases 2>/dev/null
}
# Zellij completions
_zellij() {
local state
_arguments \
'1: :->command' \
'*: :->args'
case $state in
command)
_arguments '1:command:(attach a kill-session k setup)'
;;
args)
case ${words[2]} in
attach|a|kill-session|k)
_alternative 'sessions:session:($(_zellij_list_sessions))'
;;
setup)
_arguments '*:option:((--generate-completion\:"Generate shell completion" bash\:"Bash" elvish\:"Elvish" fish\:"Fish" zsh\:"Zsh" powershell\:"PowerShell"))'
;;
esac
;;
esac
}
compdef _zellij zellij
# Custom functions
zr() {
command zellij run --name "$1" -- zsh -c "$*"
}
zrf() {
command zellij run --name "$1" --floating -- zsh -c "$*"
}
zri() {
command zellij run --name "$1" --in-place -- zsh -c "$*"
}
ze() {
command zellij edit "$@"
}
zef() {
command zellij edit --floating "$@"
}
zei() {
command zellij edit --in-place "$@"
}
# zpipe function and its completions
zpipe() {
if (( $# > 0 )); then
command zellij pipe -p "$@"
else
command zellij pipe
fi
}
_zpipe() {
_alternative 'aliases:alias:($(_zellij_list_aliases))'
}
compdef _zpipe zpipe
this seem to work, but does make some of the stuff kind of ugly tho, and I dont know what it does
Exactly like in https://github.com/zellij-org/zellij/issues/1030 - personally I've never written any custom zsh completions so unfortunately I can't contribute here.