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

Re: PATCH: newuser system



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> This is an impressive piece of work.

Thank you.

> } As this will be seen by a great many new users it
> } really needs to be tested as widely as possible.
> 
> Am I wrong in thinking this could be tested by starting the shell with
> ZDOTDIR in the environment pointing to an empty directory?

That works fine.  Anyone can try it out by:

mkdir /tmp/zdotdir
autoload -Uz zsh-newuser-install
ZDOTDIR=/tmp/zdotdir zsh-newuser-install

(add -f to the end if there's already a .zshrc there.)

> } Index: INSTALL
> } +"name=zsh/newuser" int the config.modules file, which is generated in the
>                        ^^
> (I didn't proofread the rest so closely, I fear.)

I'll check that in.

> } +# Substitute an initial ~ for human consumption.
> } +if [[ $zd = $HOME ]]; then
> } +  zdmsg="~"
> } +else
> } +  zdmsg=$zd
> } +fi
> 
>   zdmsg=${(%):-%~}
> 
> (How's *that* for obfuscation?)

That would deserve another "snicker", but $zd isn't necessarily the current
directory at that point, and we'd like to keep the directory after the
function exits... still, it's certainly a good idea to fix directories
under $HOME and I've done that in the patch.

> Regarding keymaps ... it might be helpful if the explanatory text were
> to recommend choosing the emacs keymap, as that's the one assumed by
> most of the completion system initialization and the one most similar
> to other line editors (e.g. bash/readline).

This is the message you get when you enter the appropriate menu, so it's
explained... but maybe I could set the initial state to "Recommended" and
the default so that it picks "bindkey -e" unless you explicitly tell it not
to?  (This is what happens in the history menu---if you pick that option it
sets your HISTSIZE and SAVEHIST to 1000 unless you explicitly edit them.)


Default editing configuration
=============================

The keys in the shell's line editor can be made to behave either
like Emacs or like Vi, two common Unix editors.  If you have no
experience of either, Emacs is recommended.  If you don't pick one,
the shell will try to guess based on the EDITOR environment variable.
Usually it's better to pick one explicitly.

# (1) Change default editing configuration
# bindkey -e                                                     (no value set)

# (0) or (q)  Return to main menu (no changes made yet)

--- Type one of the keys in parentheses ---


Index: INSTALL
===================================================================
RCS file: /cvsroot/zsh/zsh/INSTALL,v
retrieving revision 1.20
diff -u -r1.20 INSTALL
--- INSTALL	23 Nov 2005 11:29:20 -0000	1.20
+++ INSTALL	24 Nov 2005 11:40:59 -0000
@@ -243,7 +243,7 @@
 /usr/local/share/zsh/<VERSION>/scripts/newuser).  This feature can be
 turned off simply by removing this script.  The module can be removed
 entirely from the configured shell by editing the line starting
-"name=zsh/newuser" int the config.modules file, which is generated in the
+"name=zsh/newuser" in the config.modules file, which is generated in the
 top level distribution directory during configuration: change the line to
 include "link=no auto=no".
 
Index: Functions/Newuser/zsh-newuser-install
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Newuser/zsh-newuser-install,v
retrieving revision 1.2
diff -u -r1.2 zsh-newuser-install
--- Functions/Newuser/zsh-newuser-install	23 Nov 2005 11:29:21 -0000	1.2
+++ Functions/Newuser/zsh-newuser-install	24 Nov 2005 11:41:00 -0000
@@ -61,8 +61,8 @@
 trap 'save=0' HUP INT QUIT
 
 # Substitute an initial ~ for human consumption.
-if [[ $zd = $HOME ]]; then
-  zdmsg="~"
+if [[ $zd = $HOME(#b)(|/*) ]]; then
+  zdmsg="~$match[1]"
 else
   zdmsg=$zd
 fi

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com



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