zsh-users
 help / color / mirror / code / Atom feed
* Please help notorious "space"-mistyper
@ 1999-11-14 13:52 Jens Schleusener
  1999-11-14 17:23 ` Bart Schaefer
  1999-11-14 17:50 ` Stefan Troeger
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Schleusener @ 1999-11-14 13:52 UTC (permalink / raw)
  To: zsh-users

Hi,

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.

Can the power of zsh help me? For e.g. checking if the input line starts
with the string "cd" with a following no-space character and inserting
a space if the first word (starting with "cd") isn't a valid command.

Sorry, I am not a zsh-expert and concede that I haven't read all available 
zsh documentation :-( 

Greetings

Jens

-- 
Dr. Jens Schleusener            debis Systemhaus
phone: +49 (551) 709-2493       Solutions for Research
fax:   +49 (551) 709-2169       Bunsenstr.10
mail: Jens.Schleusener@dlr.de   D-37073 Goettingen


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Please help notorious "space"-mistyper
  1999-11-14 13:52 Please help notorious "space"-mistyper Jens Schleusener
@ 1999-11-14 17:23 ` Bart Schaefer
  1999-11-14 17:50 ` Stefan Troeger
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-11-14 17:23 UTC (permalink / raw)
  To: Jens Schleusener, zsh-users

On Nov 14,  2:52pm, Jens Schleusener wrote:
} Subject: Please help notorious "space"-mistyper
}
} [...]  unfortunately nearly each second time I type (too fast)
} 
}  cddirectory
} 
} instead of
} 
}  cd directory
} 
} Can the power of zsh help me?

If you use

	setopt autocd

then you can leave off the "cd" entirely and just type

	directory

You could also try

	bindkey -s 'cd' '^Vcd '

but then you may find yourself needing to erase an extra space in other
unexpected places, like in the middle of the word "anecdote" (not that
you're ever particularly likely to type "anecdote" in the shell).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Please help notorious "space"-mistyper
  1999-11-14 13:52 Please help notorious "space"-mistyper Jens Schleusener
  1999-11-14 17:23 ` Bart Schaefer
@ 1999-11-14 17:50 ` Stefan Troeger
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Troeger @ 1999-11-14 17:50 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-11-14 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-14 13:52 Please help notorious "space"-mistyper Jens Schleusener
1999-11-14 17:23 ` Bart Schaefer
1999-11-14 17:50 ` Stefan Troeger

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).