romkatv / zsh4humans

A turnkey configuration for Zsh
MIT License
1.81k stars 116 forks source link

how to add maven autocompletion? #237

Closed atjshop closed 2 years ago

atjshop commented 2 years ago

maven by default only has autocompletion for 10 commands, is there a way to add all autocompletion for mvn in z4h?

romkatv commented 2 years ago
  1. What do you type prior to pressing Tab?
  2. Which completions are you being offered when you press Tab?
  3. Which completion that you would like to see is missing from the list?
  4. What is the output of the following command?
    () {
    emulate -L zsh -o xtrace -o err_return
    local comp=${_comps[mvn]}
    [[ -n $comp ]]
    autoload +X -Uz -- $comp || true
    : ${(D)functions_source[$comp]}
    }
atjshop commented 2 years ago

1) mvn space then tab 2) clean -- remove all files generated by the previous build compile -- compile the source code of the project test -- run tests using a suitable unit testing framework package -- take the compiled code and package it in its distributable format, such as a JAR integration-test -- process and deploy the package if necessary into an environment where integration tests can be run verify -- run any checks to verify the package is valid and meets quality criteria install -- install the package into the local repository, for use as a dependency in other projects locally deploy -- done in an integration or release environment, copies the final package to the remote repository site -- generates the projects site documentation site-deploy -- deploys the generated site documentation to the specified web server

3) something like here https://github.com/juven/maven-bash-completion 4) +(anon):2> local comp=_mvn +(anon):3> [[ -n _mvn ]] +(anon):4> autoload +X -Uz -- _mvn +(anon):4> true +(anon):5> : '~/.cache/zsh4humans/v5/zsh-completions/src/_mvn'

romkatv commented 2 years ago

+(anon):5> : '~/.cache/zsh4humans/v5/zsh-completions/src/_mvn'

This line is saying that completions for mvn come from https://github.com/zsh-users/zsh-completions/blob/master/src/_mvn. If you want them to be extended, consider filing a feature request against that project or sending a PR.

If you can find better completions for mvn somewhere on GitHub, I can modify zsh4humans to use them instead of what I linked above.

atjshop commented 2 years ago

Thanks. The better completions I can find is https://github.com/juven/maven-bash-completion.

romkatv commented 2 years ago

Have you tried it? How exactly did you load it? Can you confirm that it works better?