1 | # |
---|
2 | # $Id: complete.tcsh,v 1.1.1.2 1998-10-03 21:09:42 danw Exp $ |
---|
3 | # example file using the new completion code |
---|
4 | # |
---|
5 | |
---|
6 | onintr - |
---|
7 | if (! $?prompt) goto end |
---|
8 | |
---|
9 | if ($?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 |
---|
18 | endif |
---|
19 | unset rev rel pat |
---|
20 | endif |
---|
21 | |
---|
22 | if ($?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 |
---|
31 | set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null |
---|
32 | set hosts=($hosts $f) |
---|
33 | endif |
---|
34 | unset f |
---|
35 | if ( ! $?hosts ) then |
---|
36 | set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \ |
---|
37 | guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \ |
---|
38 | ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \ |
---|
39 | labrea.stanford.edu sumex-aim.stanford.edu \ |
---|
40 | tut.cis.ohio-state.edu) |
---|
41 | endif |
---|
42 | |
---|
43 | complete ywho n/*/\$hosts/ # argument from list in $hosts |
---|
44 | complete rsh p/1/\$hosts/ c/-/"(l n)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/ |
---|
45 | complete xrsh p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/ |
---|
46 | complete rlogin p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ |
---|
47 | complete telnet p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/ |
---|
48 | |
---|
49 | complete cd p/1/d/ # Directories only |
---|
50 | complete chdir p/1/d/ |
---|
51 | complete pushd p/1/d/ |
---|
52 | complete popd p/1/d/ |
---|
53 | complete pu p/1/d/ |
---|
54 | complete po p/1/d/ |
---|
55 | complete complete p/1/X/ # Completions only |
---|
56 | complete uncomplete n/*/X/ |
---|
57 | complete exec p/1/c/ # Commands only |
---|
58 | complete trace p/1/c/ |
---|
59 | complete strace p/1/c/ |
---|
60 | complete which n/*/c/ |
---|
61 | complete where n/*/c/ |
---|
62 | complete skill p/1/c/ |
---|
63 | complete dde p/1/c/ |
---|
64 | complete adb c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/ |
---|
65 | complete sdb p/1/c/ |
---|
66 | complete dbx c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/ |
---|
67 | complete xdb p/1/c/ |
---|
68 | complete gdb n/-d/d/ n/*/c/ |
---|
69 | complete ups p/1/c/ |
---|
70 | complete set 'c/*=/f/' 'p/1/s/=' 'n/=/f/' |
---|
71 | complete unset n/*/s/ |
---|
72 | complete alias p/1/a/ # only aliases are valid |
---|
73 | complete unalias n/*/a/ |
---|
74 | complete xdvi n/*/f:*.dvi/ # Only files that match *.dvi |
---|
75 | complete dvips n/*/f:*.dvi/ |
---|
76 | complete tex n/*/f:*.tex/ # Only files that match *.tex |
---|
77 | complete latex n/*/f:*.{tex,ltx}/ |
---|
78 | complete su c/--/"(login fast preserve-environment command shell \ |
---|
79 | help version)"/ c/-/"(f l m p c s -)"/ \ |
---|
80 | n/{-c,--command}/c/ \ |
---|
81 | n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/ |
---|
82 | complete cc c/-[IL]/d/ \ |
---|
83 | c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \ |
---|
84 | c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/ |
---|
85 | complete acc c/-[IL]/d/ \ |
---|
86 | c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \ |
---|
87 | c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/ |
---|
88 | complete gcc c/-[IL]/d/ \ |
---|
89 | c/-f/"(caller-saves cse-follow-jumps delayed-branch \ |
---|
90 | elide-constructors expensive-optimizations \ |
---|
91 | float-store force-addr force-mem inline \ |
---|
92 | inline-functions keep-inline-functions \ |
---|
93 | memoize-lookups no-default-inline \ |
---|
94 | no-defer-pop no-function-cse omit-frame-pointer \ |
---|
95 | rerun-cse-after-loop schedule-insns \ |
---|
96 | schedule-insns2 strength-reduce \ |
---|
97 | thread-jumps unroll-all-loops \ |
---|
98 | unroll-loops syntax-only all-virtual \ |
---|
99 | cond-mismatch dollars-in-identifiers \ |
---|
100 | enum-int-equiv no-asm no-builtin \ |
---|
101 | no-strict-prototype signed-bitfields \ |
---|
102 | signed-char this-is-variable unsigned-bitfields \ |
---|
103 | unsigned-char writable-strings call-saved-reg \ |
---|
104 | call-used-reg fixed-reg no-common \ |
---|
105 | no-gnu-binutils nonnull-objects \ |
---|
106 | pcc-struct-return pic PIC shared-data \ |
---|
107 | short-enums short-double volatile)"/ \ |
---|
108 | c/-W/"(all aggregate-return cast-align cast-qual \ |
---|
109 | comment conversion enum-clash error format \ |
---|
110 | id-clash-len implicit missing-prototypes \ |
---|
111 | no-parentheses pointer-arith return-type shadow \ |
---|
112 | strict-prototypes switch uninitialized unused \ |
---|
113 | write-strings)"/ \ |
---|
114 | c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \ |
---|
115 | short c68000 c68020 soft-float g gnu unix fpu \ |
---|
116 | no-epilogue)"/ \ |
---|
117 | c/-d/"(D M N)"/ \ |
---|
118 | c/-/"(f W vspec v vpath ansi traditional \ |
---|
119 | traditional-cpp trigraphs pedantic x o l c g L \ |
---|
120 | I D U O O2 C E H B b V M MD MM i dynamic \ |
---|
121 | nodtdlib static nostdinc undef)"/ \ |
---|
122 | c/-l/f:*.a/ \ |
---|
123 | n/*/f:*.{c,C,cc,o,a,s,i}/ |
---|
124 | complete g++ n/*/f:*.{C,cc,o,s,i}/ |
---|
125 | complete CC n/*/f:*.{C,cc,o,s,i}/ |
---|
126 | complete rm c/--/"(directory force interactive verbose \ |
---|
127 | recursive help version)"/ c/-/"(d f i v r R -)"/ \ |
---|
128 | n/*/f:^*.{c,cc,C,h,in}/ # Protect precious files |
---|
129 | complete vi n/*/f:^*.[oa]/ |
---|
130 | complete bindkey N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \ |
---|
131 | n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\ |
---|
132 | n/-k/"(left right up down)"/ p/2-/b/ \ |
---|
133 | p/1/'x:<key-sequence or option>'/ |
---|
134 | |
---|
135 | complete find n/-fstype/"(nfs 4.2)"/ n/-name/f/ \ |
---|
136 | n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \ |
---|
137 | n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \ |
---|
138 | c/-/"(fstype name perm prune type user nouser \ |
---|
139 | group nogroup size inum atime mtime ctime exec \ |
---|
140 | ok print ls cpio ncpio newer xdev depth \ |
---|
141 | daystart follow maxdepth mindepth noleaf version \ |
---|
142 | anewer cnewer amin cmin mmin true false uid gid \ |
---|
143 | ilname iname ipath iregex links lname empty path \ |
---|
144 | regex used xtype fprint fprint0 fprintf \ |
---|
145 | print0 printf not a and o or)"/ \ |
---|
146 | n/*/d/ |
---|
147 | |
---|
148 | complete -%* c/%/j/ # fill in the jobs builtin |
---|
149 | complete {fg,bg,stop} c/%/j/ p/1/"(%)"// |
---|
150 | |
---|
151 | complete limit c/-/"(h)"/ n/*/l/ |
---|
152 | complete unlimit c/-/"(h)"/ n/*/l/ |
---|
153 | |
---|
154 | complete -co* p/0/"(compress)"/ # make compress completion |
---|
155 | # not ambiguous |
---|
156 | complete zcat n/*/f:*.Z/ |
---|
157 | complete nm n/*/f:^*.{h,C,c,cc}/ |
---|
158 | |
---|
159 | complete finger c/*@/\$hosts/ n/*/u/@ |
---|
160 | complete ping p/1/\$hosts/ |
---|
161 | complete traceroute p/1/\$hosts/ |
---|
162 | |
---|
163 | complete {talk,ntalk,phone} p/1/'`users | tr " " "\012" | uniq`'/ \ |
---|
164 | n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/ |
---|
165 | |
---|
166 | complete ftp c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/ |
---|
167 | |
---|
168 | # this one is simple... |
---|
169 | #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/: |
---|
170 | # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> |
---|
171 | # This one will rsh to the file to fetch the list of files! |
---|
172 | complete rcp 'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");rsh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");rsh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@' 'n/*/$hosts/:' |
---|
173 | |
---|
174 | complete dd c/--/"(help version)"/ c/[io]f=/f/ \ |
---|
175 | c/conv=*,/"(ascii ebcdic ibm block unblock \ |
---|
176 | lcase ucase swab noerror sync)"/,\ |
---|
177 | c/conv=/"(ascii ebcdic ibm block unblock \ |
---|
178 | lcase ucase swab noerror sync)"/,\ |
---|
179 | c/*=/x:'<number>'/ \ |
---|
180 | n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/= |
---|
181 | |
---|
182 | complete nslookup p/1/x:'<host>'/ p/2/\$hosts/ |
---|
183 | |
---|
184 | complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \ |
---|
185 | p/2/f:*.a/ p/*/f:*.o/ |
---|
186 | |
---|
187 | complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \ |
---|
188 | c@+@F:$HOME/Mail/@ |
---|
189 | |
---|
190 | # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com> |
---|
191 | complete {rexec,rxexec,rxterm,rmterm} \ |
---|
192 | 'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \ |
---|
193 | 'n/-E/e/' 'n/*/c/' |
---|
194 | complete kill 'c/-/S/' 'c/%/j/' \ |
---|
195 | 'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/' |
---|
196 | |
---|
197 | # these from Marc Horowitz <marc@cam.ov.com> |
---|
198 | complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \ |
---|
199 | 'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \ |
---|
200 | 'c/-/(verbose quiet force printpath lookup debug map \ |
---|
201 | nomap remap zephyr nozephyr readonly write \ |
---|
202 | mountpoint noexplicit explicit type mountoptions \ |
---|
203 | nosetuid setuid override skipfsck lock user host)/' \ |
---|
204 | 'n/-e/f/' 'n/*/()/' |
---|
205 | complete hesinfo 'p/1/u/' \ |
---|
206 | 'p/2/(passwd group uid grplist pcap pobox cluster \ |
---|
207 | filsys sloc service)/' |
---|
208 | |
---|
209 | # these from E. Jay Berkenbilt <ejb@ERA.COM> |
---|
210 | complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,srcdir}/(=)//' \ |
---|
211 | 'c/--/(cache-file verbose prefix srcdir)//' |
---|
212 | complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \ |
---|
213 | dfaxhigh dfaxlow laserjet ljet4 sparc pbm \ |
---|
214 | pbmraw pgm pgmraw ppm ppmraw bit)/' \ |
---|
215 | 'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \ |
---|
216 | 'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/' |
---|
217 | complete perl 'n/-S/c/' |
---|
218 | complete printenv 'n/*/e/' |
---|
219 | complete sccs p/1/"(admin cdc check clean comb deledit delget \ |
---|
220 | delta diffs edit enter fix get help info \ |
---|
221 | print prs prt rmdel sccsdiff tell unedit \ |
---|
222 | unget val what)"/ |
---|
223 | complete setenv 'p/1/e/' 'c/*:/f/' |
---|
224 | |
---|
225 | # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us> |
---|
226 | if ( -f $HOME/.mh_profile && -x "`which folders`" ) then |
---|
227 | |
---|
228 | if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`" |
---|
229 | if ( ! $?MHA ) setenv MHA "`ali | sed -e '/^ /d' -e 's/:.*//'`" |
---|
230 | |
---|
231 | set folders = ( $FOLDERS ) |
---|
232 | set mha = ( $MHA ) |
---|
233 | |
---|
234 | complete ali \ |
---|
235 | 'c/-/(alias nolist list nonormalize normalize nouser user help)/' \ |
---|
236 | 'n,-alias,f,' |
---|
237 | |
---|
238 | complete anno \ |
---|
239 | 'c/-/(component noinplace inplace nodate date text help)/' \ |
---|
240 | 'c,+,$folders,' \ |
---|
241 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
242 | |
---|
243 | complete burst \ |
---|
244 | 'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \ |
---|
245 | 'c,+,$folders,' \ |
---|
246 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
247 | |
---|
248 | complete comp \ |
---|
249 | 'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \ |
---|
250 | 'c,+,$folders,' \ |
---|
251 | 'n,-whatnowproc,c,' \ |
---|
252 | 'n,-file,f,'\ |
---|
253 | 'n,-form,f,'\ |
---|
254 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
255 | |
---|
256 | complete dist \ |
---|
257 | 'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \ |
---|
258 | 'c,+,$folders,' \ |
---|
259 | 'n,-whatnowproc,c,' \ |
---|
260 | 'n,-form,f,'\ |
---|
261 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
262 | |
---|
263 | complete folder \ |
---|
264 | 'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \ |
---|
265 | 'c,+,$folders,' \ |
---|
266 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
267 | |
---|
268 | complete folders \ |
---|
269 | 'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \ |
---|
270 | 'c,+,$folders,' \ |
---|
271 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
272 | |
---|
273 | complete forw \ |
---|
274 | 'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \ |
---|
275 | 'c,+,$folders,' \ |
---|
276 | 'n,-whatnowproc,c,' \ |
---|
277 | 'n,-filter,f,'\ |
---|
278 | 'n,-form,f,'\ |
---|
279 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
280 | |
---|
281 | complete inc \ |
---|
282 | 'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \ |
---|
283 | 'c,+,$folders,' \ |
---|
284 | 'n,-audit,f,'\ |
---|
285 | 'n,-form,f,' |
---|
286 | |
---|
287 | complete mark \ |
---|
288 | 'c/-/(add delete list sequence nopublic public nozero zero help)/' \ |
---|
289 | 'c,+,$folders,' \ |
---|
290 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
291 | |
---|
292 | complete mhmail \ |
---|
293 | 'c/-/(body cc from subject help)/' \ |
---|
294 | 'n,-cc,$mha,' \ |
---|
295 | 'n,-from,$mha,' \ |
---|
296 | 'n/*/$mha/' |
---|
297 | |
---|
298 | complete mhpath \ |
---|
299 | 'c/-/(help)/' \ |
---|
300 | 'c,+,$folders,' \ |
---|
301 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
302 | |
---|
303 | complete msgchk \ |
---|
304 | 'c/-/(nodate date nonotify notify help)/' |
---|
305 | |
---|
306 | complete msh \ |
---|
307 | 'c/-/(prompt noscan scan notopcur topcur help)/' |
---|
308 | |
---|
309 | complete next \ |
---|
310 | 'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \ |
---|
311 | 'c,+,$folders,' \ |
---|
312 | 'n,-moreproc,c,' \ |
---|
313 | 'n,-showproc,c,' \ |
---|
314 | 'n,-form,f,' |
---|
315 | |
---|
316 | complete packf \ |
---|
317 | 'c/-/(file help)/' \ |
---|
318 | 'c,+,$folders,' \ |
---|
319 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
320 | |
---|
321 | complete pick \ |
---|
322 | 'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \ |
---|
323 | 'c,+,$folders,' \ |
---|
324 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
325 | |
---|
326 | complete prev \ |
---|
327 | 'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \ |
---|
328 | 'c,+,$folders,' \ |
---|
329 | 'n,-moreproc,c,' \ |
---|
330 | 'n,-showproc,c,' \ |
---|
331 | 'n,-form,f,' |
---|
332 | |
---|
333 | complete prompter \ |
---|
334 | 'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' |
---|
335 | |
---|
336 | complete refile \ |
---|
337 | 'c/-/(draft nolink link nopreserve preserve src file help)/' \ |
---|
338 | 'c,+,$folders,' \ |
---|
339 | 'n,-file,f,'\ |
---|
340 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
341 | |
---|
342 | complete rmf \ |
---|
343 | 'c/-/(nointeractive interactive help)/' \ |
---|
344 | 'c,+,$folders,' |
---|
345 | |
---|
346 | complete rmm \ |
---|
347 | 'c/-/(help)/' \ |
---|
348 | 'c,+,$folders,' \ |
---|
349 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
350 | |
---|
351 | complete scan \ |
---|
352 | 'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \ |
---|
353 | 'c,+,$folders,' \ |
---|
354 | 'n,-form,f,'\ |
---|
355 | 'n,-file,f,'\ |
---|
356 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
357 | |
---|
358 | complete send \ |
---|
359 | 'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \ |
---|
360 | 'n,-alias,f,'\ |
---|
361 | 'n,-filter,f,' |
---|
362 | |
---|
363 | complete show \ |
---|
364 | 'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \ |
---|
365 | 'c,+,$folders,' \ |
---|
366 | 'n,-moreproc,c,' \ |
---|
367 | 'n,-showproc,c,' \ |
---|
368 | 'n,-form,f,'\ |
---|
369 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
370 | |
---|
371 | complete sortm \ |
---|
372 | 'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \ |
---|
373 | 'c,+,$folders,' \ |
---|
374 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
375 | |
---|
376 | complete vmh \ |
---|
377 | 'c/-/(prompt vmhproc novmhproc help)/' \ |
---|
378 | 'n,-vmhproc,c,' |
---|
379 | |
---|
380 | complete whatnow \ |
---|
381 | 'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' |
---|
382 | |
---|
383 | complete whom \ |
---|
384 | 'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \ |
---|
385 | 'n,-alias,f,' |
---|
386 | |
---|
387 | complete plum \ |
---|
388 | 'c/-/()/' \ |
---|
389 | 'c,+,$folders,' \ |
---|
390 | 'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,' |
---|
391 | |
---|
392 | complete mail \ |
---|
393 | 'c/-/()/' \ |
---|
394 | 'n/*/$mha/' |
---|
395 | |
---|
396 | endif |
---|
397 | |
---|
398 | # these from Tom Warzeka <waz@quahog.npt.nuwc.navy.mil> |
---|
399 | # you may need to set the following variables for your host |
---|
400 | set _elispdir = /usr/local/share/emacs/20.2/lisp # GNU Emacs lisp directory |
---|
401 | set _maildir = /var/spool/mail # Post Office: /var/spool/mail or /usr/mail |
---|
402 | set _ypdir = /var/yp # directory where NIS (YP) maps are kept |
---|
403 | set _domain = "`domainname`" |
---|
404 | |
---|
405 | # this one works but is slow and doesn't descend into subdirectories |
---|
406 | # complete cd C@[./\$~]*@d@ \ |
---|
407 | # p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@ |
---|
408 | |
---|
409 | if ( -r /etc/shells ) then |
---|
410 | complete setenv p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@ |
---|
411 | else |
---|
412 | complete setenv p@1@e@ n@DISPLAY@\$hosts@: |
---|
413 | endif |
---|
414 | complete unsetenv n/*/e/ |
---|
415 | |
---|
416 | if (-r $HOME/.mailrc) then |
---|
417 | complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \ |
---|
418 | c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \ |
---|
419 | n@-u@T:$_maildir@ n/-f/f/ \ |
---|
420 | n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " " " | cut -f 2`'@ |
---|
421 | else |
---|
422 | complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \ |
---|
423 | c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \ |
---|
424 | n@-u@T:$_maildir@ n/-f/f/ n/*/u/ |
---|
425 | endif |
---|
426 | |
---|
427 | complete man n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \ |
---|
428 | n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \ |
---|
429 | n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \ |
---|
430 | n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \ |
---|
431 | n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \ |
---|
432 | n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \ |
---|
433 | n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \ |
---|
434 | n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \ |
---|
435 | n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \ |
---|
436 | n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \ |
---|
437 | n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \ |
---|
438 | n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \ |
---|
439 | n@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \ |
---|
440 | n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \ |
---|
441 | c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \ |
---|
442 | N@-P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/ |
---|
443 | |
---|
444 | complete ps c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \ |
---|
445 | n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/ |
---|
446 | complete compress c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/ |
---|
447 | complete uncompress c/-/"(c f v)"/ n/*/f:*.Z/ |
---|
448 | |
---|
449 | complete xhost c/[+-]/\$hosts/ n/*/\$hosts/ |
---|
450 | |
---|
451 | # these conform to the latest GNU versions available at press time ... |
---|
452 | |
---|
453 | complete emacs c/-/"(batch d f funcall i insert kill l load \ |
---|
454 | no-init-file nw q t u user)"/ c/+/x:'<line_number>'/ \ |
---|
455 | n/-d/x:'<display>'/ n/-f/x:'<lisp_function>'/ n/-i/f/ \ |
---|
456 | n@-l@F:$_elispdir@ n/-t/x:'<terminal>'/ \ |
---|
457 | n/-u/u/ n/*/f:^*[\#~]/ |
---|
458 | |
---|
459 | complete gzcat c/--/"(force help license quiet version)"/ \ |
---|
460 | c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/ |
---|
461 | complete gzip c/--/"(stdout to-stdout decompress uncompress \ |
---|
462 | force help list license no-name quiet recurse \ |
---|
463 | suffix test verbose version fast best)"/ \ |
---|
464 | c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\ |
---|
465 | n/{-S,--suffix}/x:'<file_name_suffix>'/ \ |
---|
466 | n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \ |
---|
467 | N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \ |
---|
468 | n/*/f:^*.{gz,Z,z,zip,taz,tgz}/ |
---|
469 | complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \ |
---|
470 | no-name quiet recurse suffix test verbose version)"/ \ |
---|
471 | c/-/"(c f h l L n q r S t v V -)"/ \ |
---|
472 | n/{-S,--suffix}/x:'<file_name_suffix>'/ \ |
---|
473 | n/*/f:*.{gz,Z,z,zip,taz,tgz}/ |
---|
474 | complete zgrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\ |
---|
475 | c/-/"(A b B c C e f h i l n s v V w x)"/ \ |
---|
476 | p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \ |
---|
477 | n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/ |
---|
478 | complete zegrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\ |
---|
479 | c/-/"(A b B c C e f h i l n s v V w x)"/ \ |
---|
480 | p/1/x:'<full_regular_expression>'/ N/-*e/f/ \ |
---|
481 | n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/ |
---|
482 | complete zfgrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\ |
---|
483 | c/-/"(A b B c C e f h i l n s v V w x)"/ \ |
---|
484 | p/1/x:'<fixed_string>'/ N/-*e/f/ \ |
---|
485 | n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/ |
---|
486 | complete znew c/-/"(f t v 9 P K)"/ n/*/f:*.Z/ |
---|
487 | complete zmore n/*/f:*.{gz,Z,z,zip}/ |
---|
488 | complete zfile n/*/f:*.{gz,Z,z,zip,taz,tgz}/ |
---|
489 | complete ztouch n/*/f:*.{gz,Z,z,zip,taz,tgz}/ |
---|
490 | complete zforce n/*/f:^*.{gz,tgz}/ |
---|
491 | |
---|
492 | complete grep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\ |
---|
493 | c/-/"(A b B c C e f h i l n s v V w x)"/ \ |
---|
494 | p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \ |
---|
495 | n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/ |
---|
496 | complete egrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\ |
---|
497 | c/-/"(A b B c C e f h i l n s v V w x)"/ \ |
---|
498 | p/1/x:'<full_regular_expression>'/ N/-*e/f/ \ |
---|
499 | n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/ |
---|
500 | complete fgrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\ |
---|
501 | c/-/"(A b B c C e f h i l n s v V w x)"/ \ |
---|
502 | p/1/x:'<fixed_string>'/ N/-*e/f/ \ |
---|
503 | n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/ |
---|
504 | |
---|
505 | complete users c/--/"(help version)"/ p/1/x:'<accounting_file>'/ |
---|
506 | complete who c/--/"(heading mesg idle count help message version \ |
---|
507 | writable)"/ c/-/"(H T w i u m q s -)"/ \ |
---|
508 | p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/ |
---|
509 | |
---|
510 | complete chown c/--/"(changes silent quiet verbose recursive help \ |
---|
511 | version)"/ c/-/"(c f v R -)"/ C@[./\$~]@f@ c/*[.:]/g/ \ |
---|
512 | n/-/u/. p/1/u/. n/*/f/ |
---|
513 | complete chgrp c/--/"(changes silent quiet verbose recursive help \ |
---|
514 | version)"/ c/-/"(c f v R -)"/ n/-/g/ p/1/g/ n/*/f/ |
---|
515 | |
---|
516 | complete cat c/--/"(number-nonblank number squeeze-blank show-all \ |
---|
517 | show-nonprinting show-ends show-tabs help version)"/ \ |
---|
518 | c/-/"(b e n s t u v A E T -)"/ n/*/f/ |
---|
519 | complete mv c/--/"(backup force interactive update verbose suffix \ |
---|
520 | version-control help version)"/ \ |
---|
521 | c/-/"(b f i u v S V -)"/ \ |
---|
522 | n/{-S,--suffix}/x:'<suffix>'/ \ |
---|
523 | n/{-V,--version-control}/"(t numbered nil existing \ |
---|
524 | never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/ |
---|
525 | complete cp c/--/"(archive backup no-dereference force interactive \ |
---|
526 | link preserve symbolic-link update verbose parents \ |
---|
527 | one-file-system recursive suffix version-control help \ |
---|
528 | version)"/ c/-/"(a b d f i l p r s u v x P R S V -)"/ \ |
---|
529 | n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \ |
---|
530 | n/{-V,--version-control}/"(t numbered nil existing \ |
---|
531 | never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/ |
---|
532 | complete ln c/--/"(backup directory force interactive symbolic \ |
---|
533 | verbose suffix version-control help version)"/ \ |
---|
534 | c/-/"(b d F f i s v S V -)"/ \ |
---|
535 | n/{-S,--suffix}/x:'<suffix>'/ \ |
---|
536 | n/{-V,--version-control}/"(t numbered nil existing \ |
---|
537 | never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \ |
---|
538 | p/1/f/ p/2/x:'<link_name>'/ |
---|
539 | complete touch c/--/"(date file help time version)"/ \ |
---|
540 | c/-/"(a c d f m r t -)"/ \ |
---|
541 | n/{-d,--date}/x:'<date_string>'/ \ |
---|
542 | c/--time/"(access atime mtime modify use)"/ \ |
---|
543 | n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/ |
---|
544 | complete mkdir c/--/"(parents help version mode)"/ c/-/"(p m -)"/ \ |
---|
545 | n/{-m,--mode}/x:'<mode>'/ n/*/d/ |
---|
546 | complete rmdir c/--/"(parents help version)"/ c/-/"(p -)"/ n/*/d/ |
---|
547 | |
---|
548 | complete tar c/-[Acru]*/"(b B C f F g G h i l L M N o P \ |
---|
549 | R S T v V w W X z Z)"/ \ |
---|
550 | c/-[dtx]*/"( B C f F g G i k K m M O p P \ |
---|
551 | R s S T v w x X z Z)"/ \ |
---|
552 | p/1/"(A c d r t u x -A -c -d -r -t -u -x \ |
---|
553 | --catenate --concatenate --create --diff --compare \ |
---|
554 | --delete --append --list --update --extract --get \ |
---|
555 | --help --version)"/ \ |
---|
556 | c/--/"(catenate concatenate create diff compare \ |
---|
557 | delete append list update extract get atime-preserve \ |
---|
558 | block-size read-full-blocks directory checkpoint file \ |
---|
559 | force-local info-script new-volume-script incremental \ |
---|
560 | listed-incremental dereference ignore-zeros \ |
---|
561 | ignore-failed-read keep-old-files starting-file \ |
---|
562 | one-file-system tape-length modification-time \ |
---|
563 | multi-volume after-date newer old-archive portability \ |
---|
564 | to-stdout same-permissions preserve-permissions \ |
---|
565 | absolute-paths preserve record-number remove-files \ |
---|
566 | same-order preserve-order same-owner sparse \ |
---|
567 | files-from null totals verbose label version \ |
---|
568 | interactive confirmation verify exclude exclude-from \ |
---|
569 | compress uncompress gzip ungzip use-compress-program \ |
---|
570 | block-compress help version)"/ \ |
---|
571 | c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \ |
---|
572 | T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \ |
---|
573 | n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \ |
---|
574 | n/{-[Adrtux]*f,--file}/f:*.tar/ \ |
---|
575 | N/{-x*f,--file}/'`tar -tf $:-1`'/ \ |
---|
576 | n/--use-compress-program/c/ \ |
---|
577 | n/{-b,--block-size}/x:'<block_size>'/ \ |
---|
578 | n/{-V,--label}/x:'<volume_label>'/ \ |
---|
579 | n/{-N,--{after-date,newer}}/x:'<date>'/ \ |
---|
580 | n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \ |
---|
581 | n/{-C,--directory}/d/ \ |
---|
582 | N/{-C,--directory}/'`\ls $:-1`'/ \ |
---|
583 | n/-[0-7]/"(l m h)"/ |
---|
584 | |
---|
585 | # SVR4 filesystems |
---|
586 | #complete mount c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \ |
---|
587 | # n/-o/x:'<FSType_options>'/ \ |
---|
588 | # n@-F@'`\ls -1 /usr/lib/fs`'@ \ |
---|
589 | # n@*@'`grep -v "^#" /etc/vfstab | tr -s " " " " | cut -f 3`'@ |
---|
590 | #complete umount c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \ |
---|
591 | # n/*/'`mount | cut -d " " -f 1`'/ |
---|
592 | #complete mountall c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ |
---|
593 | #complete umountall c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \ |
---|
594 | # n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/ |
---|
595 | # BSD 4.3 filesystems |
---|
596 | complete mount c/-/"(a r t v)"/ n/-t/"(4.2 nfs)"/ \ |
---|
597 | n@*@'`grep -v "^#" /etc/fstab | tr -s " " " " | cut -f 2`'@ |
---|
598 | complete umount c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \ |
---|
599 | n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \ |
---|
600 | n/*/'`mount | cut -d " " -f 3`'/ |
---|
601 | # BSD 4.2 filesystems |
---|
602 | #complete mount c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \ |
---|
603 | # n@*@'`cut -d ":" -f 2 /etc/fstab`'@ |
---|
604 | #complete umount c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \ |
---|
605 | # n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \ |
---|
606 | # n/*/'`mount | cut -d " " -f 3`'/ |
---|
607 | |
---|
608 | # these deal with NIS (formerly YP); if it's not running you don't need 'em |
---|
609 | complete domainname p@1@D:$_ypdir@" " n@*@n@ |
---|
610 | complete ypcat c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \ |
---|
611 | N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \ |
---|
612 | n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ |
---|
613 | complete ypmatch c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \ |
---|
614 | N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \ |
---|
615 | n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ |
---|
616 | complete ypwhich c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \ |
---|
617 | n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \ |
---|
618 | N@-m@n@ n@*@\$hosts@ |
---|
619 | |
---|
620 | # there's no need to clutter the user's shell with these |
---|
621 | unset _elispdir _maildir _ypdir _domain |
---|
622 | |
---|
623 | complete make \ |
---|
624 | 'n/-f/f/' \ |
---|
625 | 'c/*=/f/' \ |
---|
626 | 'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^ #].*:/s/:.*//p"`@' |
---|
627 | |
---|
628 | if ( -f /etc/printcap ) then |
---|
629 | set printers=(`sed -n -e "/^[^ #].*:/s/:.*//p" /etc/printcap`) |
---|
630 | |
---|
631 | complete lpr 'c/-P/$printers/' |
---|
632 | complete lpq 'c/-P/$printers/' |
---|
633 | complete lprm 'c/-P/$printers/' |
---|
634 | complete lpquota 'p/1/(-Qprlogger)/' 'c/-P/$printers/' |
---|
635 | complete dvips 'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/' |
---|
636 | endif |
---|
637 | |
---|
638 | unset noglob |
---|
639 | unset complete |
---|
640 | endif |
---|
641 | |
---|
642 | end: |
---|
643 | onintr |
---|