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

Re: example startup file



On May 8,  6:58pm, Oliver Kiddle wrote:
> Subject: example startup file
> 
> I've not commited this yet to allow for any objections.

No objections; comments intermingled below.

> Also, I'm not too happy with the autoload for loop: if it finds no
> executable files in a directory it emits an error and returns. Does
> anyone have any better suggestions which keep things simple. As I see
> it, you either also loop for files or use the N nullglob flag and
> redirect outout because autoload with no arguments outputs all
> functions.

I actually do *both* of those in my .zshrc ...

    autoload $dirname/*(N-.x:t) > /dev/null

(The `-' is to follow symlinks, doesn't seem to be any reason not to.)
However, if you know (as in the example) that fpath is non-empty, you can
just do one loop like this:

    for func in $^fpath/*(N-.x:t); autoload $func

> I get directories in fpath duplicated with this .zshrc after compinit
> which isn't too good. Maybe typeset -U fpath should be the default?

I use:

    typeset -U path cdpath fpath manpath

> --- /home/kiddleo/cvs/zsh/StartupFiles/zshrc	Mon Mar 26 00:41:02 2001
> +++ zshrc	Tue May  8 18:42:07 2001
> @@ -42,19 +42,19 @@
>  
>  # Shell functions
>  setenv() { export $1=$2 }  # csh compatibility

That never was csh-compatible.  This is:

    setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" }

> +freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done }

I'd throw in a check that the argument actually is a function before calling
unfunction on it.

> +bindkey ' ' magic-space    # also do history expansion on space

That reminds me ... magic-space should magically turn itself off when there
is a !" somewhere to the left of it on the line.  As it is now, !" vanishes
as soon as you type a magic-space, which sort of defeats the purpose.



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