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

Re: some directory changing tools to share



zefram,

Thank you very much for your interest and comments.  I am
aware that completion does some of what "c" does, but
perhaps not "most".  

The real potential of "c" is not in simply moving down the
subdirectory tree from the current directory, but to jump to
another directory and then move down from there, namely, the
use of aliases, such as "P t g" to go to ~/Perl/Test/Gui or
in combination with the "d" operator.

mk

> 
> 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