* zsh completer _approximate completer
@ 2013-02-28 6:27 joe M
2013-02-28 6:42 ` joe M
0 siblings, 1 reply; 9+ messages in thread
From: joe M @ 2013-02-28 6:27 UTC (permalink / raw)
To: zsh-workers
Hello,
I notice that the _approximate completer does not respect the group
order. I want it to show the original on top of the corrections list
and specified it with:
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:approximate:*' group-order original corrections
# '-e' is needed to get the argument evaluated each time this is called
# this argument to max-errors allows one error in 10 characters.
# And if you want the number of errors allowed by
# _approximate to increase with the length of what
# you have typed so far:
zstyle -e ':completion:*:approximate:*' \
max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
----------------------------------
test sample output:
g test 01-colors.zsh
-- { g test *. } --
-- corrections (errors: 1) --
01-colors.zsh 40-completion.zsh
all_opts todo
01-prezto-helper.zsh 40-completion.zsh.original
all_opts_bang todo.txt
05-appearance.unused_zsh 40-directory.zsh
bart.theme trapd00r.theme
06-zex.zsh-does-not-work 50-bindkeys.zsh
colorize* zex-zsh/
10-syntax.zsh.trapd00r 50-functions.zsh
colorize.c zprofile.20110925
20-abbrevations.zsh 60-git.zsh
compdef/ zprofile.20120319
20-bookmarks.zsh 70-autojump.zsh
compdef.disable/ zprofile.20130124
20-exports.zsh 70-simpleprompt.zsh
.git/ zprofile.latest
20-history.zsh 90-syntax.zsh
.gitignore zprofile.root
20-setopts.zsh 90-syntax.zsh.zsh-syntax-highlighting
history_words_to_commands.patch zprofile.simple
40-alias-global.zsh 91-history-substring-search.zsh
mikachu-dot-zshrc zsh_history.joe
40-alias-suffix.zsh 92-auto-fu.zsh
prezto/ zshrc
40-alias.zsh 99-startup.zsh
start-zsh-with-cmd.exp*
-- original --
*.
Is this expected behaviour?
Thanks
Joe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-02-28 6:27 zsh completer _approximate completer joe M
@ 2013-02-28 6:42 ` joe M
2013-02-28 9:00 ` Oliver Kiddle
2013-02-28 9:30 ` Oliver Kiddle
0 siblings, 2 replies; 9+ messages in thread
From: joe M @ 2013-02-28 6:42 UTC (permalink / raw)
To: zsh-workers
Hello,
For some reason, changing the group-order of this zstyle put the
original before the corrections in the _appropriate completer.
zstyle ':completion:*' group-order original 'named-directories'
'directory-stack' 'local-directories' 'path-directories'
> zstyle ':completion:*:approximate:*' group-order original corrections
Shouldn't this be the better or more accurate method of specifying
group-order for the _approximate completer instead?
Thanks
Joe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-02-28 6:42 ` joe M
@ 2013-02-28 9:00 ` Oliver Kiddle
2013-02-28 9:30 ` Oliver Kiddle
1 sibling, 0 replies; 9+ messages in thread
From: Oliver Kiddle @ 2013-02-28 9:00 UTC (permalink / raw)
To: joe M; +Cc: zsh-workers
joe M wrote:
> For some reason, changing the group-order of this zstyle put the
> original before the corrections in the _appropriate completer.
>
> zstyle ':completion:*' group-order original 'named-directories'
> 'directory-stack' 'local-directories' 'path-directories'
>
> > zstyle ':completion:*:approximate:*' group-order original corrections
> Shouldn't this be the better or more accurate method of specifying
> group-order for the _approximate completer instead?
It is a more specific style pattern so would take precedence over the
general one but for the fact that the pattern doesn't actually match.
For _approximate, the number of corrections is included in the style
when it is looked up so for 1 error, it has :approximate-1:.
Try adding an extra * in:
zstyle ':completion:*:approximate*:*' group-order original corrections
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-02-28 6:42 ` joe M
2013-02-28 9:00 ` Oliver Kiddle
@ 2013-02-28 9:30 ` Oliver Kiddle
2013-03-01 19:30 ` joe M
1 sibling, 1 reply; 9+ messages in thread
From: Oliver Kiddle @ 2013-02-28 9:30 UTC (permalink / raw)
To: joe M; +Cc: zsh-workers
Sorry, ignore my last e-mail as I was wrong, again.
It seems that in the course of completion, the style is looked
up three times:
+_tags:31> zstyle -a :completion::complete:cd:: group-order order
+_tags:31> zstyle -a :completion::approximate::: group-order order
+_tags:31> zstyle -a :completion::approximate-1:cd:: group-order order
The first one would match ':completion:*' and so the group-order from
that style applies regardless of no matches being generated for that
context. The later group-orders are not completely ignored and it seems
they would be meaningful if they concerned a different set of groups.
I'm assuming they get ignored because they contradict the previous group
ordering.
This makes sense when you consider that a group-order is something that
can't be applied for specific matches: there is one ordering for all
matches. Perhaps a group-order from a tag loop where no matches are
actually generated should be thrown away.
So in conclusion, don't set group-order with a general style.
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-02-28 9:30 ` Oliver Kiddle
@ 2013-03-01 19:30 ` joe M
2013-03-01 19:38 ` joe M
0 siblings, 1 reply; 9+ messages in thread
From: joe M @ 2013-03-01 19:30 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Hello
> I'm assuming they get ignored because they contradict the previous group
> ordering.
>
> This makes sense when you consider that a group-order is something that
> can't be applied for specific matches: there is one ordering for all
> matches. Perhaps a group-order from a tag loop where no matches are
> actually generated should be thrown away.
>
> So in conclusion, don't set group-order with a general style.
I removed the group-order from the general style and am trying to set
it at a more specific context.
zstyle -L
zstyle -L
zstyle ':completion:*:options' auto-description %d
zstyle ':completion::complete:*' cache-path /home/j/var/zsh/zcompcache
zstyle ':completion:hist-complete:*' completer _history
zstyle ':completion:*:options' description yes
zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'
zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'
zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
zstyle ':completion:*' format ' %F{yellow}-- %d --%f'
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=*
r:|=*' 'l:|=* r:|=*'
zstyle ':completion:predict:*' menu yes
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' show-completer true
zstyle ':completion::complete:*' use-cache on
zstyle ':completion:*' use-compctl false
zstyle :predict verbose true
zstyle ':completion:*' verbose yes
--(~/etc/zsh)-------------------------------------------------------------------------------------------------------------------(pts/3@master)--
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' completer _expand _complete _ignored _approximate
--(~/etc/zsh)-------------------------------------------------------------------------------------------------------------------(pts/3@master)--
zstyle ':completion::expand:*' group-order original expansions all-expansions
zstyle ':completion::expand:*' group-order original expansions all-expansions
--(~/etc/zsh)-------------------------------------------------------------------------------------------------------------------(pts/3@master)--
grep test *
-- expansions --
01-colors.zsh 01-prezto-helper.zsh
05-appearance.unused_zsh 06-zex.zsh-does-not-work
10-syntax.zsh.trapd00r 20-abbrevations.zsh 20-bookmarks.zsh
20-exports.zsh
20-history.zsh 20-setopts.zsh
39-completion-skeleton.zsh 40-alias-global.zsh
40-alias-ls.zsh 40-alias-suffix.zsh 40-alias.zsh
40-completion.zsh
40-completion.zsh.20130228 40-completion.zsh.20130301
40-completion.zsh.original 40-directory.zsh
50-bindkeys.zsh 50-functions.zsh 60-git.zsh
70-autojump.zsh
70-simpleprompt.zsh 90-syntax.zsh
90-syntax.zsh.zsh-syntax-highlighting
91-history-substring-search.zsh 92-auto-fu.zsh.disable
99-startup.zsh all_opts all_opts_bang
bart.theme colorize colorize.c
compdef
compdef.disable .git .gitignore
history_words_to_commands.patch
mikachu-dot-zshrc prezto
start-zsh-with-cmd.exp todo
todo.txt trapd00r.theme zex-zsh
zprofile.20110925
zprofile.20120319 zprofile.20130124
zprofile.latest zprofile.root
zprofile.simple zsh_history.joe zshrc
--(~/etc/zsh)----------------------------------------------------------------------------------------------------------------------(pts/3@master)--
grep test *
tags in context :completion::expand:::
all-expansions expansions original (_expand)
It does not show the original before.
Even adding this: zstyle ':completion::expand:*' tag-order original
expansions all-expansions, shows the same behaviour.
Any thoughts, please?
Thanks
Joe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-03-01 19:30 ` joe M
@ 2013-03-01 19:38 ` joe M
2013-03-01 20:30 ` joe M
0 siblings, 1 reply; 9+ messages in thread
From: joe M @ 2013-03-01 19:38 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Hello,
> --(~/etc/zsh)-------------------------------------------------------------------------------------------------------------------(pts/3@master)--
> grep test *
> -- expansions --
> 01-colors.zsh 01-prezto-helper.zsh
> 05-appearance.unused_zsh 06-zex.zsh-does-not-work
> 10-syntax.zsh.trapd00r 20-abbrevations.zsh 20-bookmarks.zsh
> 20-exports.zsh
> 20-history.zsh 20-setopts.zsh
> 39-completion-skeleton.zsh 40-alias-global.zsh
> 40-alias-ls.zsh 40-alias-suffix.zsh 40-alias.zsh
> 40-completion.zsh
> 40-completion.zsh.20130228 40-completion.zsh.20130301
> 40-completion.zsh.original 40-directory.zsh
> 50-bindkeys.zsh 50-functions.zsh 60-git.zsh
> 70-autojump.zsh
> 70-simpleprompt.zsh 90-syntax.zsh
> 90-syntax.zsh.zsh-syntax-highlighting
> 91-history-substring-search.zsh 92-auto-fu.zsh.disable
> 99-startup.zsh all_opts all_opts_bang
> bart.theme colorize colorize.c
> compdef
> compdef.disable .git .gitignore
> history_words_to_commands.patch
> mikachu-dot-zshrc prezto
> start-zsh-with-cmd.exp todo
> todo.txt trapd00r.theme zex-zsh
> zprofile.20110925
> zprofile.20120319 zprofile.20130124
> zprofile.latest zprofile.root
> zprofile.simple zsh_history.joe zshrc
>
> --(~/etc/zsh)----------------------------------------------------------------------------------------------------------------------(pts/3@master)--
> grep test *
> tags in context :completion::expand:::
> all-expansions expansions original (_expand)
>
> It does not show the original before.
Adding this is not changing the above behaviour either.
zstyle ':completion::exand:*' group-name ''
Thanks
Joe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-03-01 19:38 ` joe M
@ 2013-03-01 20:30 ` joe M
2013-03-01 23:40 ` Oliver Kiddle
0 siblings, 1 reply; 9+ messages in thread
From: joe M @ 2013-03-01 20:30 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Hello,
_approximate group-order works when I set the below:
zstyle ':completion:*' group-name ''
_expand does not though.
Thanks
Joe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-03-01 20:30 ` joe M
@ 2013-03-01 23:40 ` Oliver Kiddle
2013-03-02 4:13 ` joe M
0 siblings, 1 reply; 9+ messages in thread
From: Oliver Kiddle @ 2013-03-01 23:40 UTC (permalink / raw)
To: joe M; +Cc: zsh-workers
joe M wrote:
> _approximate group-order works when I set the below:
>
> zstyle ':completion:*' group-name ''
>
> _expand does not though.
Have you perhaps got your tab key bound to expand-or-complete? That
would mean that you're using the old built-in expansion and not _expand.
If you want to use _expand (or _match) it is better to just do:
bindkey '^I' complete-word
Other than that, if I copy your snippets of zstyle commands and add a
group-order style, it all works fine.
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh completer _approximate completer
2013-03-01 23:40 ` Oliver Kiddle
@ 2013-03-02 4:13 ` joe M
0 siblings, 0 replies; 9+ messages in thread
From: joe M @ 2013-03-02 4:13 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Hello Oliver,
> Have you perhaps got your tab key bound to expand-or-complete? That
> would mean that you're using the old built-in expansion and not _expand.
>
> If you want to use _expand (or _match) it is better to just do:
> bindkey '^I' complete-word
spot on. That was it.
Thanks for pointing it out.
Thanks again,
Joe
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-03-02 4:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28 6:27 zsh completer _approximate completer joe M
2013-02-28 6:42 ` joe M
2013-02-28 9:00 ` Oliver Kiddle
2013-02-28 9:30 ` Oliver Kiddle
2013-03-01 19:30 ` joe M
2013-03-01 19:38 ` joe M
2013-03-01 20:30 ` joe M
2013-03-01 23:40 ` Oliver Kiddle
2013-03-02 4:13 ` joe M
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).