Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: some directory changing tools to share
- X-seq: zsh-users 2954
- From: Zefram <zefram@xxxxxxxx>
- To: mkkwong@xxxxxxxxxx
- Subject: Re: some directory changing tools to share
- Date: Tue, 7 Mar 2000 00:32:34 +0000 (GMT)
- Cc: zsh-users@xxxxxxxxxxxxxx
- In-reply-to: <200003062114.PAA01448@xxxxxxxxxxxxxxxxxxxxx> from "mkkwong@xxxxxxxxxx" at "Mar 6, 2000 03:14:04 pm"
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
mkkwong@xxxxxxxxxx wrote:
>non-directory filenames that also begins with "Le" (you can get around one
>of the problems by redefining the completion rules for "cd").
Actually most of what your "c" function does can be done with completion
in zsh. The standard completion for cd only completes to names of
directories anyway. With
zstyle ':completion:*:cd:*' matcher-list 'm:{A-Z}={a-z}'
completion on cd is one-way case insensitive, the way you want it.
With menu completion, you can have the lexically first match inserted
straight away (or with AUTO_MENU on the second or third tab), so you don't
even have to type an unambiguous prefix. Continuing menu completion,
you can get to matches other than the lexically first, still without
typing an unambiguous prefix. And the big advantage of completion over
your functions is that if you make a mistake, you can see it before
actually executing the command.
>Using my tool, you just type
>
> c l
With MENU_COMPLETE and the zstyle noted above, "cd l<tab>". If you use
AUTO_CD, you can actually drop the "cd " part.
>Rule 1 works recursively down the directory tree one level at a time, with
>unlimited depth.
Same for completion. It'll add a trailing "/" to any complete match
it inserts, after which you can press tab again to complete the next
level down. If in the middle of menu completion, and you don't want
to type any actual letters, type the "/" yourself to break out of menu
completion and then tab will start completion at the next level.
> c p t g
>
>takes you all the way to Perl/Test/Gui.
"cd p<tab>t<tab>g<tab>".
> ch (c ~) jumps to home directory
"cd" without arguments does this.
> c. (c ..) jumps to parent directory (similarly c.. c...)
I just type "..". (I have AUTO_CD set.)
> alias co='c $OFC'
> alias ct='c $TST'
> alias dev='c $DEV'
I find it useful in these cases to refer to "~OFC" etc. This means
that the current directory in my prompt (a "%~" sequence) will use these
names to shorten the directory specification. Completion works perfectly
happily after either "$FOO" or "~FOO".
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author