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

Re: completion in vared



On Apr 28,  5:00pm, Peter Stephenson wrote:
} Subject: completion in vared
} 
} Any thoughts about completion in vared?  Would it be possible to get it to
} start completion with the context set to _value or _array_value, and
} compstate[parameter] set?

How about something like

	function vared {
	    local _complete_vared=${(Pt)1}
	    builtin vared "$@"
	}

And then somewhere (I'm not familiar enough with it yet to be sure where)
in the completion functions, do

	case $_complete_vared in
	array|association) compstate[parameter]=$words[1]
			   compstate[context]=_array_value;;
	scalar) compstate[parameter]=$words[1]
		compstate[context]=_value;;
	*) ;;
	esac

Obviously some tweaking is needed to handle "vared -c ..." and so on, but
you get the idea.

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



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