2000-04-30 12:04:29 +02:00
|
|
|
#compdef -k complete-word \C-x?
|
|
|
|
|
2001-02-28 17:55:27 +01:00
|
|
|
setopt localoptions ${_comp_options[@]}
|
2000-04-30 12:04:29 +02:00
|
|
|
|
2000-05-19 18:04:16 +02:00
|
|
|
setopt localtraps noerrexit ; trap - ZERR
|
|
|
|
|
2000-04-30 12:04:29 +02:00
|
|
|
(( $+_debug_count )) || integer -g _debug_count
|
2000-05-02 13:56:27 +02:00
|
|
|
local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count]
|
2000-05-12 04:31:05 +02:00
|
|
|
local w="${(qq)words}"
|
2000-04-30 12:04:29 +02:00
|
|
|
|
2000-05-12 04:31:05 +02:00
|
|
|
exec 3>&- # Too bad if somebody else is using it ...
|
2000-04-30 12:04:29 +02:00
|
|
|
[[ -t 2 ]] && exec 3>&2 2>| $tmp
|
|
|
|
|
|
|
|
setopt xtrace
|
|
|
|
_main_complete
|
|
|
|
integer ret=$?
|
|
|
|
unsetopt xtrace
|
|
|
|
|
2000-05-12 04:31:05 +02:00
|
|
|
[[ -t 3 ]] && {
|
2000-09-14 17:55:21 +02:00
|
|
|
print -sR "${VISUAL:-${EDITOR:-${PAGER:-more}}} ${(q)tmp} ;: $w"
|
2000-05-30 05:57:39 +02:00
|
|
|
_message -r "Trace output left in $tmp (up-history to view)"
|
2000-05-31 11:56:12 +02:00
|
|
|
[[ $compstate[nmatches] -le 1 && $compstate[list] != *force* ]] &&
|
|
|
|
compstate[list]='list force messages'
|
2000-04-30 12:04:29 +02:00
|
|
|
exec 2>&3 3>&-
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret
|