2

It's possible to make ZSH extends bash autocompletion? Bash can autocomplete almost every command in the system, and in ZSH i always need to enable a plugin for it.

Here is an example (ignore the warnings, are from custom scripts that don't work in bash)

Bash autocompletion

1 Answer 1

1

java's --version option seems to be undocumented. The documented one is -version. Try java -v<Tab>.

java --v<Tab> should also suggest -version if you enabled approximation/corrections in the completion configuration:

 $ java --vTab Completing corrections -verbose:class -verbose -- print class information -verbose:gc -- print gc information -verbose:jni -- print JNI information -version -- print version 

See compinstall for an easy way to configure it.

See info zsh bashcompinit for how to use bash completion functions within zsh, but note that bash completions are generally inferior to zsh ones. You'd only want to use it for the cases where completers have been written for bash but not zsh.

4
  • the java -v was just an example. Most of the commands don't autocomplete in ZSH, except the ones i enable the plugin. In bash, almost every command automatically suggests autocompletions, i wanted this behavior in ZSH. Commented Sep 25, 2020 at 18:29
  • @Maxwells.c, you may want to provide with a real example that exhibits the problem. zsh programmed completion predates bash's by decades. bash doesn't come with completers, you generally get them either from the bash-completion project or sometimes shipped alongside the commands they're meant to complete. Commented Sep 25, 2020 at 18:58
  • i couldn't find one now. Before, some common ones such as apt and snap didn't work, but i think the bashcompinit may did the trick. Commented Sep 25, 2020 at 19:21
  • 1
    @Maxwells.c, completers for Debian apt-* commands were added to zsh in 1999 and for the newer Debian apt command in 2014. Both a bash and zsh completer for Ubuntu snap are supplied by Ubuntu as part of the snapd package. See dpkg -L snapd | grep complet Commented Sep 26, 2020 at 7:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.