Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completions issues
- X-seq: zsh-users 5165
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: GoTaR <gotar@xxxxxxxxxxxxxx>
- Subject: Re: completions issues
- Date: Sun, 14 Jul 2002 21:09:16 +0000
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20020714105554.GC824@os>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20020710204701.GA3362@os> <1026499603.2775.6.camel@xxxxxxxxxxxxxxxxxxxxx> <20020713193728.GA11214@os> <1020713212037.ZM8169@xxxxxxxxxxxxxxxxxxxxxxx> <20020714105554.GC824@os>
On Jul 14, 12:55pm, GoTaR wrote:
} Subject: Re: completions issues
}
} On Sat, Jul 13, 2002 at 21:20:37 +0000, Bart Schaefer wrote:
}
} > } And question: how to make it without perl?
} >
} > smsas=( ${(f)$(smsaddr -l)} )
}
} Here is the first trap - ${(f)... will change double tab to space
That has nothing to do with ${(f)...}. It's just that I lost the double
quotes somehow when typing my reply:
smsas=( ${(f)"$(smsaddr -l)"} )
Elsewhere, you wrote:
} No no no, adding both will cause showing them _all_ when completion
} without any prefix - and I don't want doubled entries like this:
}
} gotar:~: smsaddr -l [tab]
} SMS alias
} rtrzepla -- 692xxx
} 692xxx -- rtrzepla
Getting a little demanding, aren't we?
Anyway, just add the inverted pairs only when the word on the line is
non-empty, and then let completion deal with it from there.
_sms_aliases () {
smsas=( ${(f)"$(smsaddr -l)"} )
smsas=( ${smsas/ /:} )
if [[ -n "$PREFIX$SUFFIX" ]]; then
smsas=( ${smsas/(#s)(#b)(*) (*)(#e)/$match[2]:$match[1]} )
fi
_describe "SMS alias" smsas
}
--
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