Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh completion configuration

On Feb 26,  7:41pm, joe M wrote:
} > And then install it for the context:
} >
} >     compdef _history_or_autocd -command-
} I do not understand the "install" process. Is it good enough to have
} the function file (_history_or_autocd) anywhere in the $fpath? Or,
} does it have to be after the directory with _autocd?

Sorry, I wrote that as if you were going to put it in ~/.zshrc.  To put
it in a file by itself, it has to be in a directory in $fpath that is
listed BEFORE the directory containing _autocd, and the file should look

    #compdef -command-
    local ret=$?
    _autocd || return ret

(without the indentation, of course).

} I added this "zstyle ':completion::complete:-command-:*'
} _history_or_autocd" to my zshrc

No, you don't need that.  Either the compdef command in ~/.zshrc, or the
file formatted as above with #compdef, is all that's necessary.

} Just a rehash did not do the job. Any thoughts, please?

Rehash doesn't reload functions, nor does it reset completion definitions
(the _comps variable).  To install just the one function, use compdef as
a command.  To reload the entire completion system, delete ~/.zcompdump
and run "compinit" (which has the effect of executing a whole bunch of
"compdef" commands computed from the #compdef lines).

Barton E. Schaefer

Messages sorted by: Reverse Date, Date, Thread, Author