On 14 July 2015 at 08:42, Martin Vaeth mar...@mvath.de wrote:
Alon Bar-Lev alo...@gentoo.org wrote:
Only issue I could not find a solution to is tab completion after '=',
for example:
xxx --file=TAB
This will not complete files, while it will be nice if it does.
For standard commands, it works as it should. For instance,
tar --file=TAB
chmod --reference=TAB
dd if=TAB
all work as excpected. For your own custom-commands, it is usually the
best idea to write your own _custom-command completion file for _zsh
where you can specify the options and their arguments (and how the
option arguments can look like, e.g. whether = is acceptable
as an option-argument separator) in detail.
For instance, gentoo-zsh-completion does this for most commands of
gentoo projects, others like eix bring their own completion files.
If you don't, you do not get completion for options but only the
generic completion of filenames (in which case = has no magic
meaning, of course).
I do not want to write completion for every command out there.
There is magic_equal_subst option which enables that but also cause
harm when using = in other places such as:
That's exactly the purpose of magic_equal_subst:
To support it for *all* arguments everywhere.
no, it also has side unwanted side effects that have nothing to do
with completion. I gave the example of:
echo xxx==cat
I did not press tab and it completes...
Usually there is no point to specify this globally.
yes there is, most commands that have no specific completion will
enjoy --xxx=TAB to complete a file name.
You can of course set it locally in a specific completion function,
in which you want it (although other completion helper functions
like _arguments are usually sufficient to treat = correctly).
how? can you give an example?
Is there any sequence to enable completion after space without
effecting the entire interpreter?
After space? I suppose the question you meant is answered above.
I was confused, after '=', and I am afraid I do not have an answer.
Thanks for your answer!
Alon