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

Re: how to execute zle widget during zsh-init?



On Mon, 16 Aug 2004, Andy Spiegl wrote:

> -------------
> # increase the size of zle kill ring to 30
> 
> emulate -L zsh
> 
> : ${NUMERIC:=30}
> while (( NUMERIC-- )); do killring+=(''); done
> -------------

That could be more compactly written as

    grow-killring() {
	setopt localoptions noksharrays
	: ${killring[${NUMERIC:-30}]:=''}
    }

Arrays automatically grow to accomodate the largest element into which you 
store a value, even if you don't use the intervening elements.

> But now I can't find a practial way to "execute" it every time I start a
> new shell because it has to be done from inside zle. :-(

    zle-line-init() {
	zle grow-killring
	zle -D zle-line-init
    }
    zle -N zle-line-init



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