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

Re: Force file completion when hitting TAB twice



On Fri, 18 Dec 2009 11:21:18 +0000
Peter Stephenson <pws@xxxxxxx> wrote:

> Peter Stephenson wrote:
> > zstyle ':completion:*' completer _complete _complete-failed
>                                                       ^
> Sorry, obvious typo here:  that should be an underscore.  Tried the
> following explicitly to make sure it did what I expected:
> 
> 
> _complete_failed() {
>   # Only complete if first attempt at completion failed.
>   # Usage:
>   #   zstyle ':completion:*' completer _complete _complete-failed
>   #   zstyle ':completion:complete-failed:*' completer
> <your-completers>
> 
>   if [[ $LASTWIDGET = *complete* && -z $_complete_failed_active ]];
> then local _complete_failed_active=1
>     local -a completers
>     local curcontext="complete-failed:::"
>     _main_complete "${completers[@]}"
>   fi
> }
> zstyle ':completion:*' completer _complete _complete_failed
> zstyle ':completion:complete-failed:*' completer _files

Very nice! But I still cannot complete with _files in some contextes.

Just to let you understand: sometimes some completion widgets try to be
smart and don't allow to complete all files. Mostly, these are bugs
in the completion widget. I try to track down the problem usually, but
it happened to me too many times in the past. I don't always have
the time, I simply want to 'get on' and debug later.

The 'git' completion is such and example of recurring headache.

git status [TAB TAB] still doesn't offer me a list of files with this
code (others, like ssh, do).

Ideas?




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