Re: [gentoo-user] Re: zsh: not so bad?

2015-07-14 Thread Alon Bar-Lev
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



Re: [gentoo-user] Re: zsh: not so bad?

2015-07-14 Thread Emanuele Rusconi
On 14 July 2015 at 09:50, Alon Bar-Lev alo...@gentoo.org wrote:
 On 14 July 2015 at 10:47, Emanuele Rusconi ema...@gmail.com wrote:
 In my setup (borrowed from grml, which has an AWESOME zsh setup), ^xf
 (ctrl-x f) is bound to insert-files and completes file names,
 regardless of other completion rules
 for the command I'm typing.

 -- Emanuele Rusconi


 Great! will check it out.
 Command please? (for these that are new for zsh).

The grml's setup uses a custom function bind2maps:

bind2maps emacs viins   -- -s ^xf insert-files

I think the regular commands would be like:

bindkey -M emacs -s ^xf insert-files
bindkey -M viins -s ^xf insert-files



Re: [gentoo-user] Re: zsh: not so bad?

2015-07-14 Thread Alon Bar-Lev
On 14 July 2015 at 10:47, Emanuele Rusconi ema...@gmail.com wrote:
 In my setup (borrowed from grml, which has an AWESOME zsh setup), ^xf
 (ctrl-x f) is bound to insert-files and completes file names,
 regardless of other completion rules
 for the command I'm typing.

 -- Emanuele Rusconi


Great! will check it out.
Command please? (for these that are new for zsh).



Re: [gentoo-user] Re: zsh: not so bad?

2015-07-14 Thread Emanuele Rusconi
In my setup (borrowed from grml, which has an AWESOME zsh setup), ^xf
(ctrl-x f) is bound to insert-files and completes file names,
regardless of other completion rules
for the command I'm typing.

-- Emanuele Rusconi