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, 2016 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.
    – dza
    Dec 29, 2016 at 14:18

1 Answer 1


enable magicequalsubst

setopt magicequalsubst

  • Not enough for this case. Does it work with example above for you?
    – dza
    Dec 29, 2016 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, 2016 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.
    – dza
    Dec 29, 2016 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.
    – dza
    Dec 29, 2016 at 15:10
  • I must have missed something.. Works now.
    – dza
    Dec 29, 2016 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .