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

Re: PATCH: _path_files: complete # to introduce a glob flag



On 10 September 2014 19:27, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> This adds # as a possible completion at the *(<tab> point. *(#<tab> is already handled obviously, but you had to know to type it.
>
> ---
>  Completion/Unix/Type/_path_files | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
> index 8b8d5d5..b0725ba 100644
> --- a/Completion/Unix/Type/_path_files
> +++ b/Completion/Unix/Type/_path_files
> @@ -15,13 +15,19 @@ local -a match mbegin mend
>  # a bare glob qualifier.
>  # The later test looks for an outstanding quote.
>  if _have_glob_qual $PREFIX; then
> -   compset -p ${#match[1]}
> -   if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
> -     _globflags
> -   else
> -     _globquals
> -   fi
> -   return
> +  local ret=1
> +  compset -p ${#match[1]}
> +  if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
> +    _globflags && ret=0
> +  else
> +    local -a flags
> +    flags=(
> +    '#:introduce glob flag'
> +    )
> +    _globquals && ret=0
> +    _describe -t globflags "glob flag" flags -Q -S '' && ret=0
> +  fi
> +  return ret
>  fi
>
>  # Utility function for in-path completion. This allows `/u/l/b<TAB>'
> --
> 1.9.0
>

Of course I'd realize just after sending, but I suppose it should also
check for extendedglob being set.

-- 
Mikael Magnusson



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