* Re: Completion of cd type functions?
1998-10-29 20:18 Completion of cd type functions? G. Khalsa
@ 1998-10-29 13:23 ` Peter Stephenson
1998-10-29 15:29 ` Michael Barnes
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 1998-10-29 13:23 UTC (permalink / raw)
To: G. Khalsa; +Cc: zsh-users
"G. Khalsa" wrote:
> alias cxxsrc 'cd ~/development/source/cxx/\!*'
> complete cxxsrc "p@1@D:$HOME/development/source/cxx@"
>
> This way I can just type cxxsrc from anywhere and have it complete only with
> directories in $HOME/development/source/cxx.
>
> Can I do this somehow in zsh (simply)?
In zsh 3.1, you need
cxxsrc() { cd ~/development/source/cxx/$1; }
compctl -W ~/development/source/cxx -/ cxxsrc
In older versions it's harder, particularly to get subdirectories.
You need to write a completion function which sticks the appropriate
part in front of the word so far, lists the directories that are
there, then deletes the front part of the word again and returns the
result; plus it still doesn't work as a path since in lists you get
the whole word, not just the last part of the path.
> Unfortunately the lete2ctl script fails when I try to run it so I can't get a
> ll
> my nifty tcsh completions translated automatically.
The supplied version doesn't go down too well with recent versions of
perl. There's a new version of lete2ctl for 3.1, which should appear
soon. It doesn't handle the 'D' code since that doesn't appear in any
of the tcsh manuals I have access to.
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Completion of cd type functions?
1998-10-29 13:23 ` Peter Stephenson
@ 1998-10-29 15:29 ` Michael Barnes
0 siblings, 0 replies; 3+ messages in thread
From: Michael Barnes @ 1998-10-29 15:29 UTC (permalink / raw)
To: zsh-users
Or just do:
cxx=$HOME/development/source/cxx/
compctl cd -g '*(-/)'
and then just do:
cd ~cxx/<TAB>
Note: this works with 3.0.x dont know about 3.1.x I would assume this
behaviour has not changed.
Michael Barnes
On Thu, Oct 29, 1998 at 02:23:38PM +0100, Peter Stephenson wrote:
> "G. Khalsa" wrote:
> > alias cxxsrc 'cd ~/development/source/cxx/\!*'
> > complete cxxsrc "p@1@D:$HOME/development/source/cxx@"
> >
> > This way I can just type cxxsrc from anywhere and have it complete only with
> > directories in $HOME/development/source/cxx.
> >
> > Can I do this somehow in zsh (simply)?
>
> In zsh 3.1, you need
>
> cxxsrc() { cd ~/development/source/cxx/$1; }
> compctl -W ~/development/source/cxx -/ cxxsrc
>
> In older versions it's harder, particularly to get subdirectories.
> You need to write a completion function which sticks the appropriate
> part in front of the word so far, lists the directories that are
> there, then deletes the front part of the word again and returns the
> result; plus it still doesn't work as a path since in lists you get
> the whole word, not just the last part of the path.
>
> > Unfortunately the lete2ctl script fails when I try to run it so I can't get a
> > ll
> > my nifty tcsh completions translated automatically.
>
> The supplied version doesn't go down too well with recent versions of
> perl. There's a new version of lete2ctl for 3.1, which should appear
> soon. It doesn't handle the 'D' code since that doesn't appear in any
> of the tcsh manuals I have access to.
>
> --
> Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
> WWW: http://www.ifh.de/~pws/
> Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Completion of cd type functions?
@ 1998-10-29 20:18 G. Khalsa
1998-10-29 13:23 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: G. Khalsa @ 1998-10-29 20:18 UTC (permalink / raw)
To: zsh-users
Hi,
I just switched from tcsh to zsh.
In tcsh I frequently defined aliases to cd directly to various directories and
used completion to move further from these directories:
Example:
alias cxxsrc 'cd ~/development/source/cxx/\!*'
complete cxxsrc "p@1@D:$HOME/development/source/cxx@"
This way I can just type cxxsrc from anywhere and have it complete only with
directories in $HOME/development/source/cxx.
Can I do this somehow in zsh (simply)? This seems pretty basic (it isn't even a
FAQ) but I can't figure it out. I got it to sort of work using a function that
invokes "find" but it is deadly slow.
As far as I understand it I create a function:
cxxsrc() { cd $HOME/development/source/cxx/$* }
but the completion part eludes me.
Unfortunately the lete2ctl script fails when I try to run it so I can't get all
my nifty tcsh completions translated automatically.
Thanks
Gurutej Khalsa
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-10-29 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-29 20:18 Completion of cd type functions? G. Khalsa
1998-10-29 13:23 ` Peter Stephenson
1998-10-29 15:29 ` Michael Barnes
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).