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

Re: Rewrite of zsh-newuser-install

[ for skimmers: there's an unrelated question in the P.S.. ]

Marlon Richert wrote on Sat, Mar 20, 2021 at 00:12:28 +0200:
> Hi all! I pushed in another update:
> https://gitlab.com/marlonrichert/zsh-sensible/-/blob/master/zshrc
> I reorganized the entire .zshrc file in an effort to make it easier to
> read. I'd love to get your feedback.
> Also, I'm wondering: How do you plan to make a decision on moving
> forward with this? At which point are the new files good enough to
> replace the existing zsh-newuser-install?

Here's a quick review of zshrc and your version of zsh-newuser-install.

Haven't read the entire thread yet, so apologies if I'm repeating issues
previously raised.

Issues in the first-run wizard:

0. I recommend against reusing the name zsh-newuser-install for
a completely different thing.  Names shouldn't be overloaded.

1. Errors from «mkdir ZDOTDIR» are discarded.

2. Uses of eval are unsafe (lack ${(q)}) and unnecessary.

3. That also applies to the munging of $template.

4. "$zshrc~" is silently overwritten

5. what happens if the exec on the last line fails?

6. Outputting `man zsh' in two different colours is confusing.

7. zsh's homepage is https://www.zsh.org/.

8. zrestart doesn't handle $ZDOTDIR.

9. For educational purposes, printing should use «print -r --» throughout.

10. Should zrestart use «exec»?

11. «print '\n'» prints _two_ newlines.  That's too obscure for
educational code.

Issues in zshrc:

12. Some settings seems like they could break the principle of least
surprise: e.g., FLOW_CONTROL, NUMERIC_GLOB_SORT, matcher 'b:-=+',
check-for-changes (as opposed to check-for-staged-changes).

13. Recommend not to hide symbols from grep, as in up-line-or-{search,history}

14. Use of «bindkey -s … '^Q…'» seems questionable.  As a way to inject
commands, it prints them to the tty and adds them to the history; that
doesn't seem elegant enough for example code that all new users would be
pointed to.  It's also brittle in that it depends on ^Q not being
re-bindkey'd to anything else.

A few proposed additions:

15. hjkl bindings for menu selection:

    if zmodload zsh/complist 2>/dev/null || (( ${+keymaps[(r)menuselect]} )); then
      bindkey -M menuselect j down-line-or-history
      bindkey -M menuselect k up-line-or-history
      bindkey -M menuselect h backward-char
      bindkey -M menuselect l forward-char

17. Configure vcs_info to show the original patch's information during
rebases, etc..  It basically boils down to doing
«hook_com[applied-string]=$1» in a gen-applied-string hook.  I posted
a fuller version in workers/47519 at the end.

18. Show how to use terminal colours/attributes other than the basic
ones.  E.g., I use ${terminfo[dim]} in some places.



P.S.  I wonder if «: <->» should always behave as though
NUMERIC_GLOB_SORT is set.  Haven't tried to nail down a complete
functional spec yet; just thinking out loud.

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