Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _w3m update for 0.5.x
- X-seq: zsh-workers 21392
- From: Doug Kearns <dougkearns@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: _w3m update for 0.5.x
- Date: Tue, 28 Jun 2005 21:30:40 +1000
- Mail-followup-to: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Here's an update of w3m completion for 0.5.x with some general
improvements.
Regards,
Doug
Index: Completion/Unix/Command/_w3m
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_w3m,v
retrieving revision 1.11
diff -u -r1.11 _w3m
--- Completion/Unix/Command/_w3m 26 Feb 2004 12:57:21 -0000 1.11
+++ Completion/Unix/Command/_w3m 28 Jun 2005 11:24:51 -0000
@@ -1,51 +1,106 @@
#compdef w3m
+# w3m version w3m/0.5.1
+
local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
_arguments -C \
- '-t[tabwidth]:tabwidth:' \
+ '-t[set tab width]:tab width:' \
'-r[ignore backspace effect]' \
- '-l[preserved lines]:number of lines:' \
- '-B[load bookmark]' \
- '-bookmark:bookmark file:_files' \
- '-T[content-type]:content type' \
+ '-l[specify number of preserved lines]:number of lines (default 10000):' \
+ '-I[document charset]:charset:->charset' \
+ '-O[display/output charset]:charset:->charset' \
+ '( -s -j)-e[EUC-JP]' \
+ '(-e -j)-s[Shift_JIS]' \
+ '(-e -s )-j[JIS]' \
+ '(-v *)-B[load bookmark]' \
+ '-bookmark[specify bookmark file]:bookmark file:_files' \
+ '-T[specify content-type]:content type:_mime_types' \
'-m[internet message mode]' \
- '-v[visual startup mode]' \
+ '(-B *)-v[visual startup mode]' \
'-M[monochrome display]' \
+ '-N[open URL of command line on each new tab]' \
'-F[automatically render frame]' \
- '(-dump_source -dump_head)-dump' \
- '-cols:column width' \
- '(-dump -dump_head)-dump_source' \
- '(-dump -dump_source)-dump_head' \
+ '-cols[specify column width (used with -dump)]:column width' \
+ '-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \
+ '-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \
+ '( -dump_head -dump_source -dump_both -dump_extra)-dump[dump formatted page into stdout]' \
+ '(-dump -dump_source -dump_both -dump_extra)-dump_head[dump HEAD and source into stdout]' \
+ '(-dump -dump_head -dump_both -dump_extra)-dump_source[dump page source into stdout]' \
+ '(-dump -dump_head -dump_source -dump_extra)-dump_both[dump HEAD and source into stdout]' \
+ '(-dump -dump_head -dump_source -dump_both )-dump_extra[dump HEAD, source, and extra information into stdout]' \
+ '-post[use POST method with file content]:POST data file:_files' \
+ '-header[insert string as a header]:header:' \
+ '+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \
'-num[show line number]' \
- '-no-proxy' \
- '-no-mouse' \
- '(-no-cookie)-cookie' \
- '(-cookie)-no-cookie' \
- '-no-graph' \
+ "-no-proxy[don't use proxy]" \
+ '(-6)-4[IPv4 only (-o dns_order=4)]' \
+ '(-4)-6[IPv6 only (-o dns_order=6)]' \
+ "-no-mouse[don't use mouse]" \
+ '(-no-cookie)-cookie[use cookie]' \
+ "(-cookie)-no-cookie[don't use cookie]" \
+ '-pauth[proxy authentication]:user\:pass:->pauth' \
+ '(-no-graph)-graph[use graphic character]' \
+ "(-graph)-no-graph[don't use graphic character]" \
'-S[squeeze multiple blank lines]' \
'-W[toggle wrap search mode]' \
- '-X[do not use termcap init/deinit]' \
- '-o[option]:option-value' \
- '-config:config file:_files' \
+ "-X[don't use termcap init/deinit]" \
+ '-title=[set buffer name to terminal title string]:terminal:_terminals' \
+ '*-o[assign value to config option]:option=value:->option' \
+ '(- *)-show-option[print all config options]' \
+ '-config[specify config file]:configuration file:_files' \
+ '(- *)-help[print usage information]' \
+ '(- *)-version[print version information]' \
'-debug' \
- ':URL:->html' \
- '+:goto line' && ret=0
-
-if [[ -n $state ]]; then
- local w3mhistory
+ '(-B -v)*:URL:->html' && ret=0
- _tags files w3mhistory urls
- while _tags; do
- _requested files expl 'file' _files -g "*.x#html(-.)" && ret=0
- _requested urls expl 'URL' _urls && ret=0
- if [[ -s ~/.w3m/history ]] && _requested w3mhistory; then
+case "$state" in
+ charset)
+ local -a charsets
+ charsets=(
+ US-ASCII ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5
+ ISO-8859-6 ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 ISO-8859-11
+ ISO-8859-13 ISO-8859-14 ISO-8859-15 ISO-8859-16 EUC-JP Shift_JIS
+ Shift_JISX0213 ISO-2022-JP ISO-2022-JP-2 ISO-2022-JP-3 EUC-CN GBK GB18030
+ HZ-GB-2312 ISO-2022-CN EUC-TW Big5 HKSCS EUC-KR UHC Johab ISO-2022-KR
+ TIS-620 TCVN-5712 VISCII VPS KOI8-R KOI8-U NeXTSTEP CP437 CP737 CP775
+ CP850 CP852 CP855 CP856 CP857 CP860 CP861 CP862 CP863 CP864 CP865 CP866
+ CP869 CP874 CP1006 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255 CP1256
+ CP1257 CP1258 UTF-8 UTF-7
+ )
+ _wanted charsets expl 'character set' compadd -a charsets && ret=0
+ ;;
+ html)
+ local -a bookmarks w3mhistory
+ if [[ -s ~/.w3m/bookmark.html ]]; then
+ bookmarks=( ${${(M)${(f)"$(<~/.w3m/bookmark.html)"}:#<li>*}/(#b)<li><a href=\"(*)\">*/$match[1]} )
+ fi
+ if [[ -s ~/.w3m/history ]]; then
w3mhistory=( ${(f)"$(<~/.w3m/history)"} )
- _all_labels w3mhistory expl 'URL from history' compadd -a w3mhistory
fi
- (( ret )) || break
- done
-fi
+ _alternative \
+ 'files:file:_files -g "*.x#html(-.)"' \
+ 'urls:URL:_urls' \
+ 'bookmarks:bookmarks:compadd -a bookmarks' \
+ 'history:history:compadd -a w3mhistory' && ret=0
+ ;;
+ option)
+ local -a options
+ options=( ${${(M)${(f)"$(_call_program options $words[1] -show-option 2>/dev/null)"}:# -o *}/(#b) -o (*)=[^ ]#[[:blank:]]##(*)/$match[1]:${match[2]:l}} )
+ if compset -P '*='; then
+ _message -e values 'value'
+ else
+ _describe -t options 'option' options -S '=' && ret=0
+ fi
+ ;;
+ pauth)
+ if compset -P '*:'; then
+ _message -e passwords 'password'
+ else
+ _users -S ':' && ret=0
+ fi
+ ;;
+esac
return ret
Messages sorted by:
Reverse Date,
Date,
Thread,
Author