From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23674 invoked from network); 7 Mar 2000 07:36:57 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Mar 2000 07:36:57 -0000 Received: (qmail 14288 invoked by alias); 7 Mar 2000 07:36:42 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2955 Received: (qmail 14270 invoked from network); 7 Mar 2000 07:36:41 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: "Zefram" , Cc: Subject: RE: some directory changing tools to share Date: Tue, 7 Mar 2000 10:36:37 +0300 Message-ID: <000201bf8807$df037e80$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Importance: Normal In-Reply-To: Just to add some more sugar and correct some mistakes :-) > > > 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}' This won't work for two reasons. 1. to allow lower case on _command_line_ to match upper case in _file_names_ (in our case) matcher is exactly other way round 2. the 'matcher-list' is gobal and cannot be set on per-command basis. The above will be ignored by Zsh. If you want it to apply to just cd - use "matcher" style (you even can specify, that only local directories and not directories in CDPATH should be treated this way). So, the correct way is zstyle ':completion:*:cd:*' matcher 'm:{a-z}={A-Z}' Oh, yes, and this will work for any directory in your CDPATH - not just for subdirectory of your current dir. > > 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. > And you can turn on visual full screen selection so that you can select match from the list using customary Up/Down/Left/Right key binding (cursor keys). This may save you some TABs if list is long. > >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. > And if you use menu selection mentioned above, you can press "/" and this will try to complete next level immediately. > > c p t g > > > >takes you all the way to Perl/Test/Gui. > > "cd ptg". > Actually, with current completion and the above matcher this is even simpler: cd p/t/g If the Perl/Test/Gui is unambiguous, it will be immediately expanded. If you happen to have Perl/Test/Gui and Perl/Trash/Gum Zsh will expand the longest prefix. What happens then, is configurable - I personally set it to start menu selection, so I get something like cd Perl/T/G Test Trash and can select Test, press "/" and immediately start completing inside of Perl/Test. Or enter "e" (note - cursor is exactly at the right place) and hit TAB once more - and it will expand the whole input. And, as mentioned by Zefram, you have full control and see exactly what thye result is. And can always cancel command you you made a mistake. Hey, is not this cool! :)) -andrej Have a nice DOS! B >>