Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Rewrite of zsh-newuser-install



On Wed, Feb 10, 2021 at 12:28 PM Marlon Richert
<marlon.richert@xxxxxxxxx> wrote:
>
> New update: https://gitlab.com/marlonrichert/zsh-sensible/-/commit/85db3c0f8c6abdcfea12017b1ba7d5d81e918490?w=1

I'm a bit embarrassed about this, but felt I should mention it:

> HISTFILE=${ZDOTDIR:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh}/history

My own zsh history is in $HOME, because $ZDOTDIR is maintained with
git.  A file $ZDOTDIR/history file is part of my shell startup,
sourced from .zshrc to set up the collection of history-related
variables and options.  I also avoid incremental history and have a
shell function "die" that kills the shell without allowing any history
to be written, so that I can manually control whether something I've
been doing is saved.  It never occurred to me that $HISTFILE would be
set to a name that did not begin with either a "." or a "z" or both.
Consequently when I sourced the sample zshrc to see what the prompts
etc. looked like, the commands I subsequently executed were
incrementally appended to a file that was then loaded the next time I
started a shell, which fortunately didn't do anything but alarm me.
I've now made everything in $ZDOTDIR, and the directory itself,
read-only.

This is my fault for not re-verifying that the file locations in the
sample did not conflict with any of my defaults.  I point it out
because something like this is one of the reasons that
zsh-newuser-install asks questions before choosing file locations,
which is part of what we're supposed to be discussing in this thread.

Now back to the recent changes ... I don't actually have that much
comment on the recent changes ...

> autoload -Uz compinit; compinit -d $zcachedir/compdump

I should have thought to ask about this before:  Why is this changed
from the default location?  If we feel the default is wrong, shouldn't
we be patching compinit?  (Oddly, compinit and compdump disagree on
what the default should be.)

Incidentally, I append -$ZSH_VERSION to the compdump file name.

> zmodload -F zsh/zutil b:zstyle    # Load `zstyle` builtin.

Hmm, I wouldn't think this was necessary after compinit.

> zstyle ':completion:*' completer _expand _complete _history _correct _ignored

Did I miss the reason for removing _oldlist?

Speaking of things I missed:

PS2='%S%_%s > '  # Left side
RPS2=' < %S%^%s' # Right side

I would suggest that if we are going to use RPS2 + TRANSIENT_RPROMPT,
that we set PS2=''.  The advantage to this is that after entering a
multi-line command, all the prompts except PS1 have disappeared, and
you have something you can copy-paste, which we've been striving for
elsewhere (e.g. PS4).

That's really about it for this pass.  I'll try to find time tomorrow
to respond to some of the earlier discussion.




Messages sorted by: Reverse Date, Date, Thread, Author