From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19361 invoked from network); 7 Mar 2000 00:32:55 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Mar 2000 00:32:55 -0000 Received: (qmail 15336 invoked by alias); 7 Mar 2000 00:32:38 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2954 Received: (qmail 15328 invoked from network); 7 Mar 2000 00:32:38 -0000 Subject: Re: some directory changing tools to share In-Reply-To: <200003062114.PAA01448@w-kwong.ih.lucent.com> from "mkkwong@lucent.com" at "Mar 6, 2000 03:14:04 pm" To: mkkwong@lucent.com Date: Tue, 7 Mar 2000 00:32:34 +0000 (GMT) CC: zsh-users@sunsite.auc.dk X-Mailer: ELM [version 2.4ME+ PL66 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: From: Zefram 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". 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 ptg". > 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