zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _path_files: complete # to introduce a glob flag
@ 2014-09-10 17:27 Mikael Magnusson
  2014-09-10 17:30 ` Mikael Magnusson
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2014-09-10 17:27 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: _path_files: complete # to introduce a glob flag
  2014-09-10 17:27 PATCH: _path_files: complete # to introduce a glob flag Mikael Magnusson
@ 2014-09-10 17:30 ` Mikael Magnusson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2014-09-10 17:30 UTC (permalink / raw)
  To: zsh workers

On 10 September 2014 19:27, Mikael Magnusson <mikachu@gmail.com> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-10 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10 17:27 PATCH: _path_files: complete # to introduce a glob flag Mikael Magnusson
2014-09-10 17:30 ` Mikael Magnusson

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).