zsh-users
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: mkkwong@lucent.com
Cc: zsh-users@sunsite.auc.dk
Subject: Re: some directory changing tools to share
Date: Tue, 7 Mar 2000 00:32:34 +0000 (GMT)	[thread overview]
Message-ID: <E12S7vP-0001Dv-00@crucigera.fysh.org> (raw)
In-Reply-To: <200003062114.PAA01448@w-kwong.ih.lucent.com> from "mkkwong@lucent.com" at "Mar 6, 2000 03:14:04 pm"

mkkwong@lucent.com 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


  reply	other threads:[~2000-03-07  0:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-06 21:14 mkkwong
2000-03-07  0:32 ` Zefram [this message]
2000-03-07  7:36   ` Andrej Borsenkow
2000-03-07 15:33   ` mkkwong
2000-03-07 11:06 ` Oliver Kiddle
2000-03-07 17:46   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E12S7vP-0001Dv-00@crucigera.fysh.org \
    --to=zefram@fysh.org \
    --cc=mkkwong@lucent.com \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).