1#compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default- 2 3local -a specs 4local expl paren 5 6if [[ -n $compstate[quote] ]]; then 7 paren='(' 8else 9 paren='\(' 10fi 11 12if [[ $PREFIX == *%(-|)<-># ]]; then 13 specs=( 14 'm:hostname up to first .' 15 '_:status of parser' 16 'd:current working directory' 17 '/:current working directory' 18 '~:current working directory, with ~ replacement' 19 'N:name of current script or shell function' 20 'x:name of file containing code being executed' 21 'c:deprecated' 22 '.:deprecated' 23 'C:deprecated' 24 'F:start using fg color' 25 'K:start using bg color' 26 'G:counts as extra character inside %{...%}' 27 ) 28 if [[ $PREFIX == *% ]]; then 29 if [[ $service == -value-,SPROMPT,* ]]; then 30 specs+=( 31 'r:suggested correction' 32 'R:corrected string' 33 ) 34 fi 35 specs+=( 36 '%:A %' 37 '):A )' 38 'l:current line (tty) with /dev/tty stripped' 39 'M:full hostname' 40 'n:username' 41 'y:current line (tty)' 42 '#:a # when root, % otherwise' 43 '?:return status of last command' 44 'h:current history event number' 45 '!:current history event number' 46 'i:current line number' 47 'I:current source line number' 48 'j:number of jobs' 49 'L:$SHLVL' 50 'D:date in yy-mm-dd format' 51 'T:current time of day, 24-hour format' 52 't:current time of day, 12-hour am/pm format' 53 '@:current time of day, 12-hour am/pm format' 54 '*:current time of day, 24-hour format with seconds' 55 'w:the date in day-dd format' 56 'W:the date in mm/dd/yy format' 57 'D{}:format string like strftime' 58 'B:start bold' 59 'b:stop bold' 60 'E:clear to end of line' 61 'U:start underline' 62 'u:stop underline' 63 'S:start standout' 64 's:stop standout' 65 'f:reset fg color' 66 'k:reset bg color' 67 '{:start literal escape sequence' 68 '}:stop literal escape sequence' 69 'v:value from $psvar array' 70 '(:ternary expression %(x.true-string.false-string)' 71 '<<:truncation from left %len<string<' 72 '>>:truncation from right %len>string>' 73 '[]:truncation from who knows where' 74 ) 75 fi 76 compset -P "*" 77 _describe -t prompt-format-specifier 'prompt format specifier' specs -S '' 78 _message -e prompt-format-specifier number 79elif [[ $PREFIX == *%$paren(-|)<-># ]]; then 80 specs=( 81 '!:running with privileges' 82 '#:effective uid' 83 '?:exit status' 84 '_:at least n shell constructs started' 85 'C:at least n path elements' 86 '/:at least n path elements' 87 '.:at least n path elements' 88 'c:at least n path elements' 89 '~:at least n path elements' 90 'D:month' 91 'd:day of month' 92 'g:effective gid' 93 'j:number of jobs' 94 'L:SHLVL' 95 'l:number of characters already printed' 96 'S:SECONDS parameter at least n' 97 'T:current hour' 98 't:current minute' 99 'v:psvar has at least n elements' 100 'V:element n of psvar is set and non-empty' 101 'w:day of week (Sunday = 0)' 102 ) 103 compset -P "*" 104 _describe -t ternary-prompt-expression 'ternary prompt format test character' specs -S '' 105 _message -e ternary-prompt-expression number 106else 107 _describe -t prompt-format-specifier 'prompt format specifier' '(%)' -S '' 108 _default "$@" 109fi 110