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

Re: _complete: insert unambiguous when globbing



Sorry for mailing this to @sunsite.dk - please reply using this
forward...

On Mon, Jan 03, 2022 at 13:39:03 +0100, Tomasz Pala wrote:

> I'm struggling with something which felt basic, yet I cannot find a
> valid solution (in any combination of remaining styles)...
> 
> mkdir empty
> cd empty
> touch 20{a,b,c,d}.x
> 
> ls 2[tab]	==> 20		this is expected
> ls 2*[tab]	!=> 20		how to make this to be expanded first to
> 
> "20", and then the regular rules to proceed (either menu complete I
> always use, or _expand)?
> 
> More advanced example:
> ls 2*x[tab]	?=> 20[completions]x
> 
> And the most advanced:
> ls 2*[tab]	?=> 20*.x	with the cursor placed after "*"
> 
> 
> In the most advanced form, the _completion expands "2*", finds out there
> is unambiguous "20" prefix and ".x" suffix and puts them into ZLE before
> performing completion (in my case, menu).
> 
> In other words, I want the globbing _complete to behave like non-globbing one.
> 
> 
> While the initial case is pointless (simply don't put the "*" at the
> end), I'd like to use it when looking for specific file types. I often
> look for logs in 2021.*.xz form and when there is too many matches I
> want to narrow them down, but I could simply type 2*z[tab] to have the
> same effect.

One more note - zsh knows where the first ambiguous character is, even
with globbing, as it's shown with show-ambiguity style.

The question remains: how to make it complete the common parts when
globbing.

-- 
Tomasz Pala <gotar@xxxxxxxxxxxxx>




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