How to use argcomplete in zsh?

I use argcompleteto complete Tabin Bash.

argcompleteoffers global completion for bash, but not for zsh.

I would like to create a file ~/.zsh_completionto contain the finished files. This file should generate autocomplete for these files if it is obtained from ~/.zshrc.

How to do it?

+4
source share
1 answer

Well, there is a way to do this, but that’s not how I really wanted to.

Anyway, here goes:

  • Install argcomplete:

    $ pip install argcomplete
    
  • Activate argcompolete:

    $ activate-global-python-argcomplete --user
    
  • Add this to ~/.zshrc:

    autoload bashcompinit
    bashcompinit
    source ~/.bash_completion.d/python-argcomplete.sh
    
    eval "$(register-python-argcomplete /path/to/the/to/be/completed/file1)"
    eval "$(register-python-argcomplete /path/to/the/to/be/completed/file2)"
    eval "$(register-python-argcomplete /path/to/the/to/be/completed/file3)"
    

    There is probably a solution for reading finished files from another file, but I do not know how to do this.

+2

All Articles