It is currently Tue, 07 Dec 2021 02:19:40 GMT



 
Author Message
 tcsh: complete with backreference
Dear all,

does anyone know whether (and how) tcsh's "complete" directive can
be used to do a completion based on the current word or predecessor
word _as a parameter_? I did not find that, and I would like to see sth.
like
sed's \1 parameter. Example:

complete myprog 'c,*/,`... \1 ...`,'

which I would like to pass whatever was matched by "*/" in \1 (serving in
the example as an argument for a command generating the choice list).
It would also help if I could have that as a path component (in F:...).
I understand that I could enumerate the possibilities:

complete myprog 'c,abc/,`... abc ...`,'
complete myprog 'c,def/,`... def ...`,'
...

but that is not an option. I have tcsh-6.10.00 on Solaris 8 here.

Thanks a lot for any suggestions,

Marek



 Tue, 14 Nov 2006 22:12:37 GMT   
 tcsh: complete with backreference

See for example how I extract the name of the makefile passed as
a -f argument:

complete *make  'n/-f/f/' \
                'C|*/|f|' \
                'N@-f@`~/share/bin/complete/make.perl $:-1`@@' \
                'n@*@`~/share/bin/complete/make.perl`@@'

I stopped using tcsh several years ago, so I can't remember exactly what
problems can come up.

        Stefan



 Wed, 15 Nov 2006 00:47:48 GMT   
 tcsh: complete with backreference
In article <jwvzn7sijsq.fsf-monnier+comp.unix.sh...@gnu.org>,
Stefan Monnier  <monn...@iro.umontreal.ca> wrote:
...

I'm very sorry to hear that.  What happened?  Lose job?  Get divorced?



 Wed, 15 Nov 2006 01:05:16 GMT   
 tcsh: complete with backreference
Hello Stefan,

thanks a lot: the missing information for me was that using $:-N one
can refer to the current (N=0) or preceding words on the command
line. Version 6.12.00 does not document this, as far as I can see.

Keep up the good work,

Marek



 Sat, 18 Nov 2006 19:55:58 GMT   
 
   [ 4 post ] 

Similar Threads

1. tcsh & complete

2. complete function in tcsh

3. tcsh: completing ssh commands

4. case insensitive file complete with tcsh

5. Tcsh builtin command "complete"

6. nice tcsh complete for 'make'

7. complete tcsh

8. tcsh - complete command

9. How to use complete in tcsh?

10. tcsh complete mechanism


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software