Deleted Added
full compact
complete.tcsh (69408) complete.tcsh (83098)
1#
1#
2# $Id: complete.tcsh,v 1.36 2000/11/19 20:50:42 christos Exp $
2# $Id: complete.tcsh,v 1.37 2001/09/02 21:06:02 christos Exp $
3# example file using the new completion code
4#
5
6onintr -
7if (! $?prompt) goto end
8
9if ($?tcsh) then
10 if ($tcsh != 1) then
11 set rev=$tcsh:r
12 set rel=$rev:e
13 set pat=$tcsh:e
14 set rev=$rev:r
15 endif
16 if ($rev > 5 && $rel > 1) then
3# example file using the new completion code
4#
5
6onintr -
7if (! $?prompt) goto end
8
9if ($?tcsh) then
10 if ($tcsh != 1) then
11 set rev=$tcsh:r
12 set rel=$rev:e
13 set pat=$tcsh:e
14 set rev=$rev:r
15 endif
16 if ($rev > 5 && $rel > 1) then
17 set complete=1
17 set _complete=1
18 endif
19 unset rev rel pat
20endif
21
18 endif
19 unset rev rel pat
20endif
21
22if ($?complete) then
22if ($?_complete) then
23 set noglob
24 set hosts
25 foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
26 if ( -r $f ) then
27 set hosts = ($hosts `grep -v "+" $f | tr -s " " " " | cut -f 1`)
28 endif
29 end
30 if ( -r $HOME/.netrc ) then

--- 587 unchanged lines hidden (view full) ---

618 no-host-lookup no-parent non-verbose \
619 output-document= output-file= passive-ftp \
620 proxy-passwd= proxy-user= proxy= quiet quota= \
621 recursive reject= relative retr-symlinks save-headers \
622 server-response span-hosts spider timeout= \
623 timestamping tries= user-agent= verbose version wait=)"/
624
625 # these from Tom Warzeka <tom@waz.cc>
23 set noglob
24 set hosts
25 foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
26 if ( -r $f ) then
27 set hosts = ($hosts `grep -v "+" $f | tr -s " " " " | cut -f 1`)
28 endif
29 end
30 if ( -r $HOME/.netrc ) then

--- 587 unchanged lines hidden (view full) ---

