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

Re: Rewrite of zsh-newuser-install



On Tue, Feb 9, 2021 at 3:42 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

Thanks for your suggestions! I will apply most of them; maybe even all
of them. I just have a couple of questions/remarks about some of them:

> %F{8} and %F{12} do nothing on my terminal (ssh in Terminal.app from
> Mac to Ubuntu, in this case), they just emit the same as %F{default},
> so I don't know what you're after with those.  Don't use numerics.

I can change it, but I want to note that I happen to use macOS's
Terminal.app to ssh to an Ubuntu server, too, and it works fine for me
there.

> I don't have a strong opinion about the PS4 prompt, but here's mine:
> PS4=": %1N:%i%1(_.:%_.); "
> This makes the prompt string into a ":" command ending at ";" so most
> of the time you can copy-paste the PS4 output directly back to the PS1
> input and hit enter to run it.  Same trick used in $HISTFILE for
> extended history.  Putting extra newlines and characters like ">" in
> PS4 make that impossible.

That's a nice trick. :) Here's my own PS4:

local dim=$'%{\e[02m%}'
typeset -gH PS4prv='foo'
typeset -gH PS4cur=$'\n%e %F{g}%N%f '${dim}$'%x\n'
PS4=$'%(?,,\t→ %F{r}%?%f\n)'
PS4+=$'${${${(%)PS4prv}:#${(%)PS4cur}}:+${PS4prv::=${(%)PS4cur}}}'
PS4+=${dim}$'%I%b\t%(1_,%F{y}%_%f ,)'

But I felt that was a bit too complex for new users. ;) The output is
very nice, though. :)

> RE key bindings/line-init:
>
> Wasn't there a sidebar into why terminfo isn't trustworthy?  In any
> case, application mode is exactly the opposite of how I want my shell
> behaving, unless I'm misinterpreting your code.

If we don't put the terminal into application mode, then we cannot use
terminfo. Also, my takeaway from the sidebar was not that terminfo
isn't trustworthy; just that it doesn't account for _everything._ Not
using terminfo is even less trustworthy. If we don't put the terminal
into application mode, then from where are we going to get the key
codes we need? Plus, there doesn't appear to be any viable
alternatives to terminfo.

> Don't mess with Ctrl-U.

Why not? Control-U does backward-kill-line everywhere, except in Zsh.
It's annoying to get the whole line killed by Control-U _and_ not to
have a default key binding for backward-kill-line.

> I'm not sure I like your choices for Enter / Alt-Enter in menuselect,
> because it seems to presume that the most common case is to do
> menu-selection on the last word being entered for a command ... but my
> experience is that I'm more often using menu-selection on the set of
> command-line options, which typically have to be followed by
> additional arguments.

I didn't make any such assumption. I use menu selection quite at
random; mostly when I cannot get what I want at the top of the list by
typing. Can you please explain how you came to that conclusion and how
my choice of menuselect bindings would impact your case?




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