1#compdef rxvt urxvt urxvtc
2
3local curcontext="$curcontext" state line expl
4local -a suf long_args
5typeset -A opt_args
6typeset -U extensions
7
8[[ -prefix -- ]] || zstyle -T ":completion:${curcontext}:options" prefix-needed &&
9  : ${(A)long_args:=${${${${${${${(M)${(f)"$(urxvt --help 2>&1)"}:#  *:*}/  /--}// /}/fontname/fontname:->fonts}/:color/:color:_x_color}/boolean/boolean:(true false)}/:(searchpath|file)/:path:_files}}
10
11_x_arguments \
12  -+{rv,ls,j,ss,ptab,sb,sr,st,si,sk,sw,ip,tr,ut,vb,tcw,insecure,uc,bc,pb,is,override-redirect,hold,bl,sbg,ssc,ssr} \
13  '-tn[specify value of TERM]:terminal type:_terminals' \
14  '-C[intercept console messages]' \
15  '-iconic[start iconic]' \
16  '-cd[start shell in specific directory]:directory:_files -/' \
17  '-sbt[scroll bar thickness]:pixels' \
18  '-tint[tint color]:color:_x_color' \
19  '-fade[make colors darker when losing focus]:percentage' \
20  '-fadecolor[specify target color for off-focus fading]:color:_x_color' \
21  '-sh[shade background when tinting]:percentage' \
22  '-bg[background color]:color:_x_color' \
23  '-fg[foreground color]:color:_x_color' \
24  '-hc[highlight color]:color:_x_color' \
25  '-cr[cursor color]:color:_x_color' \
26  '-pr[pointer color]:color:_x_color' \
27  '-pr2[pointer background color]:color:_x_color' \
28  '-bd[border color]:color:_x_color' \
29  '-pixmap:pixmap:_files' \
30  '-icon[specify icon image]:image file:_files' \
31  '-fn:normal font:->fonts' \
32  '-fb:bold font:->fonts' \
33  '-fi:italic font:->fonts' \
34  '-fbi:bold italic font:->fonts' \
35  '-im:input method:(SCIM)' \
36  '-pe[enable perl extension]:perl extension:->extensions' \
37  '-pt:input style:(OverTheSpot OffTheSpot Root)' \
38  '-imlocale:locale input method:_locales' \
39  '-imfont:fontset for styles OverTheSpot and OffTheSpot:_x_font' \
40  '-name:client instance, icon, and title strings' \
41  '(-T -title)'{-T,-title}':title name for window' \
42  '-n:icon name for window' \
43  '-sl:save lines' \
44  '-embed:window id to embed terminal in:_x_window' \
45  '-pty-fd:file descriptor of pty to use' \
46  '-w:external border in pixels' \
47  '-b:internal border in pixels' \
48  '-lsp:number of extra pixels between rows' \
49  '-letsp:letter spacing adjustment' \
50  '-mod:meta modifier:_x_modifier' \
51  '-e:program: _command_names -e:*::program arguments: _normal' \
52  '-help[print help]' \
53  '--help[list long options]' $long_args && ret=0
54
55case $state in
56  fonts)
57    if compset -P xft:; then
58      _xft_fonts && ret=0
59    else
60      _x_font && ret=0
61    fi
62  ;;
63  extensions)
64    compset -S ',*' || suf=( -qS , )
65    compset -P '*,'; compset -P -
66    extensions=( {$commands[urxvt]:h:h,/usr,/usr/local}/lib{,64}/urxvt/perl(N) )
67    _wanted extensions expl 'perl extension' compadd $suf[@] default \
68        $extensions/*(:t) && ret=0
69  ;;
70esac
71
72return ret
73