From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12825 invoked by alias); 12 Jan 2010 22:39:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27597 Received: (qmail 29660 invoked from network); 12 Jan 2010 22:39:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED autolearn=ham version=3.2.5 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.219.222 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=8vhaN0pkgrTPjPhuacE6BRAUk/nXGGTNSMKJmE4TWGw=; b=TPuUrthRn5Ao7P7me+lRx8MWtcdWhdBLvo153wisI8NNHojPBMcfwXIKrkTF7mtU7p KeYGex+cJs7/fohXLluESJBeS+glUM/4yZjlwekI1H0p0hzcoPQBr22iGVuYMqE+Ztg/ J58VZ9QaM4brHQ2MXCO3CpB9wNrC3iCPkGi1A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=eusqSH3K773YIO5YMKjgzr+qh0WqcPckv7VQS8rS3/4nItR39gSDSLIKhEdhF1XWVk qzdl/En19EJkX5ykGxH+aDvImljnmgVwkz6b3ykGV5eKIRpyOa7qvHI8GjejN3fYLlPS Xr/2gx+ikNaZWheMjCkSfZ5kZM8azf1AuxjE0= MIME-Version: 1.0 Date: Tue, 12 Jan 2010 23:39:15 +0100 Message-ID: <237967ef1001121439q1e10a3d7h24a2dffc0156bb57@mail.gmail.com> Subject: suffixes in _zstyle, was: How to accept a completion? From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 2009/4/29 Mikael Magnusson : > 2009/3/19 Peter Stephenson : >> Mikael Magnusson wrote: >> >>> As an aside, after i write $PWD(: to get the s, how do i "accept" >>> the completion to make tab complete the - instead of cycling to the >>> next completer? The only way i found is typing something and deleting >>> it... When completing directories i usually just type a /. >> >> Just type the string that's got to come next; it always does, or the s >> is useless: there's no point typing anything you need to delete, just >> use what you don't need to delete. Actually, why don't you just type >> "s-"? The "completion" is really only there as a mnemonic of what can >> go at that point, it doesn't save you any typing even in the optimal >> case. > > Okay, finally encountered a real example of this being annoying now. > % scp file lt > ---- file > lth/ > ---- remote host name > lth > > tabbing to the remote host name gives me > % scp file lth: > Now how do i complete files on the remote end? If i press tab again i just get > % scp file lth/ > And if i type a : i get > % scp file lth:: > the only way that works is typing something and backspacing, then > pressing tab again... Found another one of these, zstyle gives you :completion: with no obvious way to continue completing without or some variation thereof. The following fixes it; I think this is another case of not wanting the : to be removed on a space, but the rest of the completer uses -qS. I did notice though that my "hilight suffixes" thing only works for the -q case, not for -r:, same with the scp completion. I was really just looking around at various variables in that code picking one that seemed to be what I wanted, but apparently I didn't get the exact correct thing then. Any ideas? -- Mikael Magnusson diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index 0080619..6e34fcc 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -185,7 +185,7 @@ while (( $#state )); do case "$state[1]" in (contexts) if [[ ! -prefix :*: ]]; then - _wanted contexts expl context compadd -P : -S : completion zftp + _wanted contexts expl context compadd -P : -qS : completion zftp elif compset -P :completion:; then for ostate in functions _completers cmdorcont argument tag; do compset -P '[^:]#:' || break