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

Re: globbing



On Aug 11,  3:10pm, Borsenkow Andrej wrote:
}
} > in zsh i can only expand it if i put a space, and then the result looks
} > like:
} > aura% cd /usr/local/ bin/
} > 
} > complete_in_word doesn't do this (as was mentioned the last time someone
} > brought this up on the list).  i find the bash way much more intuitive even
} > if the zsh way is more 'correct'.
} 
} You have to use expand-or-complete-prefix instead of expand-or-complete 
} (or complete-word), like
} 
} bindkey '^I' expand-or-complete-prefix
} setopt completeinword
} 
} But then your first problem is back - there is no complete-prefix widget.

You can, however, roll your own (but not in 3.0.x):

  bash-complete () {
    emulate -L zsh
    if [[ $RBUFFER = (|[[:space:]\;\&\|\>]*) ]]
    then
      zle complete-word         # Completing at end of word is not special
    else
      setopt noautomenu         # Cannot menu-complete the prefix, sorry
      RBUFFER[1]=" $RBUFFER[1]" 
      zle complete-word                  
      RBUFFER[1,2]=$RBUFFER[2]           
      if [[ $LBUFFER[-1] = $RBUFFER[1] ]]
      then
	LBUFFER[-1]=''          # Suppress doubled slashes, for example
      fi
    fi
  }
  zle -N bash-complete
  bindkey '\t' bash-complete

This could, I suppose, get added to the collection of bash-alike functions
that PWS has created.  It does appear to work with `setopt bashautolist'.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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