mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-10-31 18:10:56 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			75 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| #compdef -k delete-char-or-list \C-xv
 | |
| 
 | |
| # You probably want to bind this to Control-D.
 | |
| 
 | |
| local odf="$compconfig[description_format]"
 | |
| local omf="$compconfig[message_format]"
 | |
| local ogm="$compconfig[group_matches]"
 | |
| local oop="$compconfig[option_prefix]"
 | |
| local odo="$compconfig[describe_options]"
 | |
| local odv="$compconfig[describe_values]"
 | |
| local what nm
 | |
| 
 | |
| (( $# )) || set -- ${(s.:.)compconfig[verboselist_stages]}
 | |
| 
 | |
| if [[ "$BUFFER" != "$_vl_buffer" || "$*" != "$_vl_config" ]]; then
 | |
|   _vl_buffer="$BUFFER"
 | |
|   _vl_config="$*"
 | |
|   _vl_array=( "$@" )
 | |
|   _vl_index=1
 | |
|   if (( ! $#_vl_array )); then
 | |
|     [[ -n "$compconfig[option_prefix]" ]] && _vl_array=(options)
 | |
|     [[ -z "$compconfig[describe_options]" ||
 | |
|        -z "$compconfig[describe_options]" ]] &&
 | |
|         _vl_array=( "$_vl_array[@]" options-describe )
 | |
| 
 | |
|     _vl_array=( "$_vl_array[@]" normal )
 | |
|   fi
 | |
|   if [[ -z "$compstate[old_list]" ]]; then
 | |
|     if (( $_vl_array[(I)normal] )); then
 | |
|       _vl_index="$_vl_array[(I)normal]"
 | |
|     else
 | |
|       _vl_array=( normal "$_vl_array[@]" )
 | |
|     fi
 | |
|   fi
 | |
| fi
 | |
| 
 | |
| # If we had a possibility to say `ignore all matches added up to now',
 | |
| # we could de-comment these thigs and wouldn't have the problem that
 | |
| # if the options were already the stage `options' is a somewhat
 | |
| # irritating no-op.
 | |
| # Or maybe we make the completion functions report if they added
 | |
| # options/description one day.
 | |
| 
 | |
| # while true; do
 | |
|   what="$_vl_array[_vl_index++]"
 | |
|   [[ _vl_index -gt $#_vl_array ]] && _vl_index=1
 | |
| 
 | |
|   if [[ "$what" != normal ]]; then
 | |
|     [[ -z "$odf" ]] && compconfig[description_format]='---- %d'
 | |
|     [[ -z "$omf" ]] && compconfig[message_format]='---- %d'
 | |
|     [[ -z "$ogm" ]] && compconfig[group_matches]=yes
 | |
|     [[ "$what" = *options* ]] && compconfig[option_prefix]=''
 | |
|     if [[ "$what" = *describe* ]]; then
 | |
|       compconfig[describe_options]=yes
 | |
|       compconfig[describe_values]=yes
 | |
|     fi
 | |
|   fi
 | |
| 
 | |
|   if [[ -n "$compstate[old_list]" ]]; then
 | |
|     nm="$_lastcomp[nmatches]"
 | |
|   else
 | |
|     nm=-1
 | |
|   fi
 | |
| 
 | |
|   _main_complete
 | |
| 
 | |
| #   [[ "$what" != options || compstate[nmatches] -ne nm ]] && break
 | |
| # done
 | |
| 
 | |
| compconfig[description_format]="$odf"
 | |
| compconfig[message_format]="$omf"
 | |
| compconfig[group_matches]="$ogm"
 | |
| compconfig[option_prefix]="$oop"
 | |
| compconfig[describe_options]="$odo"
 | |
| compconfig[describe_values]="$odv"
 |