3

I have a function that is basically a wrapper around a tmux subcommand:

function tma() {
        tmux attach-session -t $1 || tmux new-session -s $1
}

I would like zsh to autocomplete with any open sessions that may exists as it currently does if I type tmux attach-session -t and start tabbing. I've tried

compdef tma=tmux

which understandably tries to autocomplete to tmux subcommands and

compdef tma=tmux attach-session -t

which gives the error message compdef: unknown command or service: tmux attach-session -t.

Is this possible?

  • 2
    Note that `tmux new-session -A -s "$1"` does the same thing as your function. – chepner Apr 25 '18 at 18:29
  • (Although it looks like the `tmux` autocompletion needs to be updated to allow completion the argument to `-s` in this case.) – chepner Apr 25 '18 at 18:32

0 Answers0