* Completion: setting up _approximate.
@ 2017-07-07 9:17 Kamil
2017-07-08 21:24 ` Bart Schaefer
0 siblings, 1 reply; 9+ messages in thread
From: Kamil @ 2017-07-07 9:17 UTC (permalink / raw)
To: zsh-users
Hi there,
I am trying to get following string in zle:
/v/m/s/f/3
completed to:
/Volumes/Media/Series/Fargo/Season\ 03
by pressing tab.
What I am getting instead is:
── corrections (errors: 1) ──
Season\ 01/ Season\ 02/ Season\ 03/
── original ──
/v/m/s/f/3
with Season\ 01 being selected.
Interestingly when change PWD to /Volumes/Media/Series/Fargo and type
./3<tab> it completes nicely to ./Season\ 03.
When I type /v/m/s/f/*3<tab> (note *) zle gets cleared instead.
I was trying to configure matcher-list but couldn't figure out how to
make that work.
My setup:
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*' matcher-list \
'' \
'm:{a-z\-}={A-Z\_}' \
'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
'r:[[:ascii:]]||[[:ascii:]]=** r:|=* m:{a-z\-}={A-Z\_}'
I am not sure if anything else from my configuration is relevant. I have
AUTO_CD set and it's the same for with and without cd.
--
Kamil
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-07 9:17 Completion: setting up _approximate Kamil
@ 2017-07-08 21:24 ` Bart Schaefer
2017-07-09 4:30 ` Kamil
2017-07-09 11:11 ` Oliver Kiddle
0 siblings, 2 replies; 9+ messages in thread
From: Bart Schaefer @ 2017-07-08 21:24 UTC (permalink / raw)
To: Zsh Users
You haven't said what version of zsh you are using, that may be significant.
On Fri, Jul 7, 2017 at 2:17 AM, Kamil <crs@wafel.com> wrote:
>
> I am trying to get following string in zle:
>
> /v/m/s/f/3
>
> completed to:
>
> /Volumes/Media/Series/Fargo/Season\ 03
>
> What I am getting instead is:
>
> ── corrections (errors: 1) ──
> Season\ 01/ Season\ 02/ Season\ 03/
Those choices are obviously coming from _approximate, so the first
thing to try is to remove that from your completer style and see what
you get. _match should be doing nothing because there are no patterns
in your initial string, but both it and _approximate should be called
only when _complete returns nonzero.
Please confirm that you're completing this in command position, for
use with autocd.
> When I type /v/m/s/f/*3<tab> (note *) zle gets cleared instead.
Yes, that's a known issue when the ambiguity occurs too early in the
string; completion is attempting to restrict the view only to the
shortest common prefix, but sometimes that's empty and the effect is
to erase everything.
> I was trying to configure matcher-list but couldn't figure out how to
> make that work.
There's nothing inherently wrong with the matcher-list that you showed us.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-08 21:24 ` Bart Schaefer
@ 2017-07-09 4:30 ` Kamil
2017-07-09 16:47 ` Bart Schaefer
2017-07-09 11:11 ` Oliver Kiddle
1 sibling, 1 reply; 9+ messages in thread
From: Kamil @ 2017-07-09 4:30 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh Users
On 08/07/17 14:24, Bart Schaefer wrote:
> You haven't said what version of zsh you are using, that may be
> significant.
Hey Bart,
thanks for your response.
I am on zsh 5.3.1 (x86_64-apple-darwin16.6.0), as you can see this is on
Mac OS.
>> /v/m/s/f/3
>>
>> completed to:
>>
>> /Volumes/Media/Series/Fargo/Season\ 03
>>
>> What I am getting instead is:
Should have said that all but last parts are matched correctly: I get it
expanded to: /Volumes/Media/Series/Fargo/Season\ 01/ with menu printed.
> Those choices are obviously coming from _approximate, so the first
> thing to try is to remove that from your completer style and see what
> you get.
No matches found, when I remove _approximate from completer list.
(that's my format for warnings)
> _match should be doing nothing because there are no patterns in your
> initial string, but both it and _approximate should be called only
> when _complete returns nonzero.
I tried /v/m/s/f/S3, still completes to Season\ 01.
But /v/m/s/f/S*3 and /v/m/s/f/*3 works fine so I assume _match is doing
its job properly.
> Please confirm that you're completing this in command position, for
> use with autocd.
Correct, /v/m/s/f/3 is the only string in buffer. I also tried with cd
command, with same results.
>> I was trying to configure matcher-list but couldn't figure out how to
>> make that work.
> There's nothing inherently wrong with the matcher-list that you showed
> us.
Reverted to my previous:
zstyle ':completion:*' matcher-list \
'' \
'm:{a-zA-Z}={A-Za-z}' \
'r:|[._-]=* r:|=*' \
'l:|=* r:|=*'
as I was getting some issues with the other one. Just letting you know
in case it actually changes anything.
Thanks,
--
Kamil
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-08 21:24 ` Bart Schaefer
2017-07-09 4:30 ` Kamil
@ 2017-07-09 11:11 ` Oliver Kiddle
2017-07-09 12:08 ` Kamil
2017-07-09 16:32 ` Bart Schaefer
1 sibling, 2 replies; 9+ messages in thread
From: Oliver Kiddle @ 2017-07-09 11:11 UTC (permalink / raw)
To: Zsh Users
Bart wrote:
>
> > ── corrections (errors: 1) ──
> > Season\ 01/ Season\ 02/ Season\ 03/
>
> Those choices are obviously coming from _approximate, so the first
> thing to try is to remove that from your completer style and see what
In general if using _approximate, it is a good idea to exclude it from
matcher-list styles to avoid it being too agressive:
zstyle ':completion:*:(^approximate):*' matcher-list....
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-09 11:11 ` Oliver Kiddle
@ 2017-07-09 12:08 ` Kamil
2017-07-09 14:58 ` Daniel Shahaf
2017-07-09 16:32 ` Bart Schaefer
1 sibling, 1 reply; 9+ messages in thread
From: Kamil @ 2017-07-09 12:08 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: Zsh Users
On 09/07/17 13:11, Oliver Kiddle wrote:
> In general if using _approximate, it is a good idea to exclude it from
> matcher-list styles to avoid it being too agressive:
> zstyle ':completion:*:(^approximate):*' matcher-list....
Thank you. Added it to my zshrc, but it doesn't solve my original
problem.
--
Kamil
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-09 12:08 ` Kamil
@ 2017-07-09 14:58 ` Daniel Shahaf
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Shahaf @ 2017-07-09 14:58 UTC (permalink / raw)
To: Kamil; +Cc: Oliver Kiddle, Zsh Users
On Sun, Jul 09, 2017 at 03:08:20PM +0300, Kamil wrote:
> On 09/07/17 13:11, Oliver Kiddle wrote:
> > In general if using _approximate, it is a good idea to exclude it from
> > matcher-list styles to avoid it being too agressive:
>
> > zstyle ':completion:*:(^approximate):*' matcher-list....
>
> Thank you. Added it to my zshrc, but it doesn't solve my original
> problem.
Doesn't that need a few more colon-asterisk-colon sequences to ensure
that the «(^approximate)» pattern matches at the correct position?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-09 11:11 ` Oliver Kiddle
2017-07-09 12:08 ` Kamil
@ 2017-07-09 16:32 ` Bart Schaefer
1 sibling, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2017-07-09 16:32 UTC (permalink / raw)
To: Zsh Users
On Sun, Jul 9, 2017 at 4:11 AM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
>
> In general if using _approximate, it is a good idea to exclude it from
> matcher-list styles to avoid it being too agressive:
>
> zstyle ':completion:*:(^approximate):*' matcher-list....
It appears that _approximate itself skips all the matchers after the
first one -- I do not recall why this was done, but if your
matcher-list starts with empty string (for "keep exact matches") then
_approximate won't run amok. Anyone able to confirm this?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-09 4:30 ` Kamil
@ 2017-07-09 16:47 ` Bart Schaefer
2017-07-10 8:16 ` Kamil
0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2017-07-09 16:47 UTC (permalink / raw)
To: Kamil; +Cc: Zsh Users
On Sat, Jul 8, 2017 at 9:30 PM, Kamil <crs@wafel.com> wrote:
> On 08/07/17 14:24, Bart Schaefer wrote:
>> Those choices are obviously coming from _approximate, so the first
>> thing to try is to remove that from your completer style and see what
>> you get.
>
> No matches found, when I remove _approximate from completer list.
OK, so _path_files (called from _complete) is failing. What happens
if you leave off the trailing "3"?
I suspect the issue is that expanding /v/m/s/f/ uses only prefixes --
that is, only the first letter of each directory name is expanded to
the full name -- whereas 3 is a suffix, so you need something else to
do that final bit of matching. That would explain why "*3" works.
The way to find out is to use _complete_debug (bound to ctrl-x
question-mark by default) to get a call trace.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Completion: setting up _approximate.
2017-07-09 16:47 ` Bart Schaefer
@ 2017-07-10 8:16 ` Kamil
0 siblings, 0 replies; 9+ messages in thread
From: Kamil @ 2017-07-10 8:16 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh Users
On 09/07/17 09:47, Bart Schaefer wrote:
> OK, so _path_files (called from _complete) is failing. What happens
> if you leave off the trailing "3"?
It gets expanded to: /Volumes/Media/Series/Fargo/Season\ 0<cursor>
> I suspect the issue is that expanding /v/m/s/f/ uses only prefixes --
> that is, only the first letter of each directory name is expanded to
> the full name -- whereas 3 is a suffix, so you need something else to
> do that final bit of matching. That would explain why "*3" works.
Yeah, this is what I am after - avoid the need for * in last element.
3 in there is the only matching pattern.
> The way to find out is to use _complete_debug (bound to ctrl-x
> question-mark by default) to get a call trace.
Would you like me to paste it all here? It's 1.3M big and contain some
other data that I would rather not share in its entirety. Any particular
parts of it you would like to see?
--
Kamil
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-07-10 8:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07 9:17 Completion: setting up _approximate Kamil
2017-07-08 21:24 ` Bart Schaefer
2017-07-09 4:30 ` Kamil
2017-07-09 16:47 ` Bart Schaefer
2017-07-10 8:16 ` Kamil
2017-07-09 11:11 ` Oliver Kiddle
2017-07-09 12:08 ` Kamil
2017-07-09 14:58 ` Daniel Shahaf
2017-07-09 16:32 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).