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

Re: Rewrite of zsh-newuser-install



On Tue, Feb 9, 2021 at 1:42 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> https://gitlab.com/marlonrichert/zsh-sensible/-/commit/3d867257b7dcdb7826bc07f44756ba30bf539fda?w=1

> # %F{x}: set bacKground color to x;  %k: default bacKground color

Typo, should be %K{x}

> # $(( [#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 %~.

> add-zle-hook-widget line-finish :zshrc:timer

See previous comments in other messages, but if keeping this I'd put
it in preexec instead.

> PS4=$': -> %(?,%F{g},%F{b}%K{r})%?%f%k\t%e: %F{g}%1N %f%2x:%I ;
> %(1_,%S%_%s ,)%f%k'

The :...; trick doesn't work if you have an ">" in PS4, it becomes a
redirection upon copy-paste.  I don't think you need the semicolon if
you have a newline.

> # 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?

> typeset -T LS_COLORS ls_colors

Per previous discussion, I'd protect this with a test that LS_COLORS
is set.  Unless you've setopt WARN_CREATE_GLOBAL, the later reference
to "$ls_colors[@]" will be harmless.

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.

> () {
>  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?

> setopt AUTO_PUSHD # Go back to previous dirs with `cd (+|-)[<num>]` or `~(+|-)[<num>]`.

That description doesn't seem quite right to me.  The behavior of cd
doesn't depend on this option; it depends on using the directory
stack, but you can do that without AUTO_PUSHD.

I think we've commented regarding everything else.  Thanks again.




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