about summary refs log tree commit diff
path: root/Completion/Unix/Command/_w3m
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_w3m')
-rw-r--r--Completion/Unix/Command/_w3m39
1 files changed, 20 insertions, 19 deletions
diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m
index 02a995a92..1106d5987 100644
--- a/Completion/Unix/Command/_w3m
+++ b/Completion/Unix/Command/_w3m
@@ -1,24 +1,23 @@
 #compdef w3m
 
-local curcontext="$curcontext" state line ret=1
+local curcontext="$curcontext" state line expl ret=1
 typeset -A opt_args
 
-_arguments \
+_arguments -C \
   '-t[tabwidth]:tabwidth:' \
   '-r[ignore backspace effect]' \
   '-l[preserved lines]:number of lines:' \
   '-B[load bookmark]' \
   '-bookmark:bookmark file:_files' \
-  '-T[content-type]:content type:' \
+  '-T[content-type]:content type' \
   '-m[internet message mode]' \
   '-v[visual startup mode]' \
   '-M[monochrome display]' \
   '-F[automatically render frame]' \
   '(-dump_source -dump_head)-dump' \
-  '-cols:column width:' \
+  '-cols:column width' \
   '(-dump -dump_head)-dump_source' \
   '(-dump -dump_source)-dump_head' \
-  '+:goto line:' \
   '-num[show line number]' \
   '-no-proxy' \
   '-no-mouse' \
@@ -28,23 +27,25 @@ _arguments \
   '-S[squeeze multiple blank lines]' \
   '-W[toggle wrap search mode]' \
   '-X[do not use termcap init/deinit]' \
-  '-o[option]:option-value:' \
+  '-o[option]:option-value' \
   '-config:config file:_files' \
   '-debug' \
-  ':url:->url' && ret=0
+  ':url:->html' \
+  '+:goto line' && ret=0
 
-case $state in
-	url)
-	local _w3mhistory
+if [[ -n $state ]]; then
+  local w3mhistory
 
-	if [[ -s ~/.w3m/history ]]; then
-	   _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
-	   compadd $_w3mhistory && ret=0
-	fi
-
-	_urls -f && ret=0
-	;;
-
-esac
+  _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
+      w3mhistory=( ${(f)"$(<~/.w3m/history)"} )
+      _all_labels w3mhistory expl 'url from history' compadd -a w3mhistory
+    fi
+    (( ret )) || break
+  done
+fi
 
 return ret