zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
20.22k stars 631 forks source link

_zellij:12: command not found: _arguments for zsh shell zellij completions #3342

Open s4Dt0y opened 3 months ago

s4Dt0y commented 3 months ago

I am on the zsh shell, and I got an error when trying to add the zellij integration. The output of the command is attached below.

When I put this into a file and sourced it from my zshrc, everything works, but I get this output at shell startup:

_zellij:12: command not found: _arguments

I can see the _argument calls that the dotfile makes, but everything still works...what is going wrong here?

zellij-completions.txt

I am on Mac Sonoma and use Wezterm.

cristiand391 commented 3 months ago

The completions attached are generated by zellij setup --generate-completion zsh which outputs a zsh completion function for zellij. These aren't like other shell scripts that you source in your zshrc, you need to save this to a file (_zellij) and put it in your $fpath var so that zsh can find and load it when you type zellij <TAB>.

Check: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#telling-zsh-which-function-to-use-for-completing-a-command

cristiand391 commented 3 months ago

related issue:

you can see the lines below _zellij "$@" are usual shell functions but these shouldn't be in the same file (see https://github.com/zellij-org/zellij/issues/1933).

What I do is generate this file by running zellij setup --generate-completion zsh, save it to a file move all the functions below _zellij "$@" to my zshrc (these aren't completion functions).

s4Dt0y commented 3 months ago

I see...perhaps the guide could use an edit? It says to append them to my shells config file, which leads me to think that I need to source it from my .zshrc.