alias pset if ([$0]) {
    @ :_pl = word(0 $pattern($0% $_sets))
    if ([$0] =~ [-%]) {
	if (match($after(- $0) $_sets)) {
	    ^assign $0
	    xecho -s -b Value of $toupper($after(- $0)) set to <EMPTY>
	    hook update $after(- $0)
	}{
	    _setcat $strip(- $pattern($0% $_sets))
	}
    } elsif (_pl) {
	if ([$1] != []) {
	    if (match($_pl $lit_sets)) {
		^assign $_pl $1-
		xecho -s -b Value of $toupper($_pl) set to $($_pl)
	    }{
		if (![$2] && match($1 on off 1 0)) {
		^assign $_pl $fix.oo2($1)
		xecho -s -b Value of $toupper($_pl) set to $toupper($fix.oo1($($_pl)))
		}{
		    xecho -s -b Value must be either ON, OFF, 1, or 0
		}
	    }
	    hook update $_pl
	}{
	    _setcat $pattern($0% $_sets)
	}
    }{
	xecho -s -b No such variable \"$0\"
    }
}{
    _setcat $_sets
}

/* based off _setcat from parallax/r2a by shade (modifications by fudd) */
alias _setcat {
    fe ($*) xx {
	if (match($xx $lit_sets)) {
	    xecho -s -b $fparse(format_set${[$($xx)] == [] ? [_novalue] : []} $toupper($xx) $($xx))
	}{
	    xecho -s -b $fparse(format_set${[$($xx)] == [] ? [_novalue] : []} $toupper($xx) $toupper($fix.oo1($($xx))))
	}
    }
}
