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 24846 invoked from network); 13 Feb 2021 00:16:26 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Feb 2021 00:16:26 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613175386; b=zgTvaxhO3T9BsTwgKJuYIpjn26C1YVn/oaT8QDusXSe7XtmIgg5HDD8+t/5NgzehoXH1k/fdS1 QV3XNy4AbTRgYJgIKinqwTESv2Mc3xW3hdIZb3wMORnLm0ogWltDp8DEN68hBjWPryNj2Ubdiz 53uISWXiE3BtQ4DY1xnv1fpvnUSwUKn2p5FPQu9jEv96Jobh9MTrQL1mXMAkuhiLMrvaep/9t6 Hx45Q90E2iuXpOeydVqRvlL0ZHWlospaArp0UpoVhVe6/k86xmALmMowPoIYwvT39+oGUt+Nw7 nWWwNCE67D43iSm7q9G/tN+yjpHjkwa8CuiB+KtELBiDsw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f182.google.com) smtp.remote-ip=209.85.208.182; 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=1613175386; bh=/5TxoG0k7ySRNpVAF8NoV8ZRmRGk3QgEUMtB9/HXr94=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=kVqbVkpMiHl+MMx1SUobtFJZv7f5NkAuNFKXO60Dmw/u/kGZd2/6ge0lGXvJJaSECeA28+mypm 30pSCzqqtpNNjCsqqM9gZkSEzRe1kMlGox5VK8WObYie5Ezxq70NrTzqWhN6/u0XxUjDoo3mm2 NXRHfiFzrMCvUX6+HfjjNt7DghB/BD57leaCrZxB2LYRMOd+eRBs6jL3+ZZaBxEeo9ZmYgTu11 kw6ebJIl1oPq+7baAmpi7pBvNDR2L4i2gCewo+bAj/Oiqihei6VwasM2mBwJyYNdTcE8sECOhi MX46IEIru9W2nLaL/+SFnJGbXEQpBz2fGtzwEXqOKwQM4Q==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7zYzo/lPkyS/X8psvod+pu1bmhOryacUSqW7dJRwXkI=; b=OliIKjqjUjEHF5TVQw9E7cN6xT 1VjfTcz6+Fd1xR0oHtZIyqwtBXbrGWU5z1ELliuKAAtBMAVKlBJmgY27vJif9NUIjagpXUt9a9QZ7 uwHMec+86k5TKu9Zh8le/x0l9olFNb7AKGoLTBh0dzV4Z3hbvHKlx6AxRa/aE0ivEadSgEpqxuPBb CYtFoYkiu++LcSai0sffQjmUebq2ZNE5lL6+3ESxMNzdHfJ/cyxPaA4e9R0ahjE6yVTSMOSCg0LhI wf1jlFy8haV0xXZWaaWcjY6s9LpZLC7a0aF0BvJB7EIL04LU33UPLb6X8KRUQMzq41OOapsqkXMUD uK/P3FWg==; Received: from authenticated user by zero.zsh.org with local id 1lAibn-0007ca-UB; Sat, 13 Feb 2021 00:16:23 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f182.google.com) smtp.remote-ip=209.85.208.182; 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-f182.google.com ([209.85.208.182]:33690) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lAibY-0007Sd-C3; Sat, 13 Feb 2021 00:16:09 +0000 Received: by mail-lj1-f182.google.com with SMTP id c17so61812ljn.0; Fri, 12 Feb 2021 16:16:08 -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:content-transfer-encoding; bh=7zYzo/lPkyS/X8psvod+pu1bmhOryacUSqW7dJRwXkI=; b=nKtK0iFonHRWDEWhVcYs++UvqVanl9uU3bRynrNCpwLxKQE3tnGDRBiUpGzKhqbv8p WuJr755eHlqLj48PdAcngRpJZY+wZRLPDg/LEilf9E/j54bX/Rd+76/JvSai1k+ZVja4 HaMvG2dgpCRZV8TiJ6qkdAa+vtJHUcNMTM/nNJb1ymm+KqZ4YtLjBBIPqqye0uhr7Gx2 k4rmxjzZnXqC7zJA5j2w74/KMlClOiQNguza8ziBdyphXNsEZvAflciOiJP2JKYH+wvN aqBQOj9+SDSBQA2G6w8KY7QFKE33B5gIYWJuvEfWqd+HkjGEiA61xAseo5efCke571aE S6xw== 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:content-transfer-encoding; bh=7zYzo/lPkyS/X8psvod+pu1bmhOryacUSqW7dJRwXkI=; b=edLfpPzM7jkW5Uh+a4pi7eXJgrPwv9CeMeMUMU7B65sN/RH3Elir7m4DC3zeEDCmas W6OAhZX5mR3FjKAPMRZfIERX0en+x4i8o3nO1rqnUif55UeJnhgV1/Li4a9wgeMImZTs CJKBU1r9wWzaaBA9xWO0ALpRpKXtFT9T87Xqdw+WZY67X+Kmsg1Ldl7fHhdEZaOr+6HW pdy1Ma40orvaSBywzQ/sdFTfg6ic2SbexRVVBOEp2NrcTqKxRk6ZZAwHG21qK4geV4BD AL5kKMlZDalF3Qwnz5O0l3EMXJKiMHlnPcL9nRs7cDdA3oDL9HyzHps4I7wY/TMp4w5/ o72g== X-Gm-Message-State: AOAM532PnSnM8Xocnz8/66doDLcyxT3fLE79xvJveqmsHFx8/wbdS2lh 7INJUN16nmsmhePMNRpsthkXAYP+NYxYiPHZ5Xg+h7lKE9R2Zw== X-Google-Smtp-Source: ABdhPJzn+q/dgdfZFES4twy1y5njqWCxdS9nKza4EIVyX4SFIoDLZs9ggHfhAXzDSNEW5uYun3TJgt9RPhjF+Ig/08Y= X-Received: by 2002:a2e:b710:: with SMTP id j16mr3046218ljo.270.1613175366498; Fri, 12 Feb 2021 16:16:06 -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> <63124-1613172369.335393@kj4H.lfui.ly3G> In-Reply-To: <63124-1613172369.335393@kj4H.lfui.ly3G> From: Marlon Richert Date: Sat, 13 Feb 2021 02:15:29 +0200 Message-ID: Subject: Re: Rewrite of zsh-newuser-install To: Oliver Kiddle Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 48028 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 Sat, Feb 13, 2021 at 1:26 AM Oliver Kiddle wrote: > > # Use `exec zsh` to apply changes after editing this file. > > Not sure I'd recommend that because if you mistype "zsh", your shell+term= inal > disappears. And if they've broken .zshrc, that can leave them unable to l= og > back in. I got this tip from Roman. We've both seen new users get into all kinds of trouble by repeatedly doing `source ~/.zshrc`. > > HISTFILE=3D${ZDOTDIR:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh}/history > > > # Create parent dir, if necessary. > > if [[ ! -d $HISTFILE:h ]]; then > > zmodload -F zsh/files b:zf_mkdir > > zf_mkdir -pm 0700 - $HISTFILE:h > > fi > > I'm not sure it helps new users to understand their new setup file if it = needs > this stuff. Should we just keep it simple at the expense of ignoring the = XDG stuff. Bart suggested we could instead, in zsh-newuser-install, ask the users what they would actually prefer. I think that's reasonable. I put a suggested text in my reply to him. I will start adding the new version of zsh-newuser-install to the repo, too. > > # %x > The trunction adds complexity that I'm not sure is needed. Many people wa= nt to > know how to enable vcs_info. I'm not saying it should be included by > default but perhaps in a comment. I personally don't use truncation, because I use a multi-line prompt. Others in this thread, though, insisted that new users should get a single-line prompt. However, if you use an 80-column terminal that often means you will run out of horizontal space quickly. I tried truncating by leaving out segments, but I found the effect of that undesirable: When the segments are short, it feels like information is needlessly being hidden from you, whereas when the segments are long, it still doesn't really save any space. Truncating to a fixed width proved to be much more pleasant all-round, IMO. This way, it looked more like the path was scrolling off-screen, which felt more natural. > > zmodload -F zsh/zutil b:zstyle # Load `zstyle` builtin. > > Is that really needed? I've never bothered. I guess it depends on your Zsh installation. I thought I'd better be safe than sorry. I already saw one error where add-zle-hook-widget failed, because zsh/zle wasn't loaded yet. > > # These are tried in order until one of them succeeds: > > # _expand: expansion substitutions (See http://zsh.sourceforge.net/Doc/= Release/Expansion.html) > > # _complete: regular completions > > # _history: words from history > > # _correct: spelling corrections > > # _ignored: any completions that have been ignored so far > > zstyle ':completion:*' completer _expand _complete _history _correct _i= gnored > > These seem reasonable choices. _extensions wouldn't cause any unpleasant > surprises for a new user but it does need to come first. _extensions feels rather useless when you can get the same effect through matchers, but without requiring the leading *. > > # m:{[:lower:]-}=3D{[:upper:]_} does foo-bar -> FOO_BAR > but not vice versa. Yes, that is intentional. :) > > # r:|?=3D** does fbr -> foo-bar and bar -> foo-bar > > zstyle ':completion:*:complete:*' matcher-list \ > > 'r:|[.]=3D** r:?|[-_]=3D** l:?|=3D[-_] m:{[:lower:]-}=3D{[:upper:]_}'= \ > > 'r:|?=3D** m:{[:lower:]}=3D{[:upper:]}' > > I'd be significantly more conservative on these. They really can cause > surprises for new users and break some things completely like trying to f= orce > the type of listed matches with punctuation prefixes. I've used something like this for quite a while now. I'm unsure what kind of breakage you are referring to. > I mostly use generous matchers with more specific contexts. > To give one example, the following helps when suspended jobs are all > man, less or vim and I want to select on the argument: > zstyle ':completion:*:(-command-|[fb]g):*:jobs' matcher 'l:%|=3D*' I'm hesitant to do this kind of tweaking. I'd rather apply the Pareto principle and have a generic solution that's good enough for most cases. If there's anything specific that needs to be done for certain completion, then it should happen in the completion function IMO. > > # For options only, add - -> + for each item in the list above. > > zstyle ':completion:*:options' matcher 'm:{-}=3D{+}' > > Isn't the more limited 'b:-=3D+' sufficient here? Perhaps, if you can explain to me what it does. :) > > # Show and insert `man` sections. > > zstyle ':completion:*' insert-sections yes > > I wouldn't bother for section 1: > zstyle ':completion:*:manuals.(^1*)' insert-sections true > > Not only because it is mostly redundant but it is easier to simplify that= to > all sections than to do the reverse. Again, I don't see any real gain to adding that. It works fine without. > I'd be inclined to bind Ctrl-Z to undo. Forget Emacs and Vi - Ctrl-Z is w= hat > the rest of the world uses for undo. That doesn't disable anything else a= nd too > few people know the shell has an undo. It's invaluable with completion, > especially with approximate completion or the fuzzier matching controls s= uch as > r:|?=3D**. Sure. And then Ctrl-Y to redo? Seems reasonable to me. > > setopt GLOB_STAR_SHORT # Use `**` for recursive globbing; `***` to= include symlinks, too. > > Need to say 'without a trailing "/"' **/ is already recursive globbing > and you don't need this option to enable it. > > The comment confused me but like Bart I don't use the option but found > myself wondering whether I should. I personally find it quite useful, especially when combined with the _expand completer. :) > > typeset -gU PATH path FPATH fpath CDPATH cdpath MANPATH manpath > > These are tied, no need to list both forms. The documentation of typeset -U says otherwise, though: http://zsh.sourceforge.net/Doc/Release/Shell-Builtin-Commands.html#index-ty= peset > -U > For arrays (but not for associative arrays), keep only the first occurren= ce of each duplicated value. This may also be set for tied parameters (see = -T) or colon-separated special parameters like PATH or FIGNORE, etc. Note t= he flag takes effect on assignment, and the type of the variable being assi= gned to is determinative; for variables with shared values it is therefore = recommended to set the flag for all interfaces, e.g. =E2=80=98typeset -U PA= TH path=E2=80=99. Should that text be changed? > The -g adds nothing either outside of a function. I know, but I felt like it's good to be consistent, in case the user ever puts in a function. Thanks for your input!