618 no-host-lookup no-parent non-verbose \
619 output-document= output-file= passive-ftp \
620 proxy-passwd= proxy-user= proxy= quiet quota= \
621 recursive reject= relative retr-symlinks save-headers \
622 server-response span-hosts spider timeout= \
623 timestamping tries= user-agent= verbose version wait=)"/
624
625 # these from Tom Warzeka <tom@waz.cc>
626 # you may need to set the following variables for your host
627 set _elispdir = /usr/local/share/emacs/20.7/lisp # GNU Emacs lisp directory
628 set _maildir = /var/spool/mail # Post Office: /var/spool/mail or /usr/mail
629 set _ypdir = /var/yp # directory where NIS (YP) maps are kept
630 set _domain = "`domainname`"
631
632 # this one works but is slow and doesn't descend into subdirectories
633 # complete cd C@[./\$~]*@d@ \
634 # p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
635
636 if ( -r /etc/shells ) then
637 complete setenv p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
638 else
639 complete setenv p@1@e@ n@DISPLAY@\$hosts@:
640 endif
641 complete unsetenv n/*/e/
642
626
627 # this one works but is slow and doesn't descend into subdirectories
628 # complete cd C@[./\$~]*@d@ \
629 # p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
630
631 if ( -r /etc/shells ) then
632 complete setenv p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
633 else
634 complete setenv p@1@e@ n@DISPLAY@\$hosts@:
635 endif
636 complete unsetenv n/*/e/
637
638 if (-r /var/spool/mail) then
639 set _maildir = /var/spool/mail
640 else
641 set _maildir = /usr/mail
642 endif
643 if (-r $HOME/.mailrc) then
644 complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
645 c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
646 n@-u@T:$_maildir@ n/-f/f/ \
647 n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " " " | cut -f 2`'@
648 else
649 complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
650 c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
651 n@-u@T:$_maildir@ n/-f/f/ n/*/u/
652 endif
643 if (-r $HOME/.mailrc) then
644 complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
645 c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
646 n@-u@T:$_maildir@ n/-f/f/ \
647 n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " " " | cut -f 2`'@
648 else
649 complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
650 c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
651 n@-u@T:$_maildir@ n/-f/f/ n/*/u/
652 endif
653 unset _maildir
653
654
654 complete man n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
655 n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
656 n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
657 n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
658 n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
659 n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
660 n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
661 n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
662 n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
663 n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
664 n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
665 n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
666n@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
667n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
668 c/-/"(- f k M P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-[MP]/d/ \
669 N@-[MP]@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
655 if (-r /usr/share/man) then
656 set _man_dir = /usr/share/man
657 else
658 set _man_dir = /usr/man
659 endif
660 complete man \
661 n@0@\`if\ \(-r\ $_man_dir/man0\)\ \\ls\ -1\ $_man_dir/man0\ \|\ sed\ s%\\\.0.\\\*\\\$%%\`@ \
662 n@1@\`if\ \(-r\ $_man_dir/man1\)\ \\ls\ -1\ $_man_dir/man1\ \|\ sed\ s%\\\.1.\\\*\\\$%%\`@ \
663 n@2@\`if\ \(-r\ $_man_dir/man2\)\ \\ls\ -1\ $_man_dir/man2\ \|\ sed\ s%\\\.2.\\\*\\\$%%\`@ \
664 n@3@\`if\ \(-r\ $_man_dir/man3\)\ \\ls\ -1\ $_man_dir/man3\ \|\ sed\ s%\\\.3.\\\*\\\$%%\`@ \
665 n@4@\`if\ \(-r\ $_man_dir/man4\)\ \\ls\ -1\ $_man_dir/man4\ \|\ sed\ s%\\\.4.\\\*\\\$%%\`@ \
666 n@5@\`if\ \(-r\ $_man_dir/man5\)\ \\ls\ -1\ $_man_dir/man5\ \|\ sed\ s%\\\.5.\\\*\\\$%%\`@ \
667 n@6@\`if\ \(-r\ $_man_dir/man6\)\ \\ls\ -1\ $_man_dir/man6\ \|\ sed\ s%\\\.6.\\\*\\\$%%\`@ \
668 n@7@\`if\ \(-r\ $_man_dir/man7\)\ \\ls\ -1\ $_man_dir/man7\ \|\ sed\ s%\\\.7.\\\*\\\$%%\`@ \
669 n@8@\`if\ \(-r\ $_man_dir/man8\)\ \\ls\ -1\ $_man_dir/man8\ \|\ sed\ s%\\\.8.\\\*\\\$%%\`@ \
670 n@9@\`if\ \(-r\ $_man_dir/man9\)\ \\ls\ -1\ $_man_dir/man9\ \|\ sed\ s%\\\.9.\\\*\\\$%%\`@ \
671 n@new@\`if\ \(-r\ $_man_dir/mann\)\ \\ls\ -1\ $_man_dir/mann\ \|\ sed\ s%\\\.n.\\\*\\\$%%\`@ \
672 n@old@\`if\ \(-r\ $_man_dir/mano\)\ \\ls\ -1\ $_man_dir/mano\ \|\ sed\ s%\\\.o.\\\*\\\$%%\`@ \
673 n@local@\`if\ \(-r\ $_man_dir/manl\)\ \\ls\ -1\ $_man_dir/manl\ \|\ sed\ s%\\\.l.\\\*\\\$%%\`@ \
674 n@public@\`if\ \(-r\ $_man_dir/manp\)\ \\ls\ -1\ $_man_dir/manp\ \|\ sed\ s%\\\.p.\\\*\\\$%%\`@ \
675 c@-@"(- f k M P s t)"@ n@-f@c@ n@-k@x:'<keyword>'@ n@-[MP]@d@ \
676 n@-s@\`\\ls\ -1\ $_man_dir\ \|\ sed\ -n\ s%man%%p\`@ \
677 N@-[MP]@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n@*@c@
678 unset _man_dir
670
671 complete ps c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
672 n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
673 complete compress c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
674 complete uncompress c/-/"(c f v)"/ n/*/f:*.Z/
675
676 complete uuencode p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
677 complete uudecode c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
678
679 complete xhost c/[+-]/\$hosts/ n/*/\$hosts/
680
681 # these conform to the latest GNU versions available at press time ...
682 # updates by John Gotts <jgotts@engin.umich.edu>
679
680 complete ps c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
681 n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
682 complete compress c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
683 complete uncompress c/-/"(c f v)"/ n/*/f:*.Z/
684
685 complete uuencode p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
686 complete uudecode c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
687
688 complete xhost c/[+-]/\$hosts/ n/*/\$hosts/
689
690 # these conform to the latest GNU versions available at press time ...
691 # updates by John Gotts <jgotts@engin.umich.edu>
692 if (-X emacs) then
693 # TW note: if your version of GNU Emacs supports the "--version" option,
694 # uncomment this line and comment the next to automatically
695 # detect the version, else replace "20.7" with your version.
696 #set _emacs_ver=`emacs --version | head -1 | sed 's%GNU Emacs %%' | cut -d . -f1-2`
697 set _emacs_ver=20.7
698 set _emacs_dir=`which emacs | sed s%/bin/emacs%%`
699 complete emacs c/--/"(batch terminal display no-windows no-init-file \
700 user debug-init unibyte multibyte version help \
701 no-site-file funcall load eval insert kill)"/ \
702 c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
703 n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
704 n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
705 n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
706 n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
707 unset _emacs_ver _emacs_dir
708 endif
683
709
684 complete emacs c/-/"(batch d f funcall i insert kill l load \
685 no-init-file nw q t u user)"/ c/+/x:'<line_number>'/ \
686 n/-d/x:'<display>'/ n/-f/x:'<lisp_function>'/ n/-i/f/ \
687 n@-l@F:$_elispdir@ n/-t/x:'<terminal>'/ \
688 n/-u/u/ n/*/f:^*[\#~]/
689
690 complete gzcat c/--/"(force help license quiet version)"/ \
691 c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
692 complete gzip c/--/"(stdout to-stdout decompress uncompress \
693 force help list license no-name quiet recurse \
694 suffix test verbose version fast best)"/ \
695 c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
696 n/{-S,--suffix}/x:'<file_name_suffix>'/ \
697 n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \

--- 176 unchanged lines hidden (view full) ---

874 # BSD 4.2 filesystems
875 #complete mount c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
876 # n@*@'`cut -d ":" -f 2 /etc/fstab`'@
877 #complete umount c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
878 # n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
879 # n/*/'`mount | cut -d " " -f 3`'/
880
881 # these deal with NIS (formerly YP); if it's not running you don't need 'em
710 complete gzcat c/--/"(force help license quiet version)"/ \
711 c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
712 complete gzip c/--/"(stdout to-stdout decompress uncompress \
713 force help list license no-name quiet recurse \
714 suffix test verbose version fast best)"/ \
715 c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
716 n/{-S,--suffix}/x:'<file_name_suffix>'/ \
717 n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \

--- 176 unchanged lines hidden (view full) ---

894 # BSD 4.2 filesystems
895 #complete mount c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
896 # n@*@'`cut -d ":" -f 2 /etc/fstab`'@
897 #complete umount c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
898 # n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
899 # n/*/'`mount | cut -d " " -f 3`'/
900
901 # these deal with NIS (formerly YP); if it's not running you don't need 'em
882 complete domainname p@1@D:$_ypdir@" " n@*@n@
883 complete ypcat c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
884 N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
885 n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
886 complete ypmatch c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
887 N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
888 n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
889 complete ypwhich c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
890 n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
891 N@-m@n@ n@*@\$hosts@
902 if (-X domainname) then
903 set _domain = "`domainname`"
904 set _ypdir = /var/yp # directory where NIS (YP) maps are kept
905 if ("$_domain" != "" && "$_domain" != "noname") then
906 complete domainname p@1@D:$_ypdir@" " n@*@n@
907 complete ypcat c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
908 N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
909 n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
910 complete ypmatch c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
911 N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
912 n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
913 complete ypwhich c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
914 n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
915 N@-m@n@ n@*@\$hosts@
916 endif
917 unset _domain _ypdir
918 endif
892
919
893 # there's no need to clutter the user's shell with these
894 unset _elispdir _maildir _ypdir _domain
895
896 complete make \
897 'n/-f/f/' \
898 'c/*=/f/' \
899 'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^ #].*:/s/:.*//p"`@'
900
901 if ( -f /etc/printcap ) then
902 set printers=(`sed -n -e "/^[^ #].*:/s/:.*//p" /etc/printcap`)
903
904 complete lpr 'c/-P/$printers/'
905 complete lpq 'c/-P/$printers/'
906 complete lprm 'c/-P/$printers/'
907 complete lpquota 'p/1/(-Qprlogger)/' 'c/-P/$printers/'
908 complete dvips 'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
909 complete dvilj 'p/*/f:*.dvi/'
910 endif
911
912 unset noglob
920 complete make \
921 'n/-f/f/' \
922 'c/*=/f/' \
923 'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^ #].*:/s/:.*//p"`@'
924
925 if ( -f /etc/printcap ) then
926 set printers=(`sed -n -e "/^[^ #].*:/s/:.*//p" /etc/printcap`)
927
928 complete lpr 'c/-P/$printers/'
929 complete lpq 'c/-P/$printers/'
930 complete lprm 'c/-P/$printers/'
931 complete lpquota 'p/1/(-Qprlogger)/' 'c/-P/$printers/'
932 complete dvips 'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
933 complete dvilj 'p/*/f:*.dvi/'
934 endif
935
936 unset noglob
913 unset complete
937 unset _complete
914endif
915
916end:
917 onintr
938endif
939
940end:
941 onintr