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

Re: 2 questions



Jason Price wrote:

> 1)  I'm trying to do a simple string match in an if statement, akin to how
> one is done in a case statement.  Something like...:

This is done with if statements normally. All you need is:

if [[ "$var" = pattern ]]; then

Make sure that you don't quote the pattern otherwise it won't work.

> 2) I'm playing with dev-22, and trying to get things to work nice.
> Currently, across all completion, should I hit <tab>, all matches are
> printed onto the command line.  Aka:
> 
> ->ls p<tab>
> 
> ->ls pc programs prompt
> pc@        prompt

> zstyle ':completion:*' completer _expand _complete _correct _approximate
> zstyle ':completion:*' completions 1
> zstyle ':completion:*' glob 0
> zstyle ':completion:*' substitute 0

The problem here is that you use the _expand completer with completions
1 but glob 0 and substitute 0. The _expand completer is expanding all
the completions on the command line. In general, I would only want to
use completions 1 with a more specific context. Probably your best bet
is to remove _expand from your list of completers but if you want it,
then try reading the appropriate sections of Peter's Zsh Guide (try
'User-friendly users guide' from the zsh web pages if you don't know
where to find it).

Oliver Kiddle



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