From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 9fc7cabc for ; Fri, 18 Oct 2019 22:23:50 +0000 (UTC) Received: (qmail 1613 invoked by alias); 18 Oct 2019 21:08:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24365 Received: (qmail 2844 invoked by uid 1010); 18 Oct 2019 21:08:39 -0000 X-Qmail-Scanner-Diagnostics: from st13p97im-ztdg18291001.me.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25601. spamassassin: 3.4.2. Clear:RC:0(17.41.193.146):SA:0(-2.7/5.0):. Processed in 1.405183 secs); 18 Oct 2019 21:08:39 -0000 X-Envelope-From: c.nebel@mac.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at mac.com designates 17.41.193.146 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1571432883; bh=H1LtJm1h+waMMxbBHmAADfQ0huYOSkk9psUf/iVaW3E=; h=From:Content-Type:Subject:Message-Id:Date:To; b=SUHbXsV4rQq3gAQ3YdZL1A+/tj1LG8ncNTJlzbtZKdJmTA2jUdWTA0s6uUI8FC3ug HplTT8x5pCl7/vj7+CdZ/Zh3E4YSDhhui/m9ku5PQdiTMnLT0uJXR8CI2CQiGAblZH ElXRNS4MSfCiIW9vmv7kwJbC+yM+7jfK5iaIoy5hEJd6pgYXivim6XixG4Umt6Te3d Ire6EHSCTU07zUMmtWmhTksUR17ht5gJV3DlEh8b1vyNwEVFaeKzYvmXQsfsNaI3Vt DNA+rbjfnwtt542Zet2+JdsWCRhoRWn/zmBFCdHBXXeiw9cpkDMDWMcadHgaXTqkP+ ms5dkQU7flyjw== From: Chris Nebel Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Fake parameter completion? Message-Id: <7C2ECA3E-EA6B-4C31-BF3A-1CF791F71785@mac.com> Date: Fri, 18 Oct 2019 14:08:02 -0700 To: zsh-users@zsh.org X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-18_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=845 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1910180186 zsh-users=E2=80=94 I wanted to use autocompletion to complete various =E2=80=9Cdebugging=E2=80= =9D environment variables, and I came up with something that works, but = I don=E2=80=99t understand why it works and some other attempts don=E2=80=99= t. First, the task: sh derivatives let you specify extra environment = variables for a command by writing them before the command, something = like this: % UseExtraSpiffyLogging=3D1 ./mytool The point is that they are ordinarily undefined, so normal parameter = completion won=E2=80=99t match them, but I want them completed anyway. = Sounds like a job for the =E2=80=9Cfake=E2=80=9D style, which I=E2=80=99ve= successfully used in the past; that plus _complete_help led me to this: zstyle ':completion:complete:-command-::parameters' fake = UseExtraSpiffyLogging This sort of works, but completes =E2=80=9CUseEx=E2=80=9D to = =E2=80=9CUseExtraSpiffyLogging=E2=80=9D when really I want no = space, or ideally a magic =E2=80=9C=3D=E2=80=9C. Re-reading the = documentation, I found the =E2=80=9Cfake-parameters=E2=80=9D style. My = first attempt didn=E2=80=99t complete anything at all: zstyle ':completion:complete:-command-::parameters' = fake-parameters UseExtraSpiffyLogging =E2=80=A6so I relaxed the context a bit, and now I get the completion = *with* the magic =E2=80=9C=3D=E2=80=9C, which is perfect: zstyle ':completion:complete:-command-::*' fake-parameters = UseExtraSpiffyLogging =E2=80=A6except that now I have questions: 1. Why are =E2=80=9Cfake=E2=80=9D and =E2=80=9Cfake-parameters=E2=80=9D = distinct styles? Obviously they behave differently in practice, but why = couldn=E2=80=99t =E2=80=9Cfake=E2=80=9D take the position into account = and add the magic =E2=80=9C=3D=E2=80=9C like =E2=80=9Cfake-parameters=E2=80= =9D does? (The answer probably has to do with the *other* additional = feature that =E2=80=9Cfake-parameters=E2=80=9D provides, which is = type-sensitivity, though it seems like =E2=80=9Cfake=E2=80=9D could = still do the magic =E2=80=9C=3D=E2=80=9C.) 2. What is the actual value of the =E2=80=9C*=E2=80=9D in the context? = Not =E2=80=9Cparameters=E2=80=9D, apparently. (I should mention that I = do not truly understand zshcompsys.) Thanks, =E2=80=94Chris N.=