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

Re: Mimicking tcsh line-editing behavior



On Thu, 2 Jul 2009, Mikael Magnusson wrote:

> On 2009/7/2 Rhyme Tan wrote:
> > My default shell is tcsh. In tcsh I can use alt(meta)-backspace, alt-F or
> > alt-B to delete, or move forward or backward through a path.
> >
> > For example I type:
> >
> > ls /An/Example/of/a/Path/Name/
> >
> > To delete Path/Name/, I simply hold down the alt key and press backspace
> > twice (alt-backspace x2). This will leave me with the path
> > "/An/Example/of/a/". I cannot do this in zsh because pressing
> > alt-backspace will delete the whole path (that is,
> > "/An/Example/of/a/Path/Name/"). Is there some magic config option
> > I can pass to zsh to duplicate the behavior of alt-backspace, -F, or -B) in
> > tcsh?
> >
> > Thanks.
> 
> This was posted here some time ago (months, years, who knows?) and I
> have used it since:
> 
> _my_extended_wordchars='*?_-.[]~=&;!#$%^(){}<>:@,\\';
>
> [... trimmed ...]

Mikael -- that seems like overkill... Is there something particularly 
useful about all of the "\\"- and quoted-or-not logic?

I get roughly what the OP was asking for by simply setting:

WORDCHARS='*?_-.[]~&;!#$%^(){}<>'

in my ~/.zshenv.

The important bit is that '/' is not present in my preferred WORDCHARS 
list, but it is in the default list.  ('.' is another one that seems to be 
commonly omitted, in order to backspace to the '.'s in domain names/IP 
addresses or file.extensions.)

Best,
Ben



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