From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17433 invoked from network); 10 Feb 2021 07:45:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Feb 2021 07:45:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1612943144; b=HeZ2eeo+i12dpnVkAfSzs/sJdbvxJ6P532SJBNCda/jcjNhuRxvY/e+k9LwOsMkZO7uvJS/jpt C4XuarF/97/RKnQA/Ktu11103Y2hybknRxfAs3TS8TkzN4fb8On7ABuh+5FSV7tK+BLPOptZs0 UKThyU0sDSahKVXhNbphE2YAiSeTaukLKzVYl+nvJgtA5lI8sUr9dnA9+gwrAQWrVTF9h7IxS1 LTIU3kL0Pdc0LwOQinhgBbs0sL3mxuF9+JO9vvQ7Uw0RJVgHcjL0AVHypNEH9V1/VU9/EE3cTI ULKMtM3rdlfBuHl8oVKe/BNA5ahFq0eslhuB7JW1a/8bYw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f173.google.com) smtp.remote-ip=209.85.208.173; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1612943144; bh=ft99TuKOhVoxlvCD6rp49NOF1CTd60ttnXd6fSk1lAo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Rk2xBAfZOpCXYlZuQuHitUi6Kh7vLHeN7OZXbzfPhq3gFvHDv97nj/N+0iYXf/r66OCf2vYezb b9a298ZoOA1yAIB4hCa3kHEE6YIcE9PyCB4Lwp8BURst3COLO844jnh48Q/u6ZeV0Gk9eze6Vz KOgb6d7fIlt0JOB0uqX5i6yx1ImwMkN9LpIPmveVrtkLItg0YrBfnH/duYgQY3oxqo7BnH8eKa pjP9vgbdTj0PpF1mbsc9pGP8qHw3GYxdozFr0vMDyw1G9iRWDaPgb9YTmJy5SWKsi0mBfPkQYi E3e/v9EbhcrALxvKjYtJfSSZUb8rPIkaGbeLUrYwbA/NhA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=P4ATCPbwrd5wdRn2+X/WPSwwPw1FrfbUuhe1kiFII/Y=; b=t41ExcOY/pUdoiZQghPeUqrUtd e9ly5VAIvb+fyfQ7m2Ej8IEPKgiolybiNZqNKZc5r7DnlUCFrMLXvVv7TbZyA5wVwPFL3werQ8k4W AZ1qzY8Z9yalzMPowLyWnff1YnelzW3gaf7QTT2UprvT5YPYQXuaeP7b7PALRURFTeT/NgobOeFam B39FOCTfUvVIBM8l2BPC0jybzfS22u6moaI3cZyeQ6pIImFEm38gEBgBK1NccEZ580zbUboRg7csa uNa8jz1UOBhTCoFqc4bkivvbBF6O0y813APaFWwJqnBq6ngSQSbKyGITic9ODmJ+SpMv8psWKWbV1 p5paAAbA==; Received: from authenticated user by zero.zsh.org with local id 1l9kBz-000KAy-Uv; Wed, 10 Feb 2021 07:45:43 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f173.google.com) smtp.remote-ip=209.85.208.173; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f173.google.com ([209.85.208.173]:33159) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1l9kBh-000K2U-TV; Wed, 10 Feb 2021 07:45:26 +0000 Received: by mail-lj1-f173.google.com with SMTP id a25so1608639ljn.0 for ; Tue, 09 Feb 2021 23:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P4ATCPbwrd5wdRn2+X/WPSwwPw1FrfbUuhe1kiFII/Y=; b=CFShh/loWxW1BXtP+k8NGtrf7gWQBDGuZVuf1+n1iT6HxzmP+QoWChkJh/uCvkB0IV PB5iMY9Uenq3v6yZIwKJQn5UCgFYlU6cWxe1B9L1sDKwI2aecq+Bp39o2WUkofSmpA6B Hl2Jy52vjxXHC0R7OzKhOkEzxmIklAbuDY1nvlblzQis6fSurQ8S2n9IuR0DfBb+zQn8 DYr9ZYw334riALO18rTUFIIqj+hCQvpFfmPGEwWrFstbC7jZSkQDoufvIE+ofCKaiDyJ rY0oiOfQ6PShVS+5jURfXrc8BaV6ojJMkObV+ACFb650F98lK1xrnrpEvEBw5us8k1Ad DWAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P4ATCPbwrd5wdRn2+X/WPSwwPw1FrfbUuhe1kiFII/Y=; b=J0qSENLjK5OJmfKgyXahQvdp1YMIiSbj9czKkO63sK7HV4fQNuxZqd1kcIRMY6cvCg fSS72rBPZKJetdrQNZDjw+8OeoKwbKhjf58Yx25eJx0Su/S1qacSrz/w8LDjaNPw2Q63 C3JTCBLeNWIN8Bhffs+mDL4V0o6q02NM2TObArpu3n4kIlrPpLs1zZ34t4XUpabdKODk 80bNAAiPoq5ZnJKMTFX9loZrOpb/1I+fUEBOSEuSJzyFuetNGzBAH1gcjaWuedrlxaS+ LdEJc8ltoyWOsDhFgl7ptyv1XRq8uuuDr46LvjA7x0oH0iQKKFwQMYrv2hZtScliIx/k 1btQ== X-Gm-Message-State: AOAM5333scaq52GO9IFK+CfkyW00m4RwkBmx4H18lXI2LnhVuJVpDib5 /tQZD/yGO/VYMalPHWJgs15j5JhCGMhbHT9vJ/TWgK5ybNUDB54Q X-Google-Smtp-Source: ABdhPJwBG+kyx2eta5x8PDIZyeMCBnC/2qNTavwxWgXH5tS3vHyRoqQCDLVKj0M0FafZAi3fNOY5diXEu8E44MPNs48= X-Received: by 2002:a2e:8986:: with SMTP id c6mr1193271lji.82.1612943125357; Tue, 09 Feb 2021 23:45:25 -0800 (PST) MIME-Version: 1.0 References: <0102017778f35f33-a962e4d3-83e9-4d3b-a0d7-45701bb40b11-000000@eu-west-1.amazonses.com> <8BA25288-0FFB-4FF4-9799-541D6A3C52DA@dana.is> <19996A10-103F-4054-AD57-FCED8E406687@dana.is> <86782FA5-6EBB-4FCD-90AD-D33F352455F1@dana.is> In-Reply-To: From: Marlon Richert Date: Wed, 10 Feb 2021 09:44:48 +0200 Message-ID: Subject: Re: Rewrite of zsh-newuser-install To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 47995 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On Wed, Feb 10, 2021 at 4:30 AM Bart Schaefer wrote: > > # $(( [#10] x )): cast x to int; COLUMNS: current line width of terminal > > Is there any advantage to computing this with PROMPT_SUBST versus, for > example, reassigning PS1 with a new width in precmd? Anyway if you're > already allowing the dynamic parts to consume 40% of the terminal > width I'm not sure it's worth the effort of making them dependent on > that. Just pick a width for %n@%M and a number of trailing components > for %~. When using $PROMPT_SUBST, the prompt will automatically adapt when I resize my terminal window. It might not be necessary or the fastest solution, but it certainly does increase the "cool" factor of the prompt. ;) > See previous comments in other messages, but if keeping this I'd put > it in preexec instead. I had it in preexec initially, but then, each time you press Enter on an empty line or use a widget that doesn't trigger preexec, then the timer keeps increasing, which looks stupid. > > # m:{[:lower:]-}={[:upper:]_} does zsh-name -> ZSH_NAME > > Doesn't work for completing parameter names, e.g. $xdg-TAB just beeps. > Is that an issue? You're right; it doesn't work. That's weird. It seems to fail for $parameter substitutions only. If I create a function FOO_BAR() {} and type foo- , then Tab completes it just fine. Likewise, if I type xdg- without the $, it works fine, too. Even when I set the matcher-list to just 'm:{-}={_}', $XDG- still fails, but all the other cases succeed. Feels like a bug to me. > Speaking of that, heh, there should be a warning comment (?) or > something that all of this expects to load in zsh native mode, > otherwise those naked subscripts etc. will break. Isn't safe to assume that new users are running in Zsh native mode? Or why would anyone want to run .zshrc when not using Zsh? Or maybe I misunderstand. What do you mean with "zsh native mode"? It feels to me like such a comment is excessive. If you're going to unsetopt PROMPT_PERCENT, then the prompt will break. Should we warn against that, too? > > () { > > local zcachedir=${ZDOTDIR:-${XDG_CACHE_HOME:-$HOME/.cache}/zsh} > > I wonder if it would be less potentially puzzling to use "function {" > here instead of empty parens? I don't think so. If you don't know how anonymous functions work in Zsh in the first place, then merelymchanging the syntax is not going to make it any clearer. I can add a comment to explain it or then refactor it not use an anonymous function.