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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19173 invoked from network); 12 Feb 2021 23:26:31 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Feb 2021 23:26:31 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=g/avrkDNvTkdruMyccRhzODo9ZX/bpumr3gx4zMVbK4=; b=vulHl+YSrdEThy+NcxWOAeOaGF qPufMmC7Z1PtQ1q49vV4lbeuFJCshltkEqNA7tUr96n1BCyH93Dgo9op5qkfYmctTMLoQFeIOl3dC KVYoYfIifbgHBw7NWDl1RYobYTKyD0Aqqj1QOcH7T4sMx7wtnuNb1CmcRaSsuH22RokJElknccQve C2KHJCSQMwwvCRInfoUdBvn/0nF+IhdfUNUswW0+Nobi4KF/fkehLliyPfFfdMmJaOQJKHbrNuvyf vB4POnLGLQ/AbiI4Bgy6t6lnI7xaoX7FIBp7Vesw3q3fw9lwNCDzm0A/dXIytaxSTw7PyBrsM49Sx 1gFx67tQ==; Received: from authenticated user by zero.zsh.org with local id 1lAhpW-0005sz-NI; Fri, 12 Feb 2021 23:26:30 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lAhpB-0005k4-OH; Fri, 12 Feb 2021 23:26:10 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.93.0.4) (envelope-from ) id 1lAhpB-000GQ9-Av; Sat, 13 Feb 2021 00:26:09 +0100 cc: Zsh hackers list In-reply-to: From: Oliver Kiddle 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> To: Marlon Richert Subject: Re: Rewrite of zsh-newuser-install MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <62942.1613172125.1@hydra> Date: Sat, 13 Feb 2021 00:26:09 +0100 Message-ID: <63124-1613172369.335393@kj4H.lfui.ly3G> X-Seq: 48026 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: I viewed the latest file from git and am commenting on that directly. > # Use `exec zsh` to apply changes after editing this file. Not sure I'd recommend that because if you mistype "zsh", your shell+terminal disappears. And if they've broken .zshrc, that can leave them unable to log back in. > bindkey -e # Use `emacs` as the main keymap. I don't argue with the direct emacs binding. But would be tempted to add a commented-out line suggesting what vi users may want to try, either bindkey -v or: bindkey '\e' vi-cmd-mode That's closer to what many vi users actually want and to what vi mode on bash does. > HISTFILE=${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. > # Primary prompt, left side > # %x PS2='%S%_%s ' # Left side > RPS2='Press %SAlt-Q%s to return to PS1' # Right side > bindkey '^[q' push-line-or-edit # Alt-Q It can be quite helpful to leave PS2 empty and put <%^ in the [transient] right - allows for copy and paste without intervening prompts. And that doesn't mean it can't include the hint too. > # Spelling correction prompt > # %R: word to correct; %r: suggested correction > SPROMPT='Correct %B%F{w}%K{r}%R%b%f%k to %F{g}%r%f? [%Sy%ses/%Sn%so/%Se%sdit/%Sa%sbort] ' Is it perhaps better to spell out white, red and green just to make this a little more readable. This is also elsewhere (apart from the first case). > ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;' # Characters that remove completion suffixes. > ZLE_SPACE_SUFFIX_CHARS=$'&|' # Characters that instead replace them with a space. The first of these assignments is actually redundant because the latter takes precedence. > zmodload -F zsh/zutil b:zstyle # Load `zstyle` builtin. Is that really needed? I've never bothered. > # 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 _ignored These seem reasonable choices. _extensions wouldn't cause any unpleasant surprises for a new user but it does need to come first. I'm not fond of _expand in unconfigured form - would consider some of keep-prefix true, accept-exact continue and tag-order all-expansions. > # m:{[:lower:]-}={[:upper:]_} does foo-bar -> FOO_BAR but not vice versa. > # r:|?=** does fbr -> foo-bar and bar -> foo-bar > zstyle ':completion:*:complete:*' matcher-list \ > 'r:|[.]=** r:?|[-_]=** l:?|=[-_] m:{[:lower:]-}={[:upper:]_}' \ > 'r:|?=** m:{[:lower:]}={[: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 force the type of listed matches with punctuation prefixes. 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:%|=*' > # For options only, add - -> + for each item in the list above. > zstyle ':completion:*:options' matcher 'm:{-}={+}' Isn't the more limited 'b:-=+' sufficient here? > # 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. > zstyle ':completion:*' separate-sections yes That also applies elsewhere, e.g. words for dict. > # Press Alt-Shift-Hyphen to redo (after undo). > bindkey '^[_' redo I'd be inclined to bind Ctrl-Z to undo. Forget Emacs and Vi - Ctrl-Z is what the rest of the world uses for undo. That doesn't disable anything else and too few people know the shell has an undo. It's invaluable with completion, especially with approximate completion or the fuzzier matching controls such as r:|?=**. > 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. > typeset -gU PATH path FPATH fpath CDPATH cdpath MANPATH manpath These are tied, no need to list both forms. The -g adds nothing either outside of a function. Oliver