From 026631ab818995ad480a9ea3e5a7ec243c645db1 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 27 Oct 2003 11:17:29 +0000 Subject: zsh-users/6727 (Lloyd Zusman): improve _w3m --- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_w3m | 19 +++++-------------- Completion/Unix/Command/_w3mhistory | 10 ++++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 Completion/Unix/Command/_w3mhistory (limited to 'Completion') diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 04e83bead..33d62a6b9 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -23,4 +23,5 @@ _perforce _python _antiword _screen _renice _apm _ecasound _gpg _subversion _aap _sablotron _nmap _chmod _du _nice _rar _vorbis +_w3mhistory ' diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m index 70ac75e4c..683a9f67d 100644 --- a/Completion/Unix/Command/_w3m +++ b/Completion/Unix/Command/_w3m @@ -1,6 +1,6 @@ #compdef w3m -local curcontext="$curcontext" state line ret=1 +local curcontext="$curcontext" state line typeset -A opt_args _arguments -C \ @@ -31,19 +31,10 @@ _arguments -C \ '-o[option]:option-value:' \ '-config:config file:_files' \ '-debug' \ - ':url:->url' && ret=0 + ':url:->html' && return 0 case $state in - url) - local _w3mhistory - - if [[ -s ~/.w3m/history ]]; then - _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"}) - compadd $_w3mhistory && ret=0 - fi - - _urls -f && ret=0 - ;; + html) + _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_w3mhist' + ;; esac - -return ret diff --git a/Completion/Unix/Command/_w3mhistory b/Completion/Unix/Command/_w3mhistory new file mode 100644 index 000000000..f0f944138 --- /dev/null +++ b/Completion/Unix/Command/_w3mhistory @@ -0,0 +1,10 @@ +#autoload + +local _w3mhistory + +if [[ -s ~/.w3m/history ]]; then + _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"}) + compadd $_w3mhistory +fi + +_urls -f -- cgit 1.4.1