1#compdef nedit nedit-nc=nc ncl=nc
2
3local state line expl nedit_common curcontext="$curcontext" ret=1
4typeset -A opt_args
5
6nedit_common=(
7  '-read[open file read only]'
8  "-create[create file if it doesn't already exist]"
9  '-line[go to specified line number]:line number'
10  '-do[execute macro or action commands]:macro command'
11  '-lm[specify language mode]:language mode:->lang'
12  '-svrname[name the server]:nedit server name'
13  '(-noiconic -icon -iconic)'{-icon,-iconic}'[set initial window state to iconic]'
14  '*-tabbed[open all subsequent files in new tabs]'
15  '*-untabbed[open all subsequent files in new windows]'
16  '*-group[open all subsequent files as tabs in a new window]'
17  '(- *)'{-V,-version}'[display version information]'
18  '*-xrm:resource:_x_resource'
19  '*:file:_files'
20)
21
22if [[ $service = nc ]]; then
23  _x_arguments -C -S \
24    '(-noask)-ask[prompt if no server found]' \
25    '(-ask)-noask[start a new server without asking if none found]' \
26    "-wait[don't return to the shell until all files given are closed]" \
27    '-timeout[timeout period when talking to server]:timeout (seconds)' \
28    '-svrcmd[command to run server]:server command:_command_names -e' \
29    "$nedit_common[@]" && ret=0
30else
31  _x_arguments -C -S \
32    '-server[designate this session as an nedit server]' \
33    '-tags[load ctags file]:tags file:_files' \
34    '-tabs[specify tab width in characters]:tab width' \
35    '(-nowrap -autowrap -noautowrap)-wrap[use continuous wrap mode]' \
36    '(-wrap -autowrap -noautowrap)-nowrap[turn off continuous wrap mode]' \
37    '(-wrap -nowrap -noautowrap)-autowrap[use auto-newline wrap mode]' \
38    '(-wrap -nowrap -autowrap)-noautowrap[turn off auto-newline wrap mode]' \
39    '(-noautoindent)-autoindent[maintain a running indent]' \
40    '(-autoindent)-noautoindent[turn off autoindent]' \
41    '(-noautosave)-autosave[maintain a backup copy of file being edited]' \
42    "(-autosave)-noautosave[don't maintain a backup copy of file being edited]" \
43    "(-iconic)-noiconic[don't set initial window state to iconic]" \
44    '-rows[specify default height in characters for an editing window]:height' \
45    '-columns[specify default width in characters for an editing window]:width' \
46    '-font[specify font for text window]:font:_x_font' \
47    '(-bg)-background:background color:_x_color' \
48    '(-background)-bg[specify background color]:background color:_x_color' \
49    '(-fg)-foreground:foreground color:_x_color' \
50    '(-foreground)-fg[specify foreground color]:foreground color:_x_color' \
51    '*-import[load additional preferences file]:nedit preferences file:_files' \
52    "$nedit_common[@]" && ret=0
53fi
54
55[[ $state = lang && -f ~/.nedit ]] &&
56    _wanted neditlanguages expl 'language mode' \
57        compadd -  ${(f)"$(sed -n \
58            '/^nedit.languageMode/,/^nedit/ s/.*	\([^:]*\).*/\1/p' < ~/.nedit)"} && ret=0
59
60return ret
61