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

EOF in read-from-minibuffer causes delayed exit



Start a shell you don't mind exiting from.  Cut'n'paste the following:

autoload -U read-from-minibuffer
insert-file() {
    local REPLY
    while [[ ! -r $REPLY ]]
    do
	read-from-minibuffer 'Insert file: ' $REPLY || return 1
	[[ -r $REPLY ]] || zle beep
    done
    if zmodload -i zsh/mapfile
    then RBUFFER="$mapfile[$REPLY]$RBUFFER"
    else RBUFFER="$(<$REPLY)$RBUFFER"
    fi
}
zle -N insert-file

Invoke this with ESC-x insert-file RET.

Now type ctrl-D.  Note feep.  Type ctrl-G.  Shell exits.



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