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

Re: Please help notorious "space"-mistyper



Hi,

On Sun, Nov 14, 1999 at 14:52 +0100, Jens Schleusener wrote:

> I like to use zsh and the command line and change often the working
> directory. But unfortunately nearly each second time I type (too fast)
> 
>  cddirectory
> 
> instead of
> 
>  cd directory
> 
> That is time consuming and nerve-racking.

Try

function my-accept-line()
{
    if ! whence $BUFFER >/dev/null && [[ $BUFFER == cd* ]] && [[ -d ${BUFFER#cd} ]]; then
            BUFFER=${BUFFER/#cd/cd }
    fi
    zle accept-line
}
zle -N my-accept-line
bindkey "^m" my-accept-line

Ciao,
	Stefan



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