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

Re: Force file completion when hitting TAB twice



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


-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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