Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion for "info -f" does not work
- X-seq: zsh-workers 49850
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Vincent Lefevre <vincent@xxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: completion for "info -f" does not work
- Date: Tue, 15 Mar 2022 18:05:22 +0000 (GMT)
- Archived-at: <https://zsh.org/workers/49850>
- Importance: Medium
- In-reply-to: <20220315171305.GB617047@zira.vinc17.org>
- List-id: <zsh-workers.zsh.org>
- References: <20220315171305.GB617047@zira.vinc17.org>
> On 15 March 2022 at 17:13 Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
>
> In a directory where there is a file with the .info extension:
>
> zira% autoload -U compinit
> zira% compinit
> zira% info -f ./
>
> If I type [TAB], I don't get any completion. It should complete
> on the .info files (at least).
I guess this could be a fairly straightforward alternative to the
gory file munging, something like the following?
pws
diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo
index 7dfa32e45..f169cba63 100644
--- a/Completion/Unix/Command/_texinfo
+++ b/Completion/Unix/Command/_texinfo
@@ -280,18 +280,25 @@ if [[ -n $state ]]; then
[[ -z $file ]] && file=${opt_args[-f]:-$line[1]}
if [[ $state = info* ]]; then
- local -aU files=( $^infopath/*.info(|.gz|.bz2)(-.:t:s/.gz//:s/.bz2//:r) )
- local items
- if (( ! $#files )); then
- _info_retrieve_nodes
- files=( ${(P)cache%%:*} )
- fi
- items=( ${${${(M)${(f)"$(_call_program menu-items info -o-)"}:#(#s)\* *: \(*}#??}%%\)*} )
- files+=( ${items##*\(} )
- tags=( info-files )
- if [[ $state != infofiles ]]; then
- tags+=( menu-items )
- items=( ${items%:*} )
+ local -aU files
+ if [[ $PREFIX = (./|../|/)* ]]; then
+ files=( $^infopath/*.info(|.gz|.bz2)(-.:t:s/.gz//:s/.bz2//:r) )
+ tags=(files)
+ items=()
+ else
+ files=( $^infopath/*.info(|.gz|.bz2)(-.:t:s/.gz//:s/.bz2//:r) )
+ local items
+ if (( ! $#files )); then
+ _info_retrieve_nodes
+ files=( ${(P)cache%%:*} )
+ fi
+ items=( ${${${(M)${(f)"$(_call_program menu-items info -o-)"}:#(#s)\* *: \(*}#??}%%\)*} )
+ files+=( ${items##*\(} )
+ tags=( info-files )
+ if [[ $state != infofiles ]]; then
+ tags+=( menu-items )
+ items=( ${items%:*} )
+ fi
fi
elif [[ $state = nodes ]]; then
tags=( menu-items )
@@ -317,6 +324,7 @@ if [[ -n $state ]]; then
_requested menu-items expl 'menu item' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0
_requested -x index-entries expl 'index entry' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0
_requested info-nodes expl 'node' compadd -M 'm:{a-zA-Z}={A-Za-z}' ${nodes#*:} && ret=0
+ _requested files expl 'file' && _files -g '*.info(|.gz|.bz2)'
(( ret )) || break
done
Messages sorted by:
Reverse Date,
Date,
Thread,
Author