Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh-4.04 and w3m browser



On Aug 28,  3:08pm, Vincent Lefevre wrote:
} Subject: Re: zsh-4.04 and w3m browser
}
} except that I really don't like nonomatch, so I won't use it (unless
} one can apply nonomatch only to some globterns, e.g. to words starting
} with http: or ftp:).

Minimally tested, but seems to work:

---- 8< ---- snip ---- 8< ----
function urlglobber {
    local -a args globbed
    local arg command="$1"
    shift
    for arg
    do
	case "${arg}" in
	(ftp://(|localhost)/*)
	    globbed=( ${~${arg##ftp://(|localhost)}} )
	    args[$#args+1]=( "${(M)arg##ftp://(|localhost)}${(@)^globbed}" )
	    ;;
	((http(|s)|ftp):*) args[$#args+1]="$arg";;
	(*) args[$#args+1]=( ${~arg} );;
	esac
    done
    "$command" "${(@)args}"
}
alias globurl='noglob urlglobber'
alias ncftp='globurl ncftp'
alias lynx='globurl lynx'
alias w3m='globurl w3m'
---- 8< ---- snip ---- 8< ----

Other cases, such as <http://localhost/globbed?unglobbed>, are left as an
excercise for the reader.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author