initial checkin
[zsh-lovers.git] / zsh_people / strcat / zshcompctl
1 # Tab host completion for programs  
2 compctl -k ping telnet ncftp host nslookup irssi rlogin ftp
3
4 # Make completion (yeah im getting fucking lazy)
5 compile=(install clean remove uninstall deinstall)
6 compctl -k compile make
7
8 # some (useful) completions
9  compctl -j -P '%' fg jobs disown
10  compctl -g '*.(gz|z|Z|t[agp]z|tarZ|tz)' + -g '*(-/)' gunzip gzcat zcat
11  compctl -g '*.tar.Z *.tar.gz *.tgz *.zip *.ZIP *.tar.bz2 *.tar' + -g '*'  show-archive simple-extract
12  compctl -g '*.(mp3|MP3|ogg|OGG|temp|TEMP)' + -g '*(-/)'  mpg123 xmms
13  compctl -g "*.html *.htm" + -g "*(-/) .*(-/)" + -H 0 '' w3m lynx links wget opera
14  compctl -g '*.(pdf|PDF)' + -g '*(-/)'  xpdf
15  compctl -g '*(-/)' + -g '.*(/)' cd chdir dirs pushd rmdir dircmp cl tree 
16  compctl -g '*.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG|bmp)' + -g '*(-/)' gimp xv pornview
17  compctl -g '*.(e|E|)(ps|PS)' + -g '*(-/)' gs ghostview nup psps pstops psmulti psnup psselect gv
18  compctl -g '*.tex*' + -g '*(-/)' {,la,gla,ams{la,},{g,}sli}tex texi2dvi
19  compctl -g '*.dvi' + -g '*(-/)' dvips
20  compctl -g '/var/db/pkg/*(/:t)' pkg_delete pkg_info
21  compctl -g '[^.]*(-/) *.(c|C|cc|c++|cxx|cpp)' + -f cc CC c++ gcc g++
22  compctl -g '[^.]*(-/) *(*)' + -f strip ldd gdb
23  compctl -s '$(<~/.vim/tags)' vimhelp
24  compctl -s '/var/log/packages/*(.:t:r)' slapt-get
25
26 # 'compctl' with regex
27  # kill takes signal names as the first argument after -, but job names after %
28  compctl -j -P % -x 's[-] p[1]' -k signals -- kill
29  # gzip files, but gzip -d only gzipped or compressed files
30  compctl -x 'R[-*[dt],^*]' -g '*.(gz|z|Z|t[agp]z|tarZ|tz)(D)' + -g '*(-/D)' + -f -  's[]' -g '^*(.(tz|gz|t[agp]z|tarZ|zip|ZIP|jpg|JPG|gif|GIF|[zZ])|[~#])' + -f -- gzip
31  # read '/etc/shells' to complete 'chsh -s'
32  compctl -u -x 'c[-1,-s]' -s '$(</etc/shells)' -- chsh
33  # For rcs users, co and rlog from the RCS directory.  We don't want to see
34  # the RCS and ,v though.
35  compctl -g 'RCS/*(D:s@RCS/@@:s/,v//)' + -g '*(-/D)' co rlog rcs{,diff,merge} revdiff logs mymerge cil
36  #  Argument to finger and talk is username@hostname 
37  compctl -x 'N[-1,@]' -k hosts - 's[]' -u -S '' -- finger talk
38  # Fnord!  
39  compctl -f -x \
40             'p[1]' -k '(cvf czvf cjvf tvf tzvf tjvf xvf xzvf xjvf)' \
41           - 'p[2] W[1,*z*f*],p[2] W[1,*f*z*]' -g '[^.]*(-/) *.(tar.(gz|z|Z)|taz|tgz)' \
42           - 'p[2] W[1,*I*f*],p[2] W[1,*f*I*]' -g '[^.]*(-/) *.tar.bz2' \
43           - 'p[2] W[1,*f*]' -g '[^.]*(-/) *.tar' + -f -- tar 
44 # security by.. by.. *aehm* .. me? *g*
45 compctl -k '(asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa dsaparam \
46            enc errstr gendh gendsa genrsa nseq passwd pkcs12 pkcs7 pkcs8 \
47            rand req rsa rsautl s_client s_server s_time sess_id smime speed \
48            spkac verify version x509)' openssl
49 # Don't complete uninteresting users
50 zstyle ':completion:*:*:*:users' ignored-patterns \
51         _fingerd _kadmin _rstatd _syslogd daemon nobody proxy sshd \
52         _identd _kdc _rusersd _x11 operator root uucp _isakmpd _portmap \
53         _spamd named popa3d smmsp
54
55 # ... unless we really want to.
56 zstyle '*' single-ignored show
57
58 # fucking duplicate entries in my $HISTFILE *narf*
59 zstyle ':completion:*:history-words' stop yes
60 zstyle ':completion:*:history-words' remove-all-dups yes
61 zstyle ':completion:*:history-words' list false
62 zstyle ':completion:*:history-words' menu yes
63
64 # completion for "man" by Gossamer <gossamer@tertius.net.au> 980827
65 # This is damn funky. I'm going to do something similar for pinfo,
66 # hopefully.
67 #-------------------------------------------------- 
68 compctl -f -x 'S[1][2][3][4][5][6][7][8][9]' -k '(1 2 3 4 5 6 7 8 9)' \
69   - 'R[[1-9nlo]|[1-9](|[a-z]),^*]' -K 'match-man' \
70   - 's[-M],c[-1,-M]' -g '*(-/)' \
71   - 's[-P],c[-1,-P]' -c \
72   - 's[-S],s[-1,-S]' -k '( )' \
73   - 's[-]' -k '(a d f h k t M P)' \
74   - 'p[1,-1]' -c + -K 'match-man' \
75   -- vman pinfo
76 #--------------------------------------------------
77 # setopt SH_WORD_SPLIT function man_var () {
78 #    man_pages=( $^manpath/man*/*(N:t:r:r) )
79 #       compctl -k man_pages man
80 #          reply=( $man_pages )
81 #  }
82 #  compctl -K man_var vman pinfo; man_pages=()
83 #--------------------------------------------------