Can I enable zsh to complete path/filenames in a shell argument such as

command -file=/

I do get path/filename completion when I do file=/<TAB> without a dash

This is possible at least on Debian with bash completion is it possible with zsh?

  • 1
    The reason that you're going to wonder why you see different results to answerers is that you haven't told people the true spelling of command. Autocompletion of arguments can be variable by command. – JdeBP Dec 29 '16 at 14:15
  • What I want is file/path completion regardless of the command. I discovered this while running "ant -Declipse.home=/usr/local/eclipse" that won't complete. But others won't as well so I want it not only for ant but for every command or argument with a slash in it. – dezza Dec 29 '16 at 14:18

enable magicequalsubst

setopt magicequalsubst

  • Not enough for this case. Does it work with example above for you? – dezza Dec 29 '16 at 13:48
  • 1
    yes, and it also works in zsh -f -> autoload -Uz compinit; compinit; setopt magicequalsubst. a completer for an command could possibly mess that up but since your example is command, who knows. – llua Dec 29 '16 at 13:58
  • I type zsh -f initialize a new clean shell and pop autoload -Uz compinit; compinit; setopt magicequalsubst but command -file=/<TAB> won't complete. – dezza Dec 29 '16 at 14:05
  • zsh.sourceforge.net/Doc/Release/… I find that if I unsetopt alwayslastprompt it does what I want after reading: zsh.org/mla/users/2005/msg00895.html but also breaks/disables menu completion. – dezza Dec 29 '16 at 15:10
  • I must have missed something.. Works now. – dezza Dec 29 '16 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.