How to omit file extension from zsh autocomplete? I'm new to zsh in Catalina. In .zshrc, I currently have

setopt CORRECT
setopt CORRECT_ALL


When I run a java program from the command line, I want only:

% java ProgramName


If I type java Pro autocomplete adds the rest of the name but also appends .class. (Or, if I have the source file in the same directory, it appends the . after the name) and I then have to delete .class (or hit the backspace once) before I can run the program.

Is there a way to get zsh autocomplete to omit .class (and .) but only when the initial command is java?

I'd prefer not to install something like Oh My Zsh which might alter my other zsh settings.
It appears you are still using Zsh's legacy completion system. You can upgrade to &quot;new&quot; completion system (released back in the year 2000) by adding this to your .zshrc file:
autoload -Uz compinit
compinit

Then you'll see that Zsh's java completion will no longer add .class